Skip to content

Commit

Permalink
style(cli): remove some short flags from CLI commands
Browse files Browse the repository at this point in the history
Short flags are nice for convenience, but once we add them it is almost
impossible to remove them. I think if we start with fewer short flags it
will be easier to add them in the future.

The risk of adding them all now is that we won't be able to use them for
other CLI flags in the future, and the short flag for one command may
be different from the short for a different command. For example the -f
for logout is much different than the -f for server or connector.

BREAKING CHANGE: some CLI short flags were removed.
  • Loading branch information
dnephin committed Mar 23, 2022
1 parent bbc0247 commit 4f1ef00
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions internal/cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ func newLogoutCmd() *cobra.Command {
},
}

cmd.Flags().BoolVarP(&force, "force", "f", false, "logout and remove context")
cmd.Flags().BoolVar(&force, "force", false, "logout and remove context")

return cmd
}
Expand Down Expand Up @@ -431,7 +431,7 @@ func newServerCmd() *cobra.Command {
cmd.Flags().Bool("enable-crash-reporting", true, "Enable crash reporting")
cmd.Flags().Bool("enable-ui", false, "Enable Infra server UI")
cmd.Flags().String("ui-proxy-url", "", "Proxy upstream UI requests to this url")
cmd.Flags().DurationP("session-duration", "d", time.Hour*12, "User session duration")
cmd.Flags().Duration("session-duration", time.Hour*12, "User session duration")
cmd.Flags().Bool("enable-setup", true, "Enable one-time setup")

return cmd
Expand Down Expand Up @@ -611,8 +611,8 @@ func NewRootCmd() (*cobra.Command, error) {
rootCmd.AddCommand(newConnectorCmd())
rootCmd.AddCommand(newVersionCmd())

rootCmd.Flags().BoolP("version", "v", false, "Display Infra version")
rootCmd.Flags().BoolP("info", "i", false, "Display info about the current logged in session")
rootCmd.Flags().Bool("version", false, "Display Infra version")
rootCmd.Flags().Bool("info", false, "Display info about the current logged in session")

rootCmd.PersistentFlags().String("log-level", "info", "Show logs when running the command [error, warn, info, debug]")
rootCmd.PersistentFlags().Bool("non-interactive", false, "Disable all prompts for input")
Expand Down
4 changes: 2 additions & 2 deletions internal/cmd/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ infra keys create main wall-e 12h --extension-deadline=1h
},
}

cmd.Flags().StringP("ttl", "t", "", "The total time that an access key will be valid for")
cmd.Flags().StringP("extension-deadline", "e", "", "A specified deadline that an access key must be used within to remain valid")
cmd.Flags().String("ttl", "", "The total time that an access key will be valid for")
cmd.Flags().String("extension-deadline", "", "A specified deadline that an access key must be used within to remain valid")

return cmd
}
Expand Down

0 comments on commit 4f1ef00

Please sign in to comment.