diff options
author | Michael Muré <batolettre@gmail.com> | 2020-07-28 20:24:24 +0200 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2020-07-28 20:24:24 +0200 |
commit | ae5c0967cec40a7dcf9804ff592a4d15f1b26569 (patch) | |
tree | 7c1ba7626fd8158be030876d44ba55daf465d694 /commands | |
parent | 51c887ff9dd4f2a5f65d2d3de57f8a7729b1010d (diff) | |
download | git-bug-ae5c0967cec40a7dcf9804ff592a4d15f1b26569.tar.gz |
commands: cleanup the command's usage to avoid warnings when generating the doc
Diffstat (limited to 'commands')
-rw-r--r-- | commands/bridge_auth_addtoken.go | 2 | ||||
-rw-r--r-- | commands/bridge_auth_rm.go | 2 | ||||
-rw-r--r-- | commands/bridge_pull.go | 2 | ||||
-rw-r--r-- | commands/bridge_push.go | 2 | ||||
-rw-r--r-- | commands/bridge_rm.go | 2 | ||||
-rw-r--r-- | commands/commands.go | 2 | ||||
-rw-r--r-- | commands/comment.go | 4 | ||||
-rw-r--r-- | commands/comment_add.go | 4 | ||||
-rw-r--r-- | commands/label.go | 4 | ||||
-rw-r--r-- | commands/label_add.go | 8 | ||||
-rw-r--r-- | commands/label_rm.go | 8 | ||||
-rw-r--r-- | commands/ls-id.go | 2 | ||||
-rw-r--r-- | commands/ls.go | 2 | ||||
-rw-r--r-- | commands/pull.go | 2 | ||||
-rw-r--r-- | commands/push.go | 2 | ||||
-rw-r--r-- | commands/rm.go | 2 | ||||
-rw-r--r-- | commands/select.go | 6 | ||||
-rw-r--r-- | commands/show.go | 12 | ||||
-rw-r--r-- | commands/status.go | 5 | ||||
-rw-r--r-- | commands/status_close.go | 5 | ||||
-rw-r--r-- | commands/status_open.go | 5 | ||||
-rw-r--r-- | commands/title.go | 5 | ||||
-rw-r--r-- | commands/title_edit.go | 4 | ||||
-rw-r--r-- | commands/user.go | 12 | ||||
-rw-r--r-- | commands/user_adopt.go | 2 |
25 files changed, 53 insertions, 53 deletions
diff --git a/commands/bridge_auth_addtoken.go b/commands/bridge_auth_addtoken.go index 55edd919..272eab8c 100644 --- a/commands/bridge_auth_addtoken.go +++ b/commands/bridge_auth_addtoken.go @@ -27,7 +27,7 @@ func newBridgeAuthAddTokenCommand() *cobra.Command { options := bridgeAuthAddTokenOptions{} cmd := &cobra.Command{ - Use: "add-token [<token>]", + Use: "add-token [TOKEN]", Short: "Store a new token", PreRunE: loadBackendEnsureUser(env), PostRunE: closeBackend(env), diff --git a/commands/bridge_auth_rm.go b/commands/bridge_auth_rm.go index b2a44e92..fa73ad11 100644 --- a/commands/bridge_auth_rm.go +++ b/commands/bridge_auth_rm.go @@ -10,7 +10,7 @@ func newBridgeAuthRm() *cobra.Command { env := newEnv() cmd := &cobra.Command{ - Use: "rm <id>", + Use: "rm ID", Short: "Remove a credential.", PreRunE: loadRepo(env), RunE: func(cmd *cobra.Command, args []string) error { diff --git a/commands/bridge_pull.go b/commands/bridge_pull.go index bb705582..95eb2fe0 100644 --- a/commands/bridge_pull.go +++ b/commands/bridge_pull.go @@ -26,7 +26,7 @@ func newBridgePullCommand() *cobra.Command { options := bridgePullOptions{} cmd := &cobra.Command{ - Use: "pull [<name>]", + Use: "pull [NAME]", Short: "Pull updates.", PreRunE: loadBackend(env), PostRunE: closeBackend(env), diff --git a/commands/bridge_push.go b/commands/bridge_push.go index 7061a5ca..64e3ff4b 100644 --- a/commands/bridge_push.go +++ b/commands/bridge_push.go @@ -17,7 +17,7 @@ func newBridgePushCommand() *cobra.Command { env := newEnv() cmd := &cobra.Command{ - Use: "push [<name>]", + Use: "push [NAME]", Short: "Push updates.", PreRunE: loadBackendEnsureUser(env), PostRunE: closeBackend(env), diff --git a/commands/bridge_rm.go b/commands/bridge_rm.go index 9f93c37a..9f5c81c7 100644 --- a/commands/bridge_rm.go +++ b/commands/bridge_rm.go @@ -10,7 +10,7 @@ func newBridgeRm() *cobra.Command { env := newEnv() cmd := &cobra.Command{ - Use: "rm <name>", + Use: "rm NAME", Short: "Delete a configured bridge.", PreRunE: loadBackend(env), PostRunE: closeBackend(env), diff --git a/commands/commands.go b/commands/commands.go index 103d5412..49c960ab 100644 --- a/commands/commands.go +++ b/commands/commands.go @@ -15,7 +15,7 @@ func newCommandsCommand() *cobra.Command { options := commandOptions{} cmd := &cobra.Command{ - Use: "commands [<option>...]", + Use: "commands", Short: "Display available commands.", RunE: func(cmd *cobra.Command, args []string) error { return runCommands(env, options) diff --git a/commands/comment.go b/commands/comment.go index e81405a6..d8995c3e 100644 --- a/commands/comment.go +++ b/commands/comment.go @@ -4,7 +4,7 @@ import ( text "github.com/MichaelMure/go-term-text" "github.com/spf13/cobra" - "github.com/MichaelMure/git-bug/commands/select" + _select "github.com/MichaelMure/git-bug/commands/select" "github.com/MichaelMure/git-bug/util/colors" ) @@ -12,7 +12,7 @@ func newCommentCommand() *cobra.Command { env := newEnv() cmd := &cobra.Command{ - Use: "comment [<id>]", + Use: "comment [ID]", Short: "Display or add comments to a bug.", PreRunE: loadBackend(env), PostRunE: closeBackend(env), diff --git a/commands/comment_add.go b/commands/comment_add.go index 47366d00..6caf4943 100644 --- a/commands/comment_add.go +++ b/commands/comment_add.go @@ -3,7 +3,7 @@ package commands import ( "github.com/spf13/cobra" - "github.com/MichaelMure/git-bug/commands/select" + _select "github.com/MichaelMure/git-bug/commands/select" "github.com/MichaelMure/git-bug/input" ) @@ -17,7 +17,7 @@ func newCommentAddCommand() *cobra.Command { options := commentAddOptions{} cmd := &cobra.Command{ - Use: "add [<id>]", + Use: "add [ID]", Short: "Add a new comment to a bug.", PreRunE: loadBackendEnsureUser(env), PostRunE: closeBackend(env), diff --git a/commands/label.go b/commands/label.go index de7bdb3a..e3ffdb64 100644 --- a/commands/label.go +++ b/commands/label.go @@ -3,14 +3,14 @@ package commands import ( "github.com/spf13/cobra" - "github.com/MichaelMure/git-bug/commands/select" + _select "github.com/MichaelMure/git-bug/commands/select" ) func newLabelCommand() *cobra.Command { env := newEnv() cmd := &cobra.Command{ - Use: "label [<id>]", + Use: "label [ID]", Short: "Display, add or remove labels to/from a bug.", PreRunE: loadBackend(env), PostRunE: closeBackend(env), diff --git a/commands/label_add.go b/commands/label_add.go index 05a27948..ce971f04 100644 --- a/commands/label_add.go +++ b/commands/label_add.go @@ -3,14 +3,14 @@ package commands import ( "github.com/spf13/cobra" - "github.com/MichaelMure/git-bug/commands/select" + _select "github.com/MichaelMure/git-bug/commands/select" ) func newLabelAddCommand() *cobra.Command { env := newEnv() cmd := &cobra.Command{ - Use: "add [<id>] <label>[...]", + Use: "add [ID] LABEL...", Short: "Add a label to a bug.", PreRunE: loadBackendEnsureUser(env), PostRunE: closeBackend(env), @@ -28,7 +28,9 @@ func runLabelAdd(env *Env, args []string) error { return err } - changes, _, err := b.ChangeLabels(args, nil) + added := args + + changes, _, err := b.ChangeLabels(added, nil) for _, change := range changes { env.out.Println(change) diff --git a/commands/label_rm.go b/commands/label_rm.go index 445a56a4..f59ec02d 100644 --- a/commands/label_rm.go +++ b/commands/label_rm.go @@ -3,14 +3,14 @@ package commands import ( "github.com/spf13/cobra" - "github.com/MichaelMure/git-bug/commands/select" + _select "github.com/MichaelMure/git-bug/commands/select" ) func newLabelRmCommand() *cobra.Command { env := newEnv() cmd := &cobra.Command{ - Use: "rm [<id>] <label>[...]", + Use: "rm [ID] LABEL...", Short: "Remove a label from a bug.", PreRunE: loadBackend(env), PostRunE: closeBackend(env), @@ -28,7 +28,9 @@ func runLabelRm(env *Env, args []string) error { return err } - changes, _, err := b.ChangeLabels(nil, args) + removed := args + + changes, _, err := b.ChangeLabels(nil, removed) for _, change := range changes { env.out.Println(change) diff --git a/commands/ls-id.go b/commands/ls-id.go index bed6c057..686f432a 100644 --- a/commands/ls-id.go +++ b/commands/ls-id.go @@ -8,7 +8,7 @@ func newLsIdCommand() *cobra.Command { env := newEnv() cmd := &cobra.Command{ - Use: "ls-id [<prefix>]", + Use: "ls-id [PREFIX]", Short: "List bug identifiers.", PreRunE: loadBackend(env), PostRunE: closeBackend(env), diff --git a/commands/ls.go b/commands/ls.go index 4431e0d4..9a863638 100644 --- a/commands/ls.go +++ b/commands/ls.go @@ -31,7 +31,7 @@ func newLsCommand() *cobra.Command { options := lsOptions{} cmd := &cobra.Command{ - Use: "ls [<query>]", + Use: "ls [QUERY]", Short: "List bugs.", Long: `Display a summary of each bugs. diff --git a/commands/pull.go b/commands/pull.go index 3f032593..3ad4a0c9 100644 --- a/commands/pull.go +++ b/commands/pull.go @@ -12,7 +12,7 @@ func newPullCommand() *cobra.Command { env := newEnv() cmd := &cobra.Command{ - Use: "pull [<remote>]", + Use: "pull [REMOTE]", Short: "Pull bugs update from a git remote.", PreRunE: loadBackend(env), PostRunE: closeBackend(env), diff --git a/commands/push.go b/commands/push.go index f4b83fab..89385f10 100644 --- a/commands/push.go +++ b/commands/push.go @@ -10,7 +10,7 @@ func newPushCommand() *cobra.Command { env := newEnv() cmd := &cobra.Command{ - Use: "push [<remote>]", + Use: "push [REMOTE]", Short: "Push bugs update to a git remote.", PreRunE: loadBackend(env), PostRunE: closeBackend(env), diff --git a/commands/rm.go b/commands/rm.go index 09f6a6cc..3ad4548d 100644 --- a/commands/rm.go +++ b/commands/rm.go @@ -10,7 +10,7 @@ func newRmCommand() *cobra.Command { env := newEnv() cmd := &cobra.Command{ - Use: "rm <id>", + Use: "rm ID", Short: "Remove an existing bug.", Long: "Remove an existing bug in the local repository. Note removing bugs that were imported from bridges will not remove the bug on the remote, and will only remove the local copy of the bug.", PreRunE: loadBackendEnsureUser(env), diff --git a/commands/select.go b/commands/select.go index f2cf2d47..64e38d9b 100644 --- a/commands/select.go +++ b/commands/select.go @@ -5,14 +5,14 @@ import ( "github.com/spf13/cobra" - "github.com/MichaelMure/git-bug/commands/select" + _select "github.com/MichaelMure/git-bug/commands/select" ) func newSelectCommand() *cobra.Command { env := newEnv() cmd := &cobra.Command{ - Use: "select <id>", + Use: "select ID", Short: "Select a bug for implicit use in future commands.", Example: `git bug select 2f15 git bug comment @@ -20,7 +20,7 @@ git bug status `, Long: `Select a bug for implicit use in future commands. -This command allows you to omit any bug <id> argument, for example: +This command allows you to omit any bug ID argument, for example: git bug show instead of git bug show 2f153ca diff --git a/commands/show.go b/commands/show.go index f3995205..77f315cc 100644 --- a/commands/show.go +++ b/commands/show.go @@ -14,7 +14,7 @@ import ( ) type showOptions struct { - query string + fields string format string } @@ -23,7 +23,7 @@ func newShowCommand() *cobra.Command { options := showOptions{} cmd := &cobra.Command{ - Use: "show [<id>]", + Use: "show [ID]", Short: "Display the details of a bug.", PreRunE: loadBackend(env), PostRunE: closeBackend(env), @@ -35,7 +35,7 @@ func newShowCommand() *cobra.Command { flags := cmd.Flags() flags.SortFlags = false - flags.StringVarP(&options.query, "field", "", "", + flags.StringVarP(&options.fields, "field", "", "", "Select field to display. Valid values are [author,authorEmail,createTime,lastEdit,humanId,id,labels,shortId,status,title,actors,participants]") flags.StringVarP(&options.format, "format", "f", "default", "Select the output formatting style. Valid values are [default,json,org-mode]") @@ -55,8 +55,8 @@ func runShow(env *Env, opts showOptions, args []string) error { return errors.New("invalid bug: no comment") } - if opts.query != "" { - switch opts.query { + if opts.fields != "" { + switch opts.fields { case "author": env.out.Printf("%s\n", snap.Author.DisplayName()) case "authorEmail": @@ -88,7 +88,7 @@ func runShow(env *Env, opts showOptions, args []string) error { case "title": env.out.Printf("%s\n", snap.Title) default: - return fmt.Errorf("\nUnsupported field: %s\n", opts.query) + return fmt.Errorf("\nUnsupported field: %s\n", opts.fields) } return nil diff --git a/commands/status.go b/commands/status.go index 57771bca..4dceb51c 100644 --- a/commands/status.go +++ b/commands/status.go @@ -1,16 +1,15 @@ package commands import ( + _select "github.com/MichaelMure/git-bug/commands/select" "github.com/spf13/cobra" - - "github.com/MichaelMure/git-bug/commands/select" ) func newStatusCommand() *cobra.Command { env := newEnv() cmd := &cobra.Command{ - Use: "status [<id>]", + Use: "status [ID]", Short: "Display or change a bug status.", PreRunE: loadBackend(env), PostRunE: closeBackend(env), diff --git a/commands/status_close.go b/commands/status_close.go index 29092a7b..76f2a758 100644 --- a/commands/status_close.go +++ b/commands/status_close.go @@ -1,16 +1,15 @@ package commands import ( + _select "github.com/MichaelMure/git-bug/commands/select" "github.com/spf13/cobra" - - "github.com/MichaelMure/git-bug/commands/select" ) func newStatusCloseCommand() *cobra.Command { env := newEnv() cmd := &cobra.Command{ - Use: "close [<id>]", + Use: "close [ID]", Short: "Mark a bug as closed.", PreRunE: loadBackendEnsureUser(env), PostRunE: closeBackend(env), diff --git a/commands/status_open.go b/commands/status_open.go index 9dd9082c..ff778561 100644 --- a/commands/status_open.go +++ b/commands/status_open.go @@ -1,16 +1,15 @@ package commands import ( + _select "github.com/MichaelMure/git-bug/commands/select" "github.com/spf13/cobra" - - "github.com/MichaelMure/git-bug/commands/select" ) func newStatusOpenCommand() *cobra.Command { env := newEnv() cmd := &cobra.Command{ - Use: "open [<id>]", + Use: "open [ID]", Short: "Mark a bug as open.", PreRunE: loadBackendEnsureUser(env), PostRunE: closeBackend(env), diff --git a/commands/title.go b/commands/title.go index d11fb40e..7afa07ce 100644 --- a/commands/title.go +++ b/commands/title.go @@ -1,16 +1,15 @@ package commands import ( + _select "github.com/MichaelMure/git-bug/commands/select" "github.com/spf13/cobra" - - "github.com/MichaelMure/git-bug/commands/select" ) func newTitleCommand() *cobra.Command { env := newEnv() cmd := &cobra.Command{ - Use: "title [<id>]", + Use: "title [ID]", Short: "Display or change a title of a bug.", PreRunE: loadBackend(env), PostRunE: closeBackend(env), diff --git a/commands/title_edit.go b/commands/title_edit.go index e2dbc245..3750f2cc 100644 --- a/commands/title_edit.go +++ b/commands/title_edit.go @@ -3,7 +3,7 @@ package commands import ( "github.com/spf13/cobra" - "github.com/MichaelMure/git-bug/commands/select" + _select "github.com/MichaelMure/git-bug/commands/select" "github.com/MichaelMure/git-bug/input" ) @@ -16,7 +16,7 @@ func newTitleEditCommand() *cobra.Command { options := titleEditOptions{} cmd := &cobra.Command{ - Use: "edit [<id>]", + Use: "edit [ID]", Short: "Edit a title of a bug.", PreRunE: loadBackendEnsureUser(env), PostRunE: closeBackend(env), diff --git a/commands/user.go b/commands/user.go index 8a6aef53..d4d3fecd 100644 --- a/commands/user.go +++ b/commands/user.go @@ -10,7 +10,7 @@ import ( ) type userOptions struct { - fieldsQuery string + fields string } func newUserCommand() *cobra.Command { @@ -18,7 +18,7 @@ func newUserCommand() *cobra.Command { options := userOptions{} cmd := &cobra.Command{ - Use: "user [<user-id>]", + Use: "user [USER-ID]", Short: "Display or change the user identity.", PreRunE: loadBackendEnsureUser(env), PostRunE: closeBackend(env), @@ -34,7 +34,7 @@ func newUserCommand() *cobra.Command { flags := cmd.Flags() flags.SortFlags = false - flags.StringVarP(&options.fieldsQuery, "field", "f", "", + flags.StringVarP(&options.fields, "field", "f", "", "Select field to display. Valid values are [email,humanId,id,lastModification,lastModificationLamport,login,metadata,name]") return cmd @@ -57,8 +57,8 @@ func runUser(env *Env, opts userOptions, args []string) error { return err } - if opts.fieldsQuery != "" { - switch opts.fieldsQuery { + if opts.fields != "" { + switch opts.fields { case "email": env.out.Printf("%s\n", id.Email()) case "login": @@ -80,7 +80,7 @@ func runUser(env *Env, opts userOptions, args []string) error { env.out.Printf("%s\n", id.Name()) default: - return fmt.Errorf("\nUnsupported field: %s\n", opts.fieldsQuery) + return fmt.Errorf("\nUnsupported field: %s\n", opts.fields) } return nil diff --git a/commands/user_adopt.go b/commands/user_adopt.go index 521f032f..5ab6e39c 100644 --- a/commands/user_adopt.go +++ b/commands/user_adopt.go @@ -8,7 +8,7 @@ func newUserAdoptCommand() *cobra.Command { env := newEnv() cmd := &cobra.Command{ - Use: "adopt <user-id>", + Use: "adopt USER-ID", Short: "Adopt an existing identity as your own.", Args: cobra.ExactArgs(1), PreRunE: loadBackend(env), |