func getService(c *cli.Context) { rsp, err := command.GetService(c, c.Args()) if err != nil { fmt.Println(err) return } fmt.Println(string(rsp)) }
// Get service returns a service func Get(ctx *cli.Context) Command { usage := "get service [name]" desc := "Returns a registered service" return NewCommand("get", usage, desc, func(args ...string) ([]byte, error) { if len(args) < 2 { return []byte("get what?"), nil } switch args[1] { case "service": if len(args) < 3 { return []byte("require service name"), nil } rsp, err := command.GetService(ctx, args[2:]) if err != nil { return nil, err } return rsp, nil default: return []byte("unknown command...\nsupported commands: \nget service [name]"), nil } }) }