'zrok agent' -> 'zrok agent start' (#463)

This commit is contained in:
Michael Quigley
2024-08-23 12:12:57 -04:00
parent 95098e6357
commit 3c310c27db
2 changed files with 13 additions and 6 deletions

View File

@ -8,25 +8,25 @@ import (
) )
func init() { func init() {
rootCmd.AddCommand(newAgentCommand().cmd) agentCmd.AddCommand(newAgentStartCommand().cmd)
} }
type agentCommand struct { type agentStartCommand struct {
cmd *cobra.Command cmd *cobra.Command
} }
func newAgentCommand() *agentCommand { func newAgentStartCommand() *agentStartCommand {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "agent", Use: "start",
Short: "Launch a zrok agent", Short: "Launch a zrok agent",
Args: cobra.NoArgs, Args: cobra.NoArgs,
} }
command := &agentCommand{cmd: cmd} command := &agentStartCommand{cmd: cmd}
cmd.Run = command.run cmd.Run = command.run
return command return command
} }
func (cmd *agentCommand) run(_ *cobra.Command, _ []string) { func (cmd *agentStartCommand) run(_ *cobra.Command, _ []string) {
root, err := environment.LoadRoot() root, err := environment.LoadRoot()
if err != nil { if err != nil {
tui.Error("error loading zrokdir", err) tui.Error("error loading zrokdir", err)

View File

@ -23,6 +23,7 @@ func init() {
adminCmd.AddCommand(adminDeleteCmd) adminCmd.AddCommand(adminDeleteCmd)
adminCmd.AddCommand(adminListCmd) adminCmd.AddCommand(adminListCmd)
adminCmd.AddCommand(adminUpdateCmd) adminCmd.AddCommand(adminUpdateCmd)
rootCmd.AddCommand(agentCmd)
testCmd.AddCommand(loopCmd) testCmd.AddCommand(loopCmd)
rootCmd.AddCommand(adminCmd) rootCmd.AddCommand(adminCmd)
rootCmd.AddCommand(configCmd) rootCmd.AddCommand(configCmd)
@ -75,6 +76,12 @@ var adminUpdateCmd = &cobra.Command{
Short: "Update global resources", Short: "Update global resources",
} }
var agentCmd = &cobra.Command{
Use: "agent",
Short: "zrok Agent commands",
Aliases: []string{"daemon"},
}
var configCmd = &cobra.Command{ var configCmd = &cobra.Command{
Use: "config", Use: "config",
Short: "Configure your zrok environment", Short: "Configure your zrok environment",