Skip to content

Commit

Permalink
mr,issue,snippet: make shorthand flags deprecated
Browse files Browse the repository at this point in the history
All commands with --list, --close and --browse flags, also has the actual
subcommand for each of them. I've seen users getting confused because the
flags in the `list` command can't be used with the shorthand, and tbh,
typing `list` is easier than `--list` (the same is valid for the others
flags).

IMHO the shorthand as a whole should be deprecated, avoiding user confusion
and, possibly, dead code for getting maintained.

Signed-off-by: Bruno Meneguele <[email protected]>
  • Loading branch information
bmeneg committed Mar 9, 2021
1 parent 78d76dc commit 8b27899
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cmd/issue.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ var issueCmd = &cobra.Command{

func init() {
issueCmd.Flags().BoolP("list", "l", false, "list issues on a remote")
issueCmd.Flags().MarkDeprecated("list", "use the \"list\" subcommand instead")
issueCmd.Flags().BoolP("browse", "b", false, "view issue <id> in a browser")
issueCmd.Flags().MarkDeprecated("browse", "use the \"browse\" subcommand instead")
issueCmd.Flags().StringP("close", "d", "", "close issue <id> on remote")
issueCmd.Flags().MarkDeprecated("close", "use the \"close\" subcommand instead")
RootCmd.AddCommand(issueCmd)
}
3 changes: 3 additions & 0 deletions cmd/mr.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ var mrCmd = &cobra.Command{

func init() {
mrCmd.Flags().BoolP("list", "l", false, "list merge requests on a remote")
mrCmd.Flags().MarkDeprecated("list", "use the \"list\" subcommand instead")
mrCmd.Flags().BoolP("browse", "b", false, "view merge request <id> in a browser")
mrCmd.Flags().MarkDeprecated("browse", "use the \"browse\" subcommand instead")
mrCmd.Flags().StringP("close", "d", "", "close merge request <id> on remote")
mrCmd.Flags().MarkDeprecated("close", "use the \"close\" subcommand instead")
RootCmd.AddCommand(mrCmd)
}
3 changes: 3 additions & 0 deletions cmd/snippet.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,11 @@ var (
func init() {
snippetCmd.PersistentFlags().BoolVarP(&global, "global", "g", false, "create as a personal snippet")
snippetCmd.Flags().BoolP("list", "l", false, "list snippets")
snippetCmd.Flags().MarkDeprecated("list", "use the \"list\" subcommand instead")
snippetCmd.Flags().BoolP("browse", "b", false, "browse snippets")
snippetCmd.Flags().MarkDeprecated("browse", "use the \"browse\" subcommand instead")
snippetCmd.Flags().StringP("delete", "d", "", "delete snippet with id")
snippetCmd.Flags().MarkDeprecated("delete", "use the \"delete\" subcommand instead")
// Create flags added in snippetCreate.go
RootCmd.AddCommand(snippetCmd)
}

0 comments on commit 8b27899

Please sign in to comment.