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
2026-03-28 21:36:27 +01:00
|
|
|
//go:build windows
|
|
|
|
|
|
|
|
|
|
package cmd
|
|
|
|
|
|
2026-04-10 19:18:13 +02:00
|
|
|
import (
|
|
|
|
|
"fmt"
|
|
|
|
|
"os"
|
|
|
|
|
"os/exec"
|
|
|
|
|
"strconv"
|
|
|
|
|
|
|
|
|
|
"github.com/fatih/color"
|
|
|
|
|
"github.com/torrentclaw/unarr/internal/agent"
|
|
|
|
|
)
|
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
2026-03-28 21:36:27 +01:00
|
|
|
|
|
|
|
|
// ReloadableConfig holds a reference to the daemon for hot-reload.
|
|
|
|
|
type ReloadableConfig struct {
|
|
|
|
|
Daemon *agent.Daemon
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// startReloadWatcher is a no-op on Windows (no SIGUSR1 support).
|
|
|
|
|
func startReloadWatcher(_ *ReloadableConfig) {}
|
2026-04-10 19:18:13 +02:00
|
|
|
|
|
|
|
|
// sendReloadSignal is not supported on Windows; instructs the user to restart instead.
|
|
|
|
|
func sendReloadSignal() error {
|
|
|
|
|
fmt.Println()
|
|
|
|
|
color.New(color.FgYellow).Println(" ⚠ Config reload via signal is not supported on Windows.")
|
|
|
|
|
fmt.Println(" Use 'unarr daemon restart' to apply configuration changes.")
|
|
|
|
|
fmt.Println()
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// killPID stops the daemon process on Windows using taskkill.
|
|
|
|
|
func killPID(pid int) error {
|
|
|
|
|
cmd := exec.Command("taskkill", "/pid", strconv.Itoa(pid), "/f")
|
|
|
|
|
cmd.Stdout = os.Stdout
|
|
|
|
|
cmd.Stderr = os.Stderr
|
|
|
|
|
if err := cmd.Run(); err != nil {
|
|
|
|
|
return fmt.Errorf("stop daemon (PID %d): %w", pid, err)
|
|
|
|
|
}
|
|
|
|
|
color.New(color.FgGreen).Printf(" ✓ Daemon stopped (PID %d)\n", pid)
|
|
|
|
|
fmt.Println()
|
|
|
|
|
return nil
|
|
|
|
|
}
|