aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Moyer <smoyer1@selesy.com>2022-09-25 15:22:03 -0400
committerSteve Moyer <smoyer1@selesy.com>2022-09-25 15:22:03 -0400
commit0ffa79ef13890d4bd46079205b3f6682b93985e9 (patch)
tree15c9b2d7db8324cc96b3cc7273c039c50d8155c9
parent8364cb221b2d0d0cfaf9baa3322abdc93cd2258a (diff)
downloadgit-bug-0ffa79ef13890d4bd46079205b3f6682b93985e9.tar.gz
feat(530) make label commands consistent
-rw-r--r--commands/label.go3
-rw-r--r--commands/label_ls.go33
-rw-r--r--commands/ls-labels.go18
-rw-r--r--doc/man/git-bug-label-ls.1 (renamed from doc/man/git-bug-ls-label.1)8
-rw-r--r--doc/man/git-bug-label.12
-rw-r--r--doc/man/git-bug.12
-rw-r--r--doc/md/git-bug.md1
-rw-r--r--doc/md/git-bug_label.md1
-rw-r--r--doc/md/git-bug_label_ls.md (renamed from doc/md/git-bug_ls-label.md)8
9 files changed, 53 insertions, 23 deletions
diff --git a/commands/label.go b/commands/label.go
index 906974a5..ff4d0151 100644
--- a/commands/label.go
+++ b/commands/label.go
@@ -20,13 +20,14 @@ func newLabelCommand() *cobra.Command {
}
cmd.AddCommand(newLabelAddCommand())
+ cmd.AddCommand(newLabelLsCommand())
cmd.AddCommand(newLabelRmCommand())
return cmd
}
func runLabel(env *Env, args []string) error {
- b, args, err := _select.ResolveBug(env.backend, args)
+ b, _, err := _select.ResolveBug(env.backend, args)
if err != nil {
return err
}
diff --git a/commands/label_ls.go b/commands/label_ls.go
new file mode 100644
index 00000000..242eb00c
--- /dev/null
+++ b/commands/label_ls.go
@@ -0,0 +1,33 @@
+package commands
+
+import (
+ "github.com/spf13/cobra"
+)
+
+func newLabelLsCommand() *cobra.Command {
+ env := newEnv()
+
+ cmd := &cobra.Command{
+ Use: "ls",
+ Short: "List valid labels.",
+ Long: `List valid labels.
+
+Note: in the future, a proper label policy could be implemented where valid labels are defined in a configuration file. Until that, the default behavior is to return the list of labels already used.`,
+ PreRunE: loadBackend(env),
+ RunE: closeBackend(env, func(cmd *cobra.Command, args []string) error {
+ return runLabelLs(env)
+ }),
+ }
+
+ return cmd
+}
+
+func runLabelLs(env *Env) error {
+ labels := env.backend.ValidLabels()
+
+ for _, l := range labels {
+ env.out.Println(l)
+ }
+
+ return nil
+}
diff --git a/commands/ls-labels.go b/commands/ls-labels.go
index 086943a9..00fc3fe6 100644
--- a/commands/ls-labels.go
+++ b/commands/ls-labels.go
@@ -15,19 +15,15 @@ func newLsLabelCommand() *cobra.Command {
Note: in the future, a proper label policy could be implemented where valid labels are defined in a configuration file. Until that, the default behavior is to return the list of labels already used.`,
PreRunE: loadBackend(env),
RunE: closeBackend(env, func(cmd *cobra.Command, args []string) error {
- return runLsLabel(env)
+ return runLabelLs(env)
}),
- }
-
- return cmd
-}
-
-func runLsLabel(env *Env) error {
- labels := env.backend.ValidLabels()
+ Deprecated: ` and will be removed in v1.0.
- for _, l := range labels {
- env.out.Println(l)
+The functionality provided by this command is now provided by
+the following (equivalent) command:
+git-bug label ls
+`,
}
- return nil
+ return cmd
}
diff --git a/doc/man/git-bug-ls-label.1 b/doc/man/git-bug-label-ls.1
index 65857083..67ee7dd1 100644
--- a/doc/man/git-bug-ls-label.1
+++ b/doc/man/git-bug-label-ls.1
@@ -3,12 +3,12 @@
.SH NAME
.PP
-git-bug-ls-label - List valid labels.
+git-bug-label-ls - List valid labels.
.SH SYNOPSIS
.PP
-\fBgit-bug ls-label [flags]\fP
+\fBgit-bug label ls [flags]\fP
.SH DESCRIPTION
@@ -22,9 +22,9 @@ Note: in the future, a proper label policy could be implemented where valid labe
.SH OPTIONS
.PP
\fB-h\fP, \fB--help\fP[=false]
- help for ls-label
+ help for ls
.SH SEE ALSO
.PP
-\fBgit-bug(1)\fP
+\fBgit-bug-label(1)\fP
diff --git a/doc/man/git-bug-label.1 b/doc/man/git-bug-label.1
index 9dfc5c89..69a5c217 100644
--- a/doc/man/git-bug-label.1
+++ b/doc/man/git-bug-label.1
@@ -24,4 +24,4 @@ Display, add or remove labels to/from a bug.
.SH SEE ALSO
.PP
-\fBgit-bug(1)\fP, \fBgit-bug-label-add(1)\fP, \fBgit-bug-label-rm(1)\fP
+\fBgit-bug(1)\fP, \fBgit-bug-label-add(1)\fP, \fBgit-bug-label-ls(1)\fP, \fBgit-bug-label-rm(1)\fP
diff --git a/doc/man/git-bug.1 b/doc/man/git-bug.1
index 419bb2c7..b982c7f4 100644
--- a/doc/man/git-bug.1
+++ b/doc/man/git-bug.1
@@ -29,4 +29,4 @@ the same git remote you are already using to collaborate with other people.
.SH SEE ALSO
.PP
-\fBgit-bug-add(1)\fP, \fBgit-bug-bridge(1)\fP, \fBgit-bug-commands(1)\fP, \fBgit-bug-comment(1)\fP, \fBgit-bug-deselect(1)\fP, \fBgit-bug-label(1)\fP, \fBgit-bug-ls(1)\fP, \fBgit-bug-ls-label(1)\fP, \fBgit-bug-pull(1)\fP, \fBgit-bug-push(1)\fP, \fBgit-bug-rm(1)\fP, \fBgit-bug-select(1)\fP, \fBgit-bug-show(1)\fP, \fBgit-bug-status(1)\fP, \fBgit-bug-termui(1)\fP, \fBgit-bug-title(1)\fP, \fBgit-bug-user(1)\fP, \fBgit-bug-version(1)\fP, \fBgit-bug-webui(1)\fP
+\fBgit-bug-add(1)\fP, \fBgit-bug-bridge(1)\fP, \fBgit-bug-commands(1)\fP, \fBgit-bug-comment(1)\fP, \fBgit-bug-deselect(1)\fP, \fBgit-bug-label(1)\fP, \fBgit-bug-ls(1)\fP, \fBgit-bug-pull(1)\fP, \fBgit-bug-push(1)\fP, \fBgit-bug-rm(1)\fP, \fBgit-bug-select(1)\fP, \fBgit-bug-show(1)\fP, \fBgit-bug-status(1)\fP, \fBgit-bug-termui(1)\fP, \fBgit-bug-title(1)\fP, \fBgit-bug-user(1)\fP, \fBgit-bug-version(1)\fP, \fBgit-bug-webui(1)\fP
diff --git a/doc/md/git-bug.md b/doc/md/git-bug.md
index 754cc93f..c47f8484 100644
--- a/doc/md/git-bug.md
+++ b/doc/md/git-bug.md
@@ -31,7 +31,6 @@ git-bug [flags]
* [git-bug deselect](git-bug_deselect.md) - Clear the implicitly selected bug.
* [git-bug label](git-bug_label.md) - Display, add or remove labels to/from a bug.
* [git-bug ls](git-bug_ls.md) - List bugs.
-* [git-bug ls-label](git-bug_ls-label.md) - List valid labels.
* [git-bug pull](git-bug_pull.md) - Pull bugs update from a git remote.
* [git-bug push](git-bug_push.md) - Push bugs update to a git remote.
* [git-bug rm](git-bug_rm.md) - Remove an existing bug.
diff --git a/doc/md/git-bug_label.md b/doc/md/git-bug_label.md
index dd597b69..caeebe89 100644
--- a/doc/md/git-bug_label.md
+++ b/doc/md/git-bug_label.md
@@ -16,5 +16,6 @@ git-bug label [ID] [flags]
* [git-bug](git-bug.md) - A bug tracker embedded in Git.
* [git-bug label add](git-bug_label_add.md) - Add a label to a bug.
+* [git-bug label ls](git-bug_label_ls.md) - List valid labels.
* [git-bug label rm](git-bug_label_rm.md) - Remove a label from a bug.
diff --git a/doc/md/git-bug_ls-label.md b/doc/md/git-bug_label_ls.md
index 9ee6fa8c..cda6ebba 100644
--- a/doc/md/git-bug_ls-label.md
+++ b/doc/md/git-bug_label_ls.md
@@ -1,4 +1,4 @@
-## git-bug ls-label
+## git-bug label ls
List valid labels.
@@ -9,16 +9,16 @@ List valid labels.
Note: in the future, a proper label policy could be implemented where valid labels are defined in a configuration file. Until that, the default behavior is to return the list of labels already used.
```
-git-bug ls-label [flags]
+git-bug label ls [flags]
```
### Options
```
- -h, --help help for ls-label
+ -h, --help help for ls
```
### SEE ALSO
-* [git-bug](git-bug.md) - A bug tracker embedded in Git.
+* [git-bug label](git-bug_label.md) - Display, add or remove labels to/from a bug.