func NewListCommand(client *getch.Client) cli.Command { return cli.Command{ Name: "list", Usage: "List all values stored in Getch for the host where this command is executed from", Action: func(c *cli.Context) { //in Getch a List is a a normal Get request with the keyword 'list' key := "list" value := client.Get(key) fmt.Print(value) }, } }
func NewGetCommand(client *getch.Client) cli.Command { return cli.Command{ Name: "get", Usage: "retrieve a value for a given key", Action: func(c *cli.Context) { if len(c.Args()) == 0 { panic("get command requires a key to be queried") } key := c.Args()[0] value := client.Get(key) fmt.Print(value) }, } }