github.com/taubyte/tau-cli@v0.1.13-0.20240326000942-487f0d57edfc/prompts/internal/service.go (about) 1 package main 2 3 import ( 4 "github.com/pterm/pterm" 5 "github.com/taubyte/tau-cli/prompts" 6 "github.com/urfave/cli/v2" 7 ) 8 9 var ServiceCommand = &cli.Command{ 10 Name: "service", 11 Flags: []cli.Flag{ 12 &cli.StringFlag{ 13 Name: "service", 14 }, 15 }, 16 Action: func(ctx *cli.Context) error { 17 var ( 18 flag = "service" 19 prompt = "Select a Service:" 20 ) 21 22 // New 23 service, err := prompts.SelectAServiceWithProtocol(ctx, flag, prompt) 24 if err != nil { 25 return err 26 } 27 28 // Edit, sending empty cli context so that the flags are not set 29 service, err = prompts.SelectAServiceWithProtocol(&cli.Context{}, flag, prompt, service) 30 if err != nil { 31 return err 32 } 33 34 pterm.Success.Printfln("Got services: `%v`", service) 35 return nil 36 }, 37 }