Exemple #1
0
func listServices(c *cli.Context) {
	rsp, err := command.ListServices(c)
	if err != nil {
		fmt.Println(err)
		return
	}
	fmt.Println(string(rsp))
}
Exemple #2
0
// List returns a list of services
func List(ctx *cli.Context) Command {
	usage := "list services"
	desc := "Returns a list of registered services"

	return NewCommand("list", usage, desc, func(args ...string) ([]byte, error) {
		if len(args) < 2 {
			return []byte("list what?"), nil
		}
		switch args[1] {
		case "services":
			rsp, err := command.ListServices(ctx)
			if err != nil {
				return nil, err
			}
			return rsp, nil
		default:
			return []byte("unknown command...\nsupported commands: \nlist services"), nil
		}
	})
}