package main import ( "fmt" "io" "strings" ) func isHelpArg(arg string) bool { return arg == "-h" || arg == "--help" } func commandWantsHelp(args []string) bool { for _, arg := range args { if isHelpArg(arg) { return true } } return false } func printMainHelp(w io.Writer) { fmt.Fprint(w, `streamrip-go Usage: rip [global options] [command options] rip help [command] Commands: url Rip one or more URLs file Rip URLs or IDs from a file id Rip by source, media type, and ID search Search a provider and download selected results lastfm Import a Last.fm playlist config Manage configuration database Inspect download databases Global options: -f, --folder Override downloads folder -q, --quality <0-4> Override provider quality -c, --codec Convert after download: ALAC, FLAC, OGG, MP3, AAC -ndb, --no-db Ignore download database --no-progress Disable progress bars --no-ssl-verify Disable TLS verification --config-path Use a custom config file -v, -vv Verbose logging -h, --help Show help Run 'rip help ' for command-specific help. `) } func printCommandHelp(w io.Writer, command string) bool { switch strings.ToLower(strings.TrimSpace(command)) { case "url": fmt.Fprint(w, `Usage: rip url [--force|--ignore-db] Rip one or more provider URLs. Examples: rip url https://www.beatport.com/release/example/123 rip url https://play.qobuz.com/album/abc --force Options: --force, --ignore-db Redownload even if already in the database `) case "file": fmt.Fprint(w, `Usage: rip file [--force|--ignore-db] Rip URLs or JSON ID entries from a file. Options: --force, --ignore-db Redownload even if already in the database `) case "id": fmt.Fprint(w, `Usage: rip id [quality] [--force|--ignore-db] Rip an item by provider ID. Sources: qobuz, tidal, deezer, yandex, beatport, soundcloud Media types: track, album, playlist, artist, label, chart, video Options: quality Override quality for this rip, 0-4 --force, --ignore-db Redownload even if already in the database `) case "search": fmt.Fprint(w, `Usage: rip search [options] Search a provider and optionally download selected results. Sources: qobuz, tidal, deezer, yandex, beatport, soundcloud Media types: track, album, playlist, artist, label, chart, video Options: --limit N Maximum results to show --first Download the first result without prompting --no-download Show results only --output-file Write results as JSON --force, --ignore-db Redownload even if already in the database `) case "lastfm": fmt.Fprint(w, `Usage: rip lastfm [--source SOURCE] [--fallback-source SOURCE] Import a Last.fm playlist and resolve tracks through configured providers. Options: --source SOURCE Primary lookup source --fallback-source SOURCE Fallback lookup source `) case "config": fmt.Fprint(w, `Usage: rip config [options] Manage configuration. Commands: open Open the config file in an editor reset Reset config to defaults path Print the config path Options: -v, --vim Use Vim for 'rip config open' -y, --yes Confirm 'rip config reset' without prompting `) case "database": fmt.Fprint(w, `Usage: rip database browse Inspect local download databases. `) case "dev-help": printDeveloperHelp(w) default: return false } return true } func printDeveloperHelp(w io.Writer) { fmt.Fprint(w, `Developer smoke commands: soundcloud-smoke qobuz-smoke, qobuz-rip-smoke, qobuz-convert-rip-smoke qobuz-album-rip-smoke, qobuz-playlist-rip-smoke, qobuz-artist-rip-smoke, qobuz-label-rip-smoke qobuz-search-smoke tidal-search-smoke, tidal-metadata-smoke, tidal-video-smoke tidal-rip-smoke, tidal-album-rip-smoke, tidal-playlist-rip-smoke, tidal-artist-rip-smoke `) }