commands: migrate the open/close commands under the "status" command

Michael Muré created

Change summary

commands/status_close.go       |  6 +-
commands/status_open.go        |  6 +-
doc/man/git-bug-status-close.1 | 29 +++++++++++++++++
doc/man/git-bug-status-open.1  | 29 +++++++++++++++++
doc/man/git-bug-status.1       |  2 
doc/man/git-bug.1              |  2 
doc/md/git-bug.md              |  2 -
doc/md/git-bug_status.md       |  2 +
doc/md/git-bug_status_close.md | 22 +++++++++++++
doc/md/git-bug_status_open.md  | 22 +++++++++++++
misc/bash_completion/git-bug   | 60 ++++++++++++++++++------------------
misc/zsh_completion/git-bug    |  5 ++
12 files changed, 146 insertions(+), 41 deletions(-)

Detailed changes

commands/close.go → commands/status_close.go 🔗

@@ -7,7 +7,7 @@ import (
 	"github.com/spf13/cobra"
 )
 
-func runCloseBug(cmd *cobra.Command, args []string) error {
+func runStatusClose(cmd *cobra.Command, args []string) error {
 	if len(args) > 1 {
 		return errors.New("Only closing one bug at a time is supported")
 	}
@@ -40,9 +40,9 @@ func runCloseBug(cmd *cobra.Command, args []string) error {
 var closeCmd = &cobra.Command{
 	Use:   "close <id>",
 	Short: "Mark the bug as closed",
-	RunE:  runCloseBug,
+	RunE:  runStatusClose,
 }
 
 func init() {
-	RootCmd.AddCommand(closeCmd)
+	statusCmd.AddCommand(closeCmd)
 }

commands/open.go → commands/status_open.go 🔗

@@ -7,7 +7,7 @@ import (
 	"github.com/spf13/cobra"
 )
 
-func runOpenBug(cmd *cobra.Command, args []string) error {
+func runStatusOpen(cmd *cobra.Command, args []string) error {
 	if len(args) > 1 {
 		return errors.New("Only opening one bug at a time is supported")
 	}
@@ -40,9 +40,9 @@ func runOpenBug(cmd *cobra.Command, args []string) error {
 var openCmd = &cobra.Command{
 	Use:   "open <id>",
 	Short: "Mark the bug as open",
-	RunE:  runOpenBug,
+	RunE:  runStatusOpen,
 }
 
 func init() {
-	RootCmd.AddCommand(openCmd)
+	statusCmd.AddCommand(openCmd)
 }

doc/man/git-bug-status-close.1 🔗

@@ -0,0 +1,29 @@
+.TH "GIT-BUG" "1" "Sep 2018" "Generated from git-bug's source code" "" 
+.nh
+.ad l
+
+
+.SH NAME
+.PP
+git\-bug\-status\-close \- Mark the bug as closed
+
+
+.SH SYNOPSIS
+.PP
+\fBgit\-bug status close <id> [flags]\fP
+
+
+.SH DESCRIPTION
+.PP
+Mark the bug as closed
+
+
+.SH OPTIONS
+.PP
+\fB\-h\fP, \fB\-\-help\fP[=false]
+    help for close
+
+
+.SH SEE ALSO
+.PP
+\fBgit\-bug\-status(1)\fP

doc/man/git-bug-status-open.1 🔗

@@ -0,0 +1,29 @@
+.TH "GIT-BUG" "1" "Sep 2018" "Generated from git-bug's source code" "" 
+.nh
+.ad l
+
+
+.SH NAME
+.PP
+git\-bug\-status\-open \- Mark the bug as open
+
+
+.SH SYNOPSIS
+.PP
+\fBgit\-bug status open <id> [flags]\fP
+
+
+.SH DESCRIPTION
+.PP
+Mark the bug as open
+
+
+.SH OPTIONS
+.PP
+\fB\-h\fP, \fB\-\-help\fP[=false]
+    help for open
+
+
+.SH SEE ALSO
+.PP
+\fBgit\-bug\-status(1)\fP

doc/man/git-bug-status.1 🔗

@@ -26,4 +26,4 @@ Show the bug status
 
 .SH SEE ALSO
 .PP
-\fBgit\-bug(1)\fP
+\fBgit\-bug(1)\fP, \fBgit\-bug\-status\-close(1)\fP, \fBgit\-bug\-status\-open(1)\fP

doc/man/git-bug.1 🔗

@@ -29,4 +29,4 @@ It use the same internal storage so it doesn't pollute your project. As you woul
 
 .SH SEE ALSO
 .PP
-\fBgit\-bug\-add(1)\fP, \fBgit\-bug\-close(1)\fP, \fBgit\-bug\-commands(1)\fP, \fBgit\-bug\-comment(1)\fP, \fBgit\-bug\-label(1)\fP, \fBgit\-bug\-ls(1)\fP, \fBgit\-bug\-open(1)\fP, \fBgit\-bug\-pull(1)\fP, \fBgit\-bug\-push(1)\fP, \fBgit\-bug\-show(1)\fP, \fBgit\-bug\-status(1)\fP, \fBgit\-bug\-termui(1)\fP, \fBgit\-bug\-title(1)\fP, \fBgit\-bug\-webui(1)\fP
+\fBgit\-bug\-add(1)\fP, \fBgit\-bug\-commands(1)\fP, \fBgit\-bug\-comment(1)\fP, \fBgit\-bug\-label(1)\fP, \fBgit\-bug\-ls(1)\fP, \fBgit\-bug\-pull(1)\fP, \fBgit\-bug\-push(1)\fP, \fBgit\-bug\-show(1)\fP, \fBgit\-bug\-status(1)\fP, \fBgit\-bug\-termui(1)\fP, \fBgit\-bug\-title(1)\fP, \fBgit\-bug\-webui(1)\fP

doc/md/git-bug.md 🔗

@@ -21,12 +21,10 @@ git-bug [flags]
 ### SEE ALSO
 
 * [git-bug add](git-bug_add.md)	 - Create a new bug
-* [git-bug close](git-bug_close.md)	 - Mark the bug as closed
 * [git-bug commands](git-bug_commands.md)	 - Display available commands
 * [git-bug comment](git-bug_comment.md)	 - Show a bug's comments
 * [git-bug label](git-bug_label.md)	 - Manipulate bug's label
 * [git-bug ls](git-bug_ls.md)	 - List bugs
-* [git-bug open](git-bug_open.md)	 - Mark the bug as open
 * [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 show](git-bug_show.md)	 - Display the details of a bug

doc/md/git-bug_status.md 🔗

@@ -19,4 +19,6 @@ git-bug status <id> [flags]
 ### SEE ALSO
 
 * [git-bug](git-bug.md)	 - A bugtracker embedded in Git
+* [git-bug status close](git-bug_status_close.md)	 - Mark the bug as closed
+* [git-bug status open](git-bug_status_open.md)	 - Mark the bug as open
 

doc/md/git-bug_status_close.md 🔗

@@ -0,0 +1,22 @@
+## git-bug status close
+
+Mark the bug as closed
+
+### Synopsis
+
+Mark the bug as closed
+
+```
+git-bug status close <id> [flags]
+```
+
+### Options
+
+```
+  -h, --help   help for close
+```
+
+### SEE ALSO
+
+* [git-bug status](git-bug_status.md)	 - Show the bug status
+

doc/md/git-bug_status_open.md 🔗

@@ -0,0 +1,22 @@
+## git-bug status open
+
+Mark the bug as open
+
+### Synopsis
+
+Mark the bug as open
+
+```
+git-bug status open <id> [flags]
+```
+
+### Options
+
+```
+  -h, --help   help for open
+```
+
+### SEE ALSO
+
+* [git-bug status](git-bug_status.md)	 - Show the bug status
+

misc/bash_completion/git-bug 🔗

@@ -277,26 +277,6 @@ _git-bug_add()
     noun_aliases=()
 }
 
-_git-bug_close()
-{
-    last_command="git-bug_close"
-
-    command_aliases=()
-
-    commands=()
-
-    flags=()
-    two_word_flags=()
-    local_nonpersistent_flags=()
-    flags_with_completion=()
-    flags_completion=()
-
-
-    must_have_one_flag=()
-    must_have_one_noun=()
-    noun_aliases=()
-}
-
 _git-bug_commands()
 {
     last_command="git-bug_commands"
@@ -428,9 +408,9 @@ _git-bug_ls()
     noun_aliases=()
 }
 
-_git-bug_open()
+_git-bug_pull()
 {
-    last_command="git-bug_open"
+    last_command="git-bug_pull"
 
     command_aliases=()
 
@@ -448,9 +428,9 @@ _git-bug_open()
     noun_aliases=()
 }
 
-_git-bug_pull()
+_git-bug_push()
 {
-    last_command="git-bug_pull"
+    last_command="git-bug_push"
 
     command_aliases=()
 
@@ -468,9 +448,9 @@ _git-bug_pull()
     noun_aliases=()
 }
 
-_git-bug_push()
+_git-bug_show()
 {
-    last_command="git-bug_push"
+    last_command="git-bug_show"
 
     command_aliases=()
 
@@ -488,9 +468,29 @@ _git-bug_push()
     noun_aliases=()
 }
 
-_git-bug_show()
+_git-bug_status_close()
 {
-    last_command="git-bug_show"
+    last_command="git-bug_status_close"
+
+    command_aliases=()
+
+    commands=()
+
+    flags=()
+    two_word_flags=()
+    local_nonpersistent_flags=()
+    flags_with_completion=()
+    flags_completion=()
+
+
+    must_have_one_flag=()
+    must_have_one_noun=()
+    noun_aliases=()
+}
+
+_git-bug_status_open()
+{
+    last_command="git-bug_status_open"
 
     command_aliases=()
 
@@ -515,6 +515,8 @@ _git-bug_status()
     command_aliases=()
 
     commands=()
+    commands+=("close")
+    commands+=("open")
 
     flags=()
     two_word_flags=()
@@ -623,12 +625,10 @@ _git-bug_root_command()
 
     commands=()
     commands+=("add")
-    commands+=("close")
     commands+=("commands")
     commands+=("comment")
     commands+=("label")
     commands+=("ls")
-    commands+=("open")
     commands+=("pull")
     commands+=("push")
     commands+=("show")

misc/zsh_completion/git-bug 🔗

@@ -8,7 +8,7 @@ case $state in
   level1)
     case $words[1] in
       git-bug)
-        _arguments '1: :(add close commands comment label ls open pull push show status termui title webui)'
+        _arguments '1: :(add commands comment label ls pull push show status termui title webui)'
       ;;
       *)
         _arguments '*: :_files'
@@ -20,6 +20,9 @@ case $state in
       comment)
         _arguments '2: :(add)'
       ;;
+      status)
+        _arguments '2: :(close open)'
+      ;;
       title)
         _arguments '2: :(edit)'
       ;;