github.com/taubyte/tau-cli@v0.1.13-0.20240326000942-487f0d57edfc/prompts/internal/domains.go (about)

     1  package main
     2  
     3  import (
     4  	"github.com/pterm/pterm"
     5  	"github.com/taubyte/tau-cli/flags"
     6  	"github.com/taubyte/tau-cli/prompts"
     7  	"github.com/urfave/cli/v2"
     8  )
     9  
    10  var DomainsCommand = &cli.Command{
    11  	Name: "domains",
    12  	Flags: []cli.Flag{
    13  		flags.Domains,
    14  	},
    15  	Action: func(ctx *cli.Context) error {
    16  
    17  		// New
    18  		domains, err := prompts.GetOrSelectDomainsWithFQDN(ctx)
    19  		if err != nil {
    20  			return err
    21  		}
    22  
    23  		// Edit, sending empty cli context so that the flags are not set
    24  		domains, err = prompts.GetOrSelectDomainsWithFQDN(&cli.Context{}, domains...)
    25  		if err != nil {
    26  			return err
    27  		}
    28  
    29  		pterm.Success.Printfln("Got domains: `%v`", domains)
    30  		return nil
    31  	},
    32  }