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:
parent
197e33956a
commit
719429b06e
22 changed files with 973 additions and 119 deletions
53
internal/cmd/reload_unix.go
Normal file
53
internal/cmd/reload_unix.go
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
//go:build !windows
|
||||
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"log"
|
||||
"os"
|
||||
"os/signal"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/torrentclaw/torrentclaw-cli/internal/agent"
|
||||
"github.com/torrentclaw/torrentclaw-cli/internal/config"
|
||||
)
|
||||
|
||||
// ReloadableConfig holds a reference to the daemon for hot-reload.
|
||||
type ReloadableConfig struct {
|
||||
Daemon *agent.Daemon
|
||||
}
|
||||
|
||||
// startReloadWatcher listens for SIGUSR1 and reloads config.
|
||||
// Only intervals are hot-reloadable (speeds require torrent client restart).
|
||||
func startReloadWatcher(rc *ReloadableConfig) {
|
||||
sigCh := make(chan os.Signal, 1)
|
||||
signal.Notify(sigCh, syscall.SIGUSR1)
|
||||
|
||||
go func() {
|
||||
for range sigCh {
|
||||
log.Println("Received SIGUSR1, reloading config...")
|
||||
|
||||
cfg, err := config.Load("")
|
||||
if err != nil {
|
||||
log.Printf("Config reload failed: %v", err)
|
||||
continue
|
||||
}
|
||||
cfg.ApplyEnvOverrides()
|
||||
|
||||
// Update poll interval
|
||||
if d, _ := time.ParseDuration(cfg.Daemon.PollInterval); d > 0 && rc.Daemon.PollTicker != nil {
|
||||
rc.Daemon.PollTicker.Reset(d)
|
||||
log.Printf(" Poll interval: %s", d)
|
||||
}
|
||||
|
||||
// Update heartbeat interval
|
||||
if d, _ := time.ParseDuration(cfg.Daemon.HeartbeatInterval); d > 0 && rc.Daemon.HeartbeatTicker != nil {
|
||||
rc.Daemon.HeartbeatTicker.Reset(d)
|
||||
log.Printf(" Heartbeat interval: %s", d)
|
||||
}
|
||||
|
||||
log.Println("Config reloaded successfully")
|
||||
}
|
||||
}()
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue