-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
enforce exact argument count for cmds #302
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Rizul Gupta <mail2rizul@gmail.com>
@bupd can you please review this PR |
Signed-off-by: Rizul Gupta <mail2rizul@gmail.com>
@bupd can you please see if this is what was required for the issue |
@Vad1mo is anything else also required ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your contribtions
I left few changes to need to be made.
Also verify the working of all commands.
@@ -15,7 +15,7 @@ func CreateLabelCommand() *cobra.Command { | |||
Short: "create label", | |||
Long: "create label in harbor", | |||
Example: "harbor label create", | |||
Args: cobra.NoArgs, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not needed.
@@ -15,6 +15,7 @@ func ListLabelCommand() *cobra.Command { | |||
cmd := &cobra.Command{ | |||
Use: "list", | |||
Short: "list labels", | |||
Args: cobra.ExactArgs(0), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please do cobra.NoArgs
Args: cobra.ExactArgs(0), | |
Args: cobra.NoArgs, |
to maintain consistency
Signed-off-by: Rizul Gupta <mail2rizul@gmail.com>
This PR fixes issue #293 by giving the below error
This PR reviewed all commands where the No. of arguments were not specified and addresses that and also replaced cobra.NoArgs with cobra.ExactArgs(0) as later gives more defined error.
It also fixes one more issue that was in project create command when no name for project was gien it gave below error
so fixes that to give below error