fix: parse args correctly for validation
continuous-integration/drone/push Build is passing Details

This commit is contained in:
decentral1se 2021-10-18 09:43:32 +02:00
parent 9526d1fde6
commit 9dfbd21c61
No known key found for this signature in database
GPG Key ID: 5E2EF5A63E3718CC
1 changed files with 3 additions and 2 deletions

View File

@ -54,12 +54,13 @@ All communication between Abra and the server will use this SSH connection.
},
ArgsUsage: "<domain> [<user>] [<port>]",
Action: func(c *cli.Context) error {
if c.Args().Len() == 1 && !local {
if c.Args().Len() == 2 && !local {
err := errors.New("missing arguments <domain> or '--local'")
internal.ShowSubcommandHelpAndError(c, err)
}
if c.Args().Get(1) != "" && local {
if c.Args().Get(2) != "" && local {
err := errors.New("cannot use '<domain>' and '--local' together")
internal.ShowSubcommandHelpAndError(c, err)
}