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

feat: disallow extra arguments on sub-commands #48

Merged
1 commit merged into from
Apr 13, 2020
Merged
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 cli/cmd/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func init() {
)
}

func runApiCommand(cmd *cobra.Command, args []string) error {
func runApiCommand(_ *cobra.Command, args []string) error {
switch args[0] {
case "post", "patch":
if apiData == "" {
Expand Down
3 changes: 2 additions & 1 deletion cli/cmd/configure.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ var (
configureCmd = &cobra.Command{
Use: "configure",
Short: "Set up your Lacework cli",
RunE: func(cmd *cobra.Command, args []string) error {
Args: cobra.NoArgs,
RunE: func(_ *cobra.Command, _ []string) error {
var (
promptAccount = promptui.Prompt{
Label: "Account",
Expand Down
12 changes: 8 additions & 4 deletions cli/cmd/integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ var (
integrationListCmd = &cobra.Command{
Use: "list",
Short: "List all available external integrations",
RunE: func(cmd *cobra.Command, args []string) error {
Args: cobra.NoArgs,
RunE: func(_ *cobra.Command, _ []string) error {
lacework, err := api.NewClient(cli.Account,
api.WithLogLevel(cli.LogLevel),
api.WithApiKeys(cli.KeyID, cli.Secret),
Expand All @@ -62,7 +63,8 @@ var (
Use: "create",
Hidden: true,
Short: "Create an external integrations",
RunE: func(cmd *cobra.Command, args []string) error {
Args: cobra.NoArgs,
RunE: func(_ *cobra.Command, _ []string) error {
return nil
},
}
Expand All @@ -72,7 +74,8 @@ var (
Use: "update",
Hidden: true,
Short: "Update an external integrations",
RunE: func(cmd *cobra.Command, args []string) error {
Args: cobra.NoArgs,
RunE: func(_ *cobra.Command, _ []string) error {
return nil
},
}
Expand All @@ -82,7 +85,8 @@ var (
Use: "delete",
Hidden: true,
Short: "Delete an external integrations",
RunE: func(cmd *cobra.Command, args []string) error {
Args: cobra.NoArgs,
RunE: func(_ *cobra.Command, _ []string) error {
return nil
},
}
Expand Down
3 changes: 2 additions & 1 deletion cli/cmd/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ var (
versionCmd = &cobra.Command{
Use: "version",
Short: "Print the Lacework cli version",
Run: func(cmd *cobra.Command, args []string) {
Args: cobra.NoArgs,
Run: func(_ *cobra.Command, _ []string) {
fmt.Printf("lacework v%s (sha:%s) (time:%s)\n", Version, GitSHA, BuildTime)
},
}
Expand Down