CLI Module
Record Shelf
A tool for creating custom reports from music collection data with sorting by category and then alphabetically.
Command Line Interface
The CLI module provides the command-line interface for Record Shelf using the Click framework.
Usage Examples
Programmatic CLI Usage
You can invoke the CLI programmatically:
from record_shelf.cli import main
import sys
# Simulate command line arguments
sys.argv = ['record-shelf', 'generate', '--username', 'myuser', '--output', 'test.xlsx']
main()
Click Context Usage
from click.testing import CliRunner
from record_shelf.cli import cli
runner = CliRunner()
result = runner.invoke(cli, ['generate', '--username', 'testuser', '--output', 'test.xlsx'])
print(result.output)
Command Documentation
record-shelf
Record Shelf - Music Collection Reports Tool
record-shelf [OPTIONS] COMMAND [ARGS]...
Options
- --debug
Enable debug logging
generate
Generate a custom Discogs collection report
record-shelf generate [OPTIONS]
Options
- --token <token>
Discogs API token (or set DISCOGS_TOKEN env var)
- --username <username>
Required Discogs username
- -o, --output <output>
Output file path
- --category <category>
Filter by specific category (optional)
- --format <format>
Output format
- Options:
xlsx | csv | html
list-categories
List all categories in the user’s collection
record-shelf list-categories [OPTIONS]
Options
- --token <token>
Discogs API token (or set DISCOGS_TOKEN env var)
- --username <username>
Required Discogs username