- 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
51 lines
1.2 KiB
Go
51 lines
1.2 KiB
Go
package cmd
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/fatih/color"
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
func newStatusCmd() *cobra.Command {
|
|
return &cobra.Command{
|
|
Use: "status",
|
|
Short: "Show daemon status and active downloads",
|
|
Long: `Display the current state of the daemon, active downloads, and recent activity.
|
|
|
|
Shows the configured agent name, download directory, and preferred method.
|
|
When the daemon is running, also displays active downloads and their progress.`,
|
|
Example: ` unarr status`,
|
|
RunE: func(cmd *cobra.Command, args []string) error {
|
|
return runStatus()
|
|
},
|
|
}
|
|
}
|
|
|
|
func runStatus() error {
|
|
bold := color.New(color.Bold)
|
|
dim := color.New(color.FgHiBlack)
|
|
|
|
fmt.Println()
|
|
bold.Printf(" unarr %s\n", Version)
|
|
fmt.Println()
|
|
|
|
cfg := loadConfig()
|
|
|
|
if cfg.Auth.APIKey == "" {
|
|
dim.Println(" Not configured. Run 'unarr setup' first.")
|
|
fmt.Println()
|
|
return nil
|
|
}
|
|
|
|
fmt.Printf(" Agent: %s (%s)\n", cfg.Agent.Name, cfg.Agent.ID[:8]+"...")
|
|
fmt.Printf(" Downloads: %s\n", cfg.Download.Dir)
|
|
fmt.Printf(" Method: %s\n", cfg.Download.PreferredMethod)
|
|
fmt.Println()
|
|
|
|
dim.Println(" Daemon not running. Start with 'unarr start'")
|
|
dim.Println(" (Live status will be shown here when daemon is running)")
|
|
fmt.Println()
|
|
|
|
return nil
|
|
}
|