docs: improve CLI help, shell completion, and README

- Add command groups (Getting Started, Search, Downloads, Daemon, System)
- Add shell completion command (bash, zsh, fish, powershell)
- Add flag completions for --type, --quality, --sort, --lang, --genre,
  --country, --method, --player
- Improve Long descriptions and Examples for all commands
- Split doctor disk check into platform-specific files (Unix/Windows)
- Validate infoHash length before truncating (prevent panic)
- Fix references to non-existent 'unarr daemon start' command
- Move stats command to System & Diagnostics group
- Rewrite README with complete documentation, correct config format
  (toml not yaml), all commands, shell completion section
This commit is contained in:
Deivid Soto 2026-03-28 21:36:27 +01:00
parent 197e33956a
commit 719429b06e
22 changed files with 973 additions and 119 deletions

View file

@ -28,7 +28,15 @@ func init() {
Long: `unarr is a powerful terminal tool for torrent search and management.
Search 30+ torrent sources, inspect torrent quality, discover popular content,
find streaming providers, and manage your media collection all from your terminal.`,
find streaming providers, and manage your media collection all from your terminal.
Get started:
unarr setup First-time configuration wizard
unarr search "breaking bad" Search for content
unarr start Start the download daemon
Documentation: https://torrentclaw.com/cli
Source: https://github.com/torrentclaw/torrentclaw-cli`,
PersistentPreRun: func(cmd *cobra.Command, args []string) {
if noColor || os.Getenv("NO_COLOR") != "" {
color.NoColor = true
@ -38,33 +46,95 @@ find streaming providers, and manage your media collection — all from your ter
SilenceErrors: true,
}
// Command groups for organized help output
rootCmd.AddGroup(
&cobra.Group{ID: "start", Title: "Getting Started:"},
&cobra.Group{ID: "search", Title: "Search & Discovery:"},
&cobra.Group{ID: "download", Title: "Downloads & Streaming:"},
&cobra.Group{ID: "daemon", Title: "Daemon Management:"},
&cobra.Group{ID: "system", Title: "System & Diagnostics:"},
)
rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default ~/.config/unarr/config.toml)")
rootCmd.PersistentFlags().StringVar(&apiKeyFlag, "api-key", "", "API key (overrides config file and env)")
rootCmd.PersistentFlags().BoolVar(&jsonOut, "json", false, "output as JSON (for piping)")
rootCmd.PersistentFlags().BoolVar(&noColor, "no-color", false, "disable colored output")
// Getting Started
setupCmd := newSetupCmd()
setupCmd.GroupID = "start"
configCmd := newConfigCmd()
configCmd.GroupID = "start"
// Search & Discovery
searchCmd := newSearchCmd()
searchCmd.GroupID = "search"
inspectCmd := newInspectCmd()
inspectCmd.GroupID = "search"
popularCmd := newPopularCmd()
popularCmd.GroupID = "search"
recentCmd := newRecentCmd()
recentCmd.GroupID = "search"
watchCmd := newWatchCmd()
watchCmd.GroupID = "search"
// Downloads & Streaming
downloadCmd := newDownloadCmd()
downloadCmd.GroupID = "download"
streamCmd := newStreamCmd()
streamCmd.GroupID = "download"
// Daemon Management
startCmd := newStartCmd()
startCmd.GroupID = "daemon"
stopCmd := newStopCmd()
stopCmd.GroupID = "daemon"
statusCmd := newStatusCmd()
statusCmd.GroupID = "daemon"
daemonCmd := newDaemonCmd()
daemonCmd.GroupID = "daemon"
// System & Diagnostics
statsCmd := newStatsCmd()
statsCmd.GroupID = "system"
doctorCmd := newDoctorCmd()
doctorCmd.GroupID = "system"
selfUpdateCmd := newSelfUpdateCmd()
selfUpdateCmd.GroupID = "system"
versionCmd := newVersionCmd()
versionCmd.GroupID = "system"
completionCmd := newCompletionCmd()
completionCmd.GroupID = "system"
rootCmd.AddCommand(
newSetupCmd(),
newStartCmd(),
newStopCmd(),
newDaemonCmd(),
newDownloadCmd(),
newStatusCmd(),
newSearchCmd(),
newInspectCmd(),
newPopularCmd(),
newRecentCmd(),
newStatsCmd(),
newWatchCmd(),
newConfigCmd(),
newDoctorCmd(),
newVersionCmd(),
// Getting Started
setupCmd,
configCmd,
// Search & Discovery
searchCmd,
inspectCmd,
popularCmd,
recentCmd,
watchCmd,
// Downloads & Streaming
downloadCmd,
streamCmd,
// Daemon Management
startCmd,
stopCmd,
statusCmd,
daemonCmd,
// System & Diagnostics
statsCmd,
doctorCmd,
selfUpdateCmd,
versionCmd,
completionCmd,
// Stubs for future commands
newStubCmd("upgrade", "Find a better version of a torrent"),
newStubCmd("moreseed", "Find same quality with more seeders"),
newStubCmd("compare", "Compare two torrents side by side"),
newStubCmd("scan", "Scan your media library for upgrades"),
newStreamCmd(),
newStubCmd("add", "Search and add torrents to your client"),
newStubCmd("monitor", "Watch for new episodes of a series"),
newStubCmd("open", "Open content in the browser"),