Rewrite itctl to use urfave/cli instead of spf13/cobra

This commit is contained in:
2022-02-24 21:26:40 -08:00
parent 9e63401db3
commit a885eacc70
36 changed files with 576 additions and 2333 deletions

24
cmd/itctl/set.go Normal file
View File

@@ -0,0 +1,24 @@
package main
import (
"time"
"github.com/urfave/cli/v2"
)
func setTime(c *cli.Context) error {
// Ensure required arguments
if c.Args().Len() < 1 {
return cli.Exit("Command time requires one argument", 1)
}
if c.Args().Get(0) == "now" {
return client.SetTimeNow()
} else {
parsed, err := time.Parse(time.RFC3339, c.Args().Get(0))
if err != nil {
return err
}
return client.SetTime(parsed)
}
}