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

DXCDT-286: Hide global flags from commands when not applicable #536

Merged
merged 1 commit into from
Dec 1, 2022
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
10 changes: 10 additions & 0 deletions internal/cli/actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,11 @@ auth0 actions delete <id>`,
},
}

cmd.SetHelpFunc(func(cmd *cobra.Command, args []string) {
_ = cmd.Flags().MarkHidden("json")
cmd.Parent().HelpFunc()(cmd, args)
})

cmd.Flags().BoolVar(&cli.force, "force", false, "Skip confirmation.")

return cmd
Expand Down Expand Up @@ -481,6 +486,11 @@ func openActionCmd(cli *cli) *cobra.Command {
},
}

cmd.SetHelpFunc(func(cmd *cobra.Command, args []string) {
_ = cmd.Flags().MarkHidden("json")
cmd.Parent().HelpFunc()(cmd, args)
})

return cmd
}

Expand Down
10 changes: 10 additions & 0 deletions internal/cli/apis.go
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,11 @@ auth0 apis delete <id|audience>`,
},
}

cmd.SetHelpFunc(func(cmd *cobra.Command, args []string) {
_ = cmd.Flags().MarkHidden("json")
cmd.Parent().HelpFunc()(cmd, args)
})

cmd.Flags().BoolVar(&cli.force, "force", false, "Skip confirmation.")

return cmd
Expand Down Expand Up @@ -452,6 +457,11 @@ auth0 apis open <id|audience>`,
},
}

cmd.SetHelpFunc(func(cmd *cobra.Command, args []string) {
_ = cmd.Flags().MarkHidden("json")
cmd.Parent().HelpFunc()(cmd, args)
})

return cmd
}

Expand Down
16 changes: 16 additions & 0 deletions internal/cli/apps.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,13 @@ func useAppCmd(cli *cli) *cobra.Command {
},
}

cmd.SetHelpFunc(func(cmd *cobra.Command, args []string) {
_ = cmd.Flags().MarkHidden("json")
cmd.Parent().HelpFunc()(cmd, args)
})

appNone.RegisterBool(cmd, &inputs.None, false)

return cmd
}

Expand Down Expand Up @@ -324,6 +330,11 @@ auth0 apps delete <id>`,
},
}

cmd.SetHelpFunc(func(cmd *cobra.Command, args []string) {
_ = cmd.Flags().MarkHidden("json")
cmd.Parent().HelpFunc()(cmd, args)
})

cmd.Flags().BoolVar(&cli.force, "force", false, "Skip confirmation.")

return cmd
Expand Down Expand Up @@ -705,6 +716,11 @@ func openAppCmd(cli *cli) *cobra.Command {
},
}

cmd.SetHelpFunc(func(cmd *cobra.Command, args []string) {
_ = cmd.Flags().MarkHidden("json")
cmd.Parent().HelpFunc()(cmd, args)
})

return cmd
}

Expand Down
5 changes: 5 additions & 0 deletions internal/cli/custom_domains.go
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,11 @@ auth0 branding domains delete <id>`,
},
}

cmd.SetHelpFunc(func(cmd *cobra.Command, args []string) {
_ = cmd.Flags().MarkHidden("json")
cmd.Parent().HelpFunc()(cmd, args)
})

cmd.Flags().BoolVar(&cli.force, "force", false, "Skip confirmation.")

return cmd
Expand Down
10 changes: 10 additions & 0 deletions internal/cli/log_streams.go
Original file line number Diff line number Diff line change
Expand Up @@ -733,6 +733,11 @@ auth0 logs streams delete <id>`,
},
}

cmd.SetHelpFunc(func(cmd *cobra.Command, args []string) {
_ = cmd.Flags().MarkHidden("json")
cmd.Parent().HelpFunc()(cmd, args)
})

cmd.Flags().BoolVar(&cli.force, "force", false, "Skip confirmation.")

return cmd
Expand Down Expand Up @@ -764,6 +769,11 @@ func openLogStreamsCmd(cli *cli) *cobra.Command {
},
}

cmd.SetHelpFunc(func(cmd *cobra.Command, args []string) {
_ = cmd.Flags().MarkHidden("json")
cmd.Parent().HelpFunc()(cmd, args)
})

return cmd
}

Expand Down
1 change: 1 addition & 0 deletions internal/cli/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ func loginCmd(cli *cli) *cobra.Command {

cmd.SetHelpFunc(func(cmd *cobra.Command, args []string) {
_ = cmd.Flags().MarkHidden("tenant")
_ = cmd.Flags().MarkHidden("json")
cmd.Parent().HelpFunc()(cmd, args)
})

Expand Down
6 changes: 6 additions & 0 deletions internal/cli/logout.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,11 @@ func logoutCmd(cli *cli) *cobra.Command {
},
}

cmd.SetHelpFunc(func(cmd *cobra.Command, args []string) {
_ = cmd.Flags().MarkHidden("tenant")
_ = cmd.Flags().MarkHidden("json")
cmd.Parent().HelpFunc()(cmd, args)
})

return cmd
}
10 changes: 10 additions & 0 deletions internal/cli/organizations.go
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,11 @@ auth0 orgs delete <id>`,
},
}

cmd.SetHelpFunc(func(cmd *cobra.Command, args []string) {
_ = cmd.Flags().MarkHidden("json")
cmd.Parent().HelpFunc()(cmd, args)
})

cmd.Flags().BoolVar(&cli.force, "force", false, "Skip confirmation.")

return cmd
Expand Down Expand Up @@ -460,6 +465,11 @@ func openOrganizationCmd(cli *cli) *cobra.Command {
},
}

cmd.SetHelpFunc(func(cmd *cobra.Command, args []string) {
_ = cmd.Flags().MarkHidden("json")
cmd.Parent().HelpFunc()(cmd, args)
})

return cmd
}

Expand Down
5 changes: 5 additions & 0 deletions internal/cli/roles.go
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,11 @@ auth0 roles delete <id>`,
},
}

cmd.SetHelpFunc(func(cmd *cobra.Command, args []string) {
_ = cmd.Flags().MarkHidden("json")
cmd.Parent().HelpFunc()(cmd, args)
})

cmd.Flags().BoolVar(&cli.force, "force", false, "Skip confirmation.")

return cmd
Expand Down
5 changes: 5 additions & 0 deletions internal/cli/rules.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,11 @@ auth0 rules delete <id>`,
},
}

cmd.SetHelpFunc(func(cmd *cobra.Command, args []string) {
_ = cmd.Flags().MarkHidden("json")
cmd.Parent().HelpFunc()(cmd, args)
})

cmd.Flags().BoolVar(&cli.force, "force", false, "Skip confirmation.")

return cmd
Expand Down
10 changes: 10 additions & 0 deletions internal/cli/tenants.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,11 @@ func useTenantCmd(cli *cli) *cobra.Command {
},
}

cmd.SetHelpFunc(func(cmd *cobra.Command, args []string) {
_ = cmd.Flags().MarkHidden("json")
cmd.Parent().HelpFunc()(cmd, args)
})

return cmd
}

Expand Down Expand Up @@ -148,6 +153,11 @@ func openTenantCmd(cli *cli) *cobra.Command {
},
}

cmd.SetHelpFunc(func(cmd *cobra.Command, args []string) {
_ = cmd.Flags().MarkHidden("json")
cmd.Parent().HelpFunc()(cmd, args)
})

return cmd
}

Expand Down
15 changes: 15 additions & 0 deletions internal/cli/users.go
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,11 @@ auth0 users delete <id>`,
},
}

cmd.SetHelpFunc(func(cmd *cobra.Command, args []string) {
_ = cmd.Flags().MarkHidden("json")
cmd.Parent().HelpFunc()(cmd, args)
})

cmd.Flags().BoolVar(&cli.force, "force", false, "Skip confirmation.")

return cmd
Expand Down Expand Up @@ -483,6 +488,11 @@ auth0 users open "auth0|xxxxxxxxxx"`,
},
}

cmd.SetHelpFunc(func(cmd *cobra.Command, args []string) {
_ = cmd.Flags().MarkHidden("json")
cmd.Parent().HelpFunc()(cmd, args)
})

return cmd
}

Expand Down Expand Up @@ -570,6 +580,11 @@ func deleteUserBlocksCmd(cli *cli) *cobra.Command {
},
}

cmd.SetHelpFunc(func(cmd *cobra.Command, args []string) {
_ = cmd.Flags().MarkHidden("json")
cmd.Parent().HelpFunc()(cmd, args)
})

return cmd
}

Expand Down