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

@ -24,7 +24,13 @@ func newDownloadCmd() *cobra.Command {
Use: "download <info_hash|magnet>",
Short: "Download a torrent (one-shot, no daemon needed)",
Long: `Download a specific torrent by info hash or magnet link.
This is a standalone download it does not require the daemon to be running.`,
This is a standalone download that does not require the daemon to be running.
Useful for quick one-off downloads. The file is saved to your configured
download directory. Press Ctrl+C to cancel.
For managed downloads (queue, progress tracking, web dashboard), use the
daemon instead: 'unarr start'.`,
Example: ` unarr download abc123def456abc123def456abc123def456abc1
unarr download "magnet:?xt=urn:btih:..." --method torrent`,
Args: cobra.ExactArgs(1),
@ -33,7 +39,10 @@ This is a standalone download — it does not require the daemon to be running.`
},
}
cmd.Flags().StringVar(&method, "method", "torrent", "download method: torrent (default)")
cmd.Flags().StringVar(&method, "method", "torrent", "download method: torrent, debrid, usenet")
cmd.RegisterFlagCompletionFunc("method", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
return []string{"torrent\tBitTorrent P2P", "debrid\tReal-Debrid / AllDebrid", "usenet\tUsenet (requires Pro)"}, cobra.ShellCompDirectiveNoFileComp
})
return cmd
}
@ -55,6 +64,9 @@ func runDownload(input, method string) error {
return fmt.Errorf("invalid input: provide a 40-char info hash or magnet URI")
}
}
if len(infoHash) < 40 {
return fmt.Errorf("invalid info hash: expected 40 characters, got %d", len(infoHash))
}
outputDir := cfg.Download.Dir
if outputDir == "" {