fix: server/record improved output + interactivity
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2021-10-25 09:02:24 +02:00
parent 2d091a6b00
commit a7970132c2
7 changed files with 68 additions and 39 deletions

View File

@ -88,14 +88,24 @@ func ValidateApp(c *cli.Context) config.App {
}
// ValidateDomain ensures the domain name arg is valid.
func ValidateDomain(c *cli.Context) string {
func ValidateDomain(c *cli.Context) (string, error) {
domainName := c.Args().First()
if domainName == "" && !NoInput {
prompt := &survey.Input{
Message: "Specify a domain name",
Default: "example.com",
}
if err := survey.AskOne(prompt, &domainName); err != nil {
return domainName, err
}
}
if domainName == "" {
ShowSubcommandHelpAndError(c, errors.New("no domain provided"))
}
logrus.Debugf("validated '%s' as domain argument", domainName)
return domainName
return domainName, nil
}