aboutsummaryrefslogtreecommitdiffstats
path: root/commands/root.go
diff options
context:
space:
mode:
Diffstat (limited to 'commands/root.go')
-rw-r--r--commands/root.go54
1 files changed, 32 insertions, 22 deletions
diff --git a/commands/root.go b/commands/root.go
index e012bd83..b28b77b8 100644
--- a/commands/root.go
+++ b/commands/root.go
@@ -6,9 +6,13 @@ import (
"os"
"github.com/spf13/cobra"
-)
-const rootCommandName = "git-bug"
+ "github.com/MichaelMure/git-bug/commands/bridge"
+ usercmd "github.com/MichaelMure/git-bug/commands/user"
+
+ "github.com/MichaelMure/git-bug/commands/bug"
+ "github.com/MichaelMure/git-bug/commands/execenv"
+)
// These variables are initialized externally during the build. See the Makefile.
var GitCommit string
@@ -17,8 +21,8 @@ var GitExactTag string
func NewRootCommand() *cobra.Command {
cmd := &cobra.Command{
- Use: rootCommandName,
- Short: "A bug tracker embedded in Git.",
+ Use: execenv.RootCommandName,
+ Short: "A bug tracker embedded in Git",
Long: `git-bug is a bug tracker embedded in git.
git-bug use git objects to store the bug tracking separated from the files
@@ -52,26 +56,32 @@ the same git remote you are already using to collaborate with other people.
DisableAutoGenTag: true,
}
- cmd.AddCommand(newAddCommand())
- cmd.AddCommand(newBridgeCommand())
+ const entityGroup = "entity"
+ const uiGroup = "ui"
+ const remoteGroup = "remote"
+
+ cmd.AddGroup(&cobra.Group{ID: entityGroup, Title: "Entities"})
+ cmd.AddGroup(&cobra.Group{ID: uiGroup, Title: "User interfaces"})
+ cmd.AddGroup(&cobra.Group{ID: remoteGroup, Title: "Interaction with the outside world"})
+
+ addCmdWithGroup := func(child *cobra.Command, groupID string) {
+ cmd.AddCommand(child)
+ child.GroupID = groupID
+ }
+
+ addCmdWithGroup(bugcmd.NewBugCommand(), entityGroup)
+ addCmdWithGroup(usercmd.NewUserCommand(), entityGroup)
+ addCmdWithGroup(newLabelCommand(), entityGroup)
+
+ addCmdWithGroup(newTermUICommand(), uiGroup)
+ addCmdWithGroup(newWebUICommand(), uiGroup)
+
+ addCmdWithGroup(newPullCommand(), remoteGroup)
+ addCmdWithGroup(newPushCommand(), remoteGroup)
+ addCmdWithGroup(bridgecmd.NewBridgeCommand(), remoteGroup)
+
cmd.AddCommand(newCommandsCommand())
- cmd.AddCommand(newCommentCommand())
- cmd.AddCommand(newDeselectCommand())
- cmd.AddCommand(newLabelCommand())
- cmd.AddCommand(newLsCommand())
- cmd.AddCommand(newLsIdCommand())
- cmd.AddCommand(newLsLabelCommand())
- cmd.AddCommand(newPullCommand())
- cmd.AddCommand(newPushCommand())
- cmd.AddCommand(newRmCommand())
- cmd.AddCommand(newSelectCommand())
- cmd.AddCommand(newShowCommand())
- cmd.AddCommand(newStatusCommand())
- cmd.AddCommand(newTermUICommand())
- cmd.AddCommand(newTitleCommand())
- cmd.AddCommand(newUserCommand())
cmd.AddCommand(newVersionCommand())
- cmd.AddCommand(newWebUICommand())
return cmd
}