// Command housecarld is Housecarl's daemon: it will keep the firewall's // nftables ruleset, and serve its REST API and web UI (docs/design.md). // 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: "housecarld", Short: "Housecarl's firewall daemon, API and web UI", Long: `housecarld will keep a Linux firewall's nftables ruleset, built from its database, and serve the REST API and web UI that change it. 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("housecarld", version.String()) }, } }