fix: error out correctly from ValidateDomain

This commit is contained in:
decentral1se 2022-02-24 15:57:40 +01:00
parent ecbeacf10f
commit 823f869f1d
Signed by: decentral1se
GPG Key ID: 03789458B3D0C410
2 changed files with 5 additions and 8 deletions

View File

@ -148,7 +148,7 @@ func ValidateApp(c *cli.Context) config.App {
}
// ValidateDomain ensures the domain name arg is valid.
func ValidateDomain(c *cli.Context) (string, error) {
func ValidateDomain(c *cli.Context) string {
domainName := c.Args().First()
if domainName == "" && !NoInput {
@ -157,7 +157,7 @@ func ValidateDomain(c *cli.Context) (string, error) {
Default: "example.com",
}
if err := survey.AskOne(prompt, &domainName); err != nil {
return domainName, err
logrus.Fatal(err)
}
}
@ -167,7 +167,7 @@ func ValidateDomain(c *cli.Context) (string, error) {
logrus.Debugf("validated %s as domain argument", domainName)
return domainName, nil
return domainName
}
// ValidateSubCmdFlags ensures flag order conforms to correct order

View File

@ -427,6 +427,8 @@ developer machine.
internal.ShowSubcommandHelpAndError(c, err)
}
domainName := internal.ValidateDomain(c)
if local {
if err := newLocalServer(c, "default"); err != nil {
logrus.Fatal(err)
@ -434,11 +436,6 @@ developer machine.
return nil
}
domainName, err := internal.ValidateDomain(c)
if err != nil {
logrus.Fatal(err)
}
username := c.Args().Get(1)
if username == "" {
systemUser, err := user.Current()