Select and Label command documentation

Jocelyn FACCHINI created

- Informed that label command adds/removes a label to a given bug.
- Added suggestion to use select command when omitting to provide a bug id as argument.
- Added a bit more detail for the select command documentation, giving a hint to "deselect" command.

Change summary

commands/label.go         |  2 +-
commands/label_add.go     |  2 +-
commands/label_rm.go      |  2 +-
commands/select.go        | 11 +++++++++++
commands/select/select.go |  2 +-
5 files changed, 15 insertions(+), 4 deletions(-)

Detailed changes

commands/label.go 🔗

@@ -33,7 +33,7 @@ func runLabel(cmd *cobra.Command, args []string) error {
 
 var labelCmd = &cobra.Command{
 	Use:     "label [<id>]",
-	Short:   "Display, add or remove labels.",
+	Short:   "Display, add or remove labels to/from a bug.",
 	PreRunE: loadRepo,
 	RunE:    runLabel,
 }

commands/label_add.go 🔗

@@ -37,7 +37,7 @@ func runLabelAdd(cmd *cobra.Command, args []string) error {
 
 var labelAddCmd = &cobra.Command{
 	Use:     "add [<id>] <label>[...]",
-	Short:   "Add a label.",
+	Short:   "Add a label to a bug.",
 	PreRunE: loadRepo,
 	RunE:    runLabelAdd,
 }

commands/label_rm.go 🔗

@@ -37,7 +37,7 @@ func runLabelRm(cmd *cobra.Command, args []string) error {
 
 var labelRmCmd = &cobra.Command{
 	Use:     "rm [<id>] <label>[...]",
-	Short:   "Remove a label.",
+	Short:   "Remove a label from a bug.",
 	PreRunE: loadRepo,
 	RunE:    runLabelRm,
 }

commands/select.go 🔗

@@ -45,6 +45,17 @@ var selectCmd = &cobra.Command{
 	Example: `git bug select 2f15
 git bug comment
 git bug status
+`,
+	Long: `Select a bug for implicit use in future commands.
+
+This command allows you to omit any bug <id> argument for the following commands:
+  - git bug comment
+  - git bug label
+  - git bug show
+  - git bug status
+  - git bug title
+
+The complementary command is "git bug deselect" performing the opposite operation.
 `,
 	PreRunE: loadRepo,
 	RunE:    runSelect,

commands/select/select.go 🔗

@@ -16,7 +16,7 @@ import (
 
 const selectFile = "select"
 
-var ErrNoValidId = errors.New("you must provide a bug id")
+var ErrNoValidId = errors.New("you must provide a bug id or use the \"select\" command first")
 
 // ResolveBug first try to resolve a bug using the first argument of the command
 // line. If it fails, it fallback to the select mechanism.