forked from toolshed/abra
fix: server/record improved output + interactivity
This commit is contained in:
@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user