// Command hc is Housecarl's command line client: it will manage the // firewall through housecarld's API, as jarl and steward do for theirs. // For now it only knows its version. package main import ( "fmt" "os" "github.com/spf13/cobra" "housecarl/internal/version" ) func main() { if err := rootCmd().Execute(); err != nil { fmt.Fprintln(os.Stderr, "error:", err) os.Exit(1) } } func rootCmd() *cobra.Command { root := &cobra.Command{ Use: "hc", Short: "Manage a Housecarl firewall", Long: `hc will manage a Housecarl firewall through housecarld's API: its zones, address sets, rules and port forwards. It doesn't yet: Housecarl is at its start (docs/design.md).`, SilenceUsage: true, SilenceErrors: true, Version: version.String(), } root.AddCommand(versionCmd()) return root } func versionCmd() *cobra.Command { return &cobra.Command{ Use: "version", Short: "Print the version", Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { fmt.Println("hc", version.String()) }, } }