feat: Implement CLI framework with Cobra

- Add root command with Cobra framework
- Implement shell completion support for bash/zsh/fish/powershell
- Add version command
- Add configuration initialization on startup via PersistentPreRunE
- Include verbose (-v/-vv) and debug flags
- Set up proper error handling and exit codes

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
swanadiva
2026-06-22 16:21:43 +07:00
parent 8ea4b6e990
commit 2bb9d18f57
3 changed files with 157 additions and 6 deletions
+3 -6
View File
@@ -11,11 +11,8 @@ var (
)
func main() {
if len(os.Args) > 1 && os.Args[1] == "--version" {
fmt.Printf("hostkeeper %s (built: %s)\n", version, buildTime)
return
if err := Execute(); err != nil {
fmt.Fprintf(os.Stderr, "Error: %v\n", err)
os.Exit(1)
}
fmt.Println("HostKeeper - SSH/SFTP Management Tool")
fmt.Println("Run 'hostkeeper --help' for usage.")
}