Skip to content
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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/harbor/root/labels/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func CreateLabelCommand() *cobra.Command {
Short: "create label",
Long: "create label in harbor",
Example: "harbor label create",
Args: cobra.NoArgs,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not needed.

Args: cobra.ExactArgs(0),
Run: func(cmd *cobra.Command, args []string) {
var err error
createView := &create.CreateView{
Expand Down
1 change: 1 addition & 0 deletions cmd/harbor/root/labels/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ func ListLabelCommand() *cobra.Command {
cmd := &cobra.Command{
Use: "list",
Short: "list labels",
Args: cobra.ExactArgs(0),
Run: func(cmd *cobra.Command, args []string) {
label, err := api.ListLabel(opts)
if err != nil {
Expand Down
1 change: 1 addition & 0 deletions cmd/harbor/root/project/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ func ListProjectCommand() *cobra.Command {
cmd := &cobra.Command{
Use: "list",
Short: "list project",
Args: cobra.ExactArgs(0),
bupd marked this conversation as resolved.
Show resolved Hide resolved
Run: func(cmd *cobra.Command, args []string) {
if private && public {
log.Fatal("Cannot specify both --private and --public flags")
Expand Down
2 changes: 1 addition & 1 deletion cmd/harbor/root/registry/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func CreateRegistryCommand() *cobra.Command {
Use: "create",
Short: "create registry",
Example: "harbor registry create",
Args: cobra.NoArgs,
Args: cobra.ExactArgs(0),
Run: func(cmd *cobra.Command, args []string) {
var err error
createView := &api.CreateRegView{
Expand Down
1 change: 1 addition & 0 deletions cmd/harbor/root/registry/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ func ListRegistryCommand() *cobra.Command {
cmd := &cobra.Command{
Use: "list",
Short: "list registry",
Args: cobra.ExactArgs(0),
Run: func(cmd *cobra.Command, args []string) {
registry, err := api.ListRegistries(opts)

Expand Down
2 changes: 1 addition & 1 deletion cmd/harbor/root/user/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func UserCreateCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "create",
Short: "create user",
Args: cobra.NoArgs,
Args: cobra.ExactArgs(0),
Run: func(cmd *cobra.Command, args []string) {
var err error
createView := &create.CreateView{
Expand Down
2 changes: 1 addition & 1 deletion cmd/harbor/root/user/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func UserListCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "list",
Short: "list users",
Args: cobra.NoArgs,
Args: cobra.ExactArgs(0),
Aliases: []string{"ls"},
Run: func(cmd *cobra.Command, args []string) {
response, err := api.ListUsers(opts)
Expand Down
Loading