diff options
-rw-r--r-- | cliff.toml | 26 | ||||
-rw-r--r-- | commands/commands.go | 80 | ||||
-rw-r--r-- | commands/root.go | 1 | ||||
-rw-r--r-- | doc/man/git-bug-commands.1 | 26 | ||||
-rw-r--r-- | doc/man/git-bug.1 | 2 | ||||
-rw-r--r-- | doc/md/git-bug.md | 1 | ||||
-rw-r--r-- | doc/md/git-bug_commands.md | 19 |
7 files changed, 1 insertions, 154 deletions
diff --git a/cliff.toml b/cliff.toml index 9d8d38858..f87611569 100644 --- a/cliff.toml +++ b/cliff.toml @@ -102,37 +102,11 @@ sort_commits = "oldest" topo_order = true commit_preprocessors = [ - # map various older scopes to new scopes - # TODO: remove after init (because we will enforce an append-only workflow) - { pattern = '^([^\(]+)\(commands\):', replace = '$1 (cli):' }, - { pattern = '^[^\(]+\(ci\)', replace = 'ci:' }, - { pattern = '^[^\(]+\(TestCache\)', replace = 'test:' }, - { pattern = '^doc: (.+ \(#1395\))', replace = 'docs(dev-infra): $1' }, - { pattern = '^fix: (.+ \(#1403\))', replace = 'fix(completion): $1' }, - { pattern = '^docs: (correct mispelled words)', replace = 'fix(dev-infra): $1' }, - { pattern = '^(.+) \[fix\]$', replace = 'docs: $1' }, - { pattern = '^fix ', replace = 'fix: ' }, - - # remove errata from old commit messages - # TODO: remove after init (because we will enforce an append-only workflow) - { pattern = '^([^\(]+)\((?:#?\d+|opencollective|git-bug-863)\)', replace = '$1' }, - { pattern = ', fix https://.+/issues/653', replace = '' }, - # remove quotes from reversions # we do this to clean up the changelog output, since the raw message would # otherwise be surrounded in quotes { pattern = '^[Rr]evert: "(.+)"', replace = 'revert: $1' }, - # convert quotes in subjects to graves - # TODO: remove after init (because we will enforce an append-only workflow) - { pattern = '"', replace = '`' }, - - # escape backslashes - # we do this because mdformat will remove isolated backslashes, and there is a - # historical commit that contains one - # TODO: remove after init (because we will enforce an append-only workflow) - { pattern = '\\', replace = '\\' }, - # remove PR references from commit messages, to remove a hard dependency on # github. by default, we show the commit hash (although github usernames and # PR references are added in dynamically during release, for the changes diff --git a/commands/commands.go b/commands/commands.go deleted file mode 100644 index 00c7b2dc7..000000000 --- a/commands/commands.go +++ /dev/null @@ -1,80 +0,0 @@ -package commands - -import ( - "sort" - - "github.com/spf13/cobra" - - "github.com/git-bug/git-bug/commands/execenv" -) - -type commandOptions struct { - desc bool -} - -func newCommandsCommand(env *execenv.Env) *cobra.Command { - options := commandOptions{} - - cmd := &cobra.Command{ - Use: "commands", - Short: "Display available commands.", - RunE: func(cmd *cobra.Command, args []string) error { - return runCommands(env, options) - }, - } - - flags := cmd.Flags() - flags.SortFlags = false - - flags.BoolVarP(&options.desc, "pretty", "p", false, - "Output the command description as well as Markdown compatible comment", - ) - - return cmd -} - -func runCommands(env *execenv.Env, opts commandOptions) error { - first := true - - var allCmds []*cobra.Command - queue := []*cobra.Command{NewRootCommand()} - - for len(queue) > 0 { - cmd := queue[0] - queue = queue[1:] - allCmds = append(allCmds, cmd) - queue = append(queue, cmd.Commands()...) - } - - sort.Sort(commandSorterByName(allCmds)) - - for _, cmd := range allCmds { - if !first { - env.Out.Println() - } - - first = false - - if opts.desc { - env.Out.Printf("# %s\n", cmd.Short) - } - - env.Out.Print(cmd.UseLine()) - - if opts.desc { - env.Out.Println() - } - } - - if !opts.desc { - env.Out.Println() - } - - return nil -} - -type commandSorterByName []*cobra.Command - -func (c commandSorterByName) Len() int { return len(c) } -func (c commandSorterByName) Swap(i, j int) { c[i], c[j] = c[j], c[i] } -func (c commandSorterByName) Less(i, j int) bool { return c[i].CommandPath() < c[j].CommandPath() } diff --git a/commands/root.go b/commands/root.go index e966751c7..1a4109a3c 100644 --- a/commands/root.go +++ b/commands/root.go @@ -75,7 +75,6 @@ the same git remote you are already using to collaborate with other people. addCmdWithGroup(newPushCommand(env), remoteGroup) addCmdWithGroup(bridgecmd.NewBridgeCommand(env), remoteGroup) - cmd.AddCommand(newCommandsCommand(env)) cmd.AddCommand(newVersionCommand(env)) cmd.AddCommand(newWipeCommand(env)) diff --git a/doc/man/git-bug-commands.1 b/doc/man/git-bug-commands.1 deleted file mode 100644 index 58d24fc47..000000000 --- a/doc/man/git-bug-commands.1 +++ /dev/null @@ -1,26 +0,0 @@ -.nh -.TH "GIT-BUG" "1" "Apr 2019" "Generated from git-bug's source code" "" - -.SH NAME -git-bug-commands - Display available commands. - - -.SH SYNOPSIS -\fBgit-bug commands [flags]\fP - - -.SH DESCRIPTION -Display available commands. - - -.SH OPTIONS -\fB-p\fP, \fB--pretty\fP[=false] - Output the command description as well as Markdown compatible comment - -.PP -\fB-h\fP, \fB--help\fP[=false] - help for commands - - -.SH SEE ALSO -\fBgit-bug(1)\fP diff --git a/doc/man/git-bug.1 b/doc/man/git-bug.1 index 24d8e8644..7320689b4 100644 --- a/doc/man/git-bug.1 +++ b/doc/man/git-bug.1 @@ -24,4 +24,4 @@ the same git remote you are already using to collaborate with other people. .SH SEE ALSO -\fBgit-bug-bridge(1)\fP, \fBgit-bug-bug(1)\fP, \fBgit-bug-commands(1)\fP, \fBgit-bug-label(1)\fP, \fBgit-bug-pull(1)\fP, \fBgit-bug-push(1)\fP, \fBgit-bug-termui(1)\fP, \fBgit-bug-user(1)\fP, \fBgit-bug-version(1)\fP, \fBgit-bug-webui(1)\fP, \fBgit-bug-wipe(1)\fP +\fBgit-bug-bridge(1)\fP, \fBgit-bug-bug(1)\fP, \fBgit-bug-label(1)\fP, \fBgit-bug-pull(1)\fP, \fBgit-bug-push(1)\fP, \fBgit-bug-termui(1)\fP, \fBgit-bug-user(1)\fP, \fBgit-bug-version(1)\fP, \fBgit-bug-webui(1)\fP, \fBgit-bug-wipe(1)\fP diff --git a/doc/md/git-bug.md b/doc/md/git-bug.md index a71d6dfb9..03bebb65e 100644 --- a/doc/md/git-bug.md +++ b/doc/md/git-bug.md @@ -26,7 +26,6 @@ git-bug [flags] * [git-bug bridge](git-bug_bridge.md) - List bridges to other bug trackers * [git-bug bug](git-bug_bug.md) - List bugs -* [git-bug commands](git-bug_commands.md) - Display available commands. * [git-bug label](git-bug_label.md) - List valid labels * [git-bug pull](git-bug_pull.md) - Pull updates from a git remote * [git-bug push](git-bug_push.md) - Push updates to a git remote diff --git a/doc/md/git-bug_commands.md b/doc/md/git-bug_commands.md deleted file mode 100644 index bce599dd9..000000000 --- a/doc/md/git-bug_commands.md +++ /dev/null @@ -1,19 +0,0 @@ -## git-bug commands - -Display available commands. - -``` -git-bug commands [flags] -``` - -### Options - -``` - -p, --pretty Output the command description as well as Markdown compatible comment - -h, --help help for commands -``` - -### SEE ALSO - -* [git-bug](git-bug.md) - A bug tracker embedded in Git - |