refactor: name to match logic

This commit is contained in:
decentral1se 2021-10-25 09:02:13 +02:00
parent 147687d7ce
commit 2d091a6b00
No known key found for this signature in database
GPG Key ID: 5E2EF5A63E3718CC
1 changed files with 20 additions and 0 deletions

View File

@ -84,3 +84,23 @@ func EnsureDNSValueFlag(c *cli.Context) error {
return nil
}
// EnsureZoneArgument ensures a zone argument is present.
func EnsureZoneArgument(c *cli.Context) (string, error) {
var zone string
if c.Args().First() == "" && !NoInput {
prompt := &survey.Input{
Message: "Specify a domain name zone",
Default: "example.com",
}
if err := survey.AskOne(prompt, &zone); err != nil {
return zone, err
}
}
if zone == "" {
ShowSubcommandHelpAndError(c, errors.New("no zone value provided"))
}
return zone, nil
}