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

TOOLS-155 silence usage msgs when usage was valid #104

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
1 change: 1 addition & 0 deletions internal/commands/console/console.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ func NewCmdConsole() *cobra.Command {
Long: "Connect to a container in the ECS service via AWS SSM.\nTakes ECS service name as an argument.",
Args: cobra.MinimumNArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
cmd.SilenceUsage = true
err := o.Complete(cmd, args)
if err != nil {
return err
Expand Down
1 change: 1 addition & 0 deletions internal/commands/deploy/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ func NewCmdDeploy() *cobra.Command {
Long: deployLongDesc,
Args: cobra.MaximumNArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
cmd.SilenceUsage = true
if len(args) == 0 && !o.AutoApprove {
pterm.Warning.Println("please set flag --auto-approve")
return nil
Expand Down
1 change: 1 addition & 0 deletions internal/commands/deploy/deploy_infra.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ func NewCmdDeployInfra() *cobra.Command {
Use: "infra",
Short: "manage infra deployments",
RunE: func(cmd *cobra.Command, args []string) error {
cmd.SilenceUsage = true
err := o.Complete(cmd, args)
if err != nil {
return err
Expand Down
1 change: 1 addition & 0 deletions internal/commands/destroy/destroy_infra.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ func NewCmdDestroyInfra() *cobra.Command {
Use: "destroy",
Short: "destroy anything",
RunE: func(cmd *cobra.Command, args []string) error {
cmd.SilenceUsage = true
err := o.Complete(cmd, args)
if err != nil {
return err
Expand Down
1 change: 1 addition & 0 deletions internal/commands/env/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ func NewCmdEnv() *cobra.Command {
Use: "env",
Short: "generate terraform files",
RunE: func(cmd *cobra.Command, args []string) error {
cmd.SilenceUsage = true
err := o.Complete(cmd, args)
if err != nil {
return err
Expand Down
1 change: 1 addition & 0 deletions internal/commands/gendoc.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ func NewGendocCmd() *cobra.Command {
DisableFlagsInUseLine: true,
Long: "Create docs.",
RunE: func(cmd *cobra.Command, args []string) error {
cmd.SilenceUsage = true
root, err := newApp()
if err != nil {
return err
Expand Down
1 change: 1 addition & 0 deletions internal/commands/initialize/initialize.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ func NewCmdInit() *cobra.Command {
Use: "init",
Short: "Creates an IZE configuration file.",
RunE: func(cmd *cobra.Command, args []string) error {
cmd.SilenceUsage = true
err := o.Complete(cmd, args)
if err != nil {
return err
Expand Down
1 change: 0 additions & 1 deletion internal/commands/ize.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ func newApp() (*cobra.Command, error) {
pterm.Sprintf("%s %s", pterm.Green("Version:"), Version),
),
TraverseChildren: true,
SilenceUsage: true,
SilenceErrors: true,
}

Expand Down
1 change: 1 addition & 0 deletions internal/commands/mfa/mfa.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ func NewCmdMfa() *cobra.Command {
Use: "mfa",
Short: "generate terraform files",
RunE: func(cmd *cobra.Command, args []string) error {
cmd.SilenceUsage = true
err := o.Complete(cmd, args)
if err != nil {
return err
Expand Down
1 change: 1 addition & 0 deletions internal/commands/secrets/secrets_edit.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ func NewCmdSecretsEdit() *cobra.Command {
Long: "This open secrets file in default editor.",
Args: cobra.MinimumNArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
cmd.SilenceUsage = true

err := o.Complete(cmd, args)
if err != nil {
Expand Down
1 change: 1 addition & 0 deletions internal/commands/secrets/secrets_push.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ func NewCmdSecretsPush() *cobra.Command {
Long: "This command pushes secrets from a local file to a key-value storage (like SSM).",
Args: cobra.MinimumNArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
cmd.SilenceUsage = true

err := o.Complete(cmd, args)
if err != nil {
Expand Down
1 change: 1 addition & 0 deletions internal/commands/secrets/secrets_rm.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ func NewCmdSecretsRemove() *cobra.Command {
Long: "This command removes secrets from storage",
TraverseChildren: true,
RunE: func(cmd *cobra.Command, args []string) error {
cmd.SilenceUsage = true
err := o.Complete(cmd, args)
if err != nil {
return err
Expand Down
1 change: 1 addition & 0 deletions internal/commands/terraform/terraform.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ func NewCmdTerraform() *cobra.Command {
DisableFlagParsing: true,
DisableFlagsInUseLine: true,
RunE: func(cmd *cobra.Command, args []string) error {
cmd.SilenceUsage = true
err := o.Complete(cmd, args)
if err != nil {
return err
Expand Down
1 change: 1 addition & 0 deletions internal/commands/tunnel/tunnel.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ func (o *TunnelOptions) Validate() error {
}

func (o *TunnelOptions) Run(cmd *cobra.Command) error {
cmd.SilenceUsage = true
c := exec.Command(
"ssh", "-S", "bastion.sock", "-O", "check", "",
)
Expand Down
1 change: 1 addition & 0 deletions internal/commands/tunnel/tunnel_down.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ func NewCmdTunnelDown() *cobra.Command {
Short: "close tunnel",
Long: "Close tunnel.",
RunE: func(cmd *cobra.Command, args []string) error {
cmd.SilenceUsage = true
c := exec.Command(
"ssh", "-S", "bastion.sock", "-O", "exit", "",
)
Expand Down
1 change: 1 addition & 0 deletions internal/commands/tunnel/tunnel_sshkey.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ func NewCmdSSHKey() *cobra.Command {
Short: "send ssh key to remote server",
Long: "Send ssh key to remote server.",
RunE: func(cmd *cobra.Command, args []string) error {
cmd.SilenceUsage = true
err := o.Complete(cmd, args)
if err != nil {
return err
Expand Down
1 change: 1 addition & 0 deletions internal/commands/tunnel/tunnel_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ func NewCmdTunnelStatus() *cobra.Command {
Short: "status tunnel",
Long: "Status tunnel.",
RunE: func(cmd *cobra.Command, args []string) error {
cmd.SilenceUsage = true
err := o.Complete(cmd, args)
if err != nil {
return err
Expand Down
1 change: 1 addition & 0 deletions internal/commands/tunnel/tunnel_up.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ func (o *TunnelUpOptions) Validate() error {
}

func (o *TunnelUpOptions) Run(cmd *cobra.Command) error {
cmd.SilenceUsage = true
c := exec.Command(
"ssh", "-S", "bastion.sock", "-O", "check", "",
)
Expand Down