diff options
-rw-r--r-- | commands/deselect.go | 38 | ||||
-rw-r--r-- | doc/man/git-bug-deselect.1 | 44 | ||||
-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_deselect.md | 32 | ||||
-rw-r--r-- | misc/bash_completion/git-bug | 21 | ||||
-rw-r--r-- | misc/zsh_completion/git-bug | 8 |
7 files changed, 141 insertions, 5 deletions
diff --git a/commands/deselect.go b/commands/deselect.go new file mode 100644 index 00000000..f2907c70 --- /dev/null +++ b/commands/deselect.go @@ -0,0 +1,38 @@ +package commands + +import ( + "github.com/MichaelMure/git-bug/cache" + "github.com/MichaelMure/git-bug/commands/select" + "github.com/spf13/cobra" +) + +func runDeselect(cmd *cobra.Command, args []string) error { + backend, err := cache.NewRepoCache(repo) + if err != nil { + return err + } + defer backend.Close() + + err = _select.Clear(backend) + if err != nil { + return err + } + + return nil +} + +var deselectCmd = &cobra.Command{ + Use: "deselect", + Short: "Clear the implicitly selected bug", + Example: `git bug select 2f15 +git bug comment +git bug status +git bug deselect +`, + RunE: runDeselect, +} + +func init() { + RootCmd.AddCommand(deselectCmd) + deselectCmd.Flags().SortFlags = false +} diff --git a/doc/man/git-bug-deselect.1 b/doc/man/git-bug-deselect.1 new file mode 100644 index 00000000..430c1c8f --- /dev/null +++ b/doc/man/git-bug-deselect.1 @@ -0,0 +1,44 @@ +.TH "GIT-BUG" "1" "Sep 2018" "Generated from git-bug's source code" "" +.nh +.ad l + + +.SH NAME +.PP +git\-bug\-deselect \- Clear the implicitly selected bug + + +.SH SYNOPSIS +.PP +\fBgit\-bug deselect [flags]\fP + + +.SH DESCRIPTION +.PP +Clear the implicitly selected bug + + +.SH OPTIONS +.PP +\fB\-h\fP, \fB\-\-help\fP[=false] + help for deselect + + +.SH EXAMPLE +.PP +.RS + +.nf +git bug select 2f15 +git bug comment +git bug status +git bug deselect + + +.fi +.RE + + +.SH SEE ALSO +.PP +\fBgit\-bug(1)\fP diff --git a/doc/man/git-bug.1 b/doc/man/git-bug.1 index 0a15711a..56ab25b6 100644 --- a/doc/man/git-bug.1 +++ b/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\-bridge(1)\fP, \fBgit\-bug\-commands(1)\fP, \fBgit\-bug\-comment(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\-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\-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\-ls\-label(1)\fP, \fBgit\-bug\-pull(1)\fP, \fBgit\-bug\-push(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\-webui(1)\fP diff --git a/doc/md/git-bug.md b/doc/md/git-bug.md index af4859ce..a7fd865f 100644 --- a/doc/md/git-bug.md +++ b/doc/md/git-bug.md @@ -24,6 +24,7 @@ git-bug [flags] * [git-bug bridge](git-bug_bridge.md) - Configure and use bridges to other bug trackers * [git-bug commands](git-bug_commands.md) - Display available commands * [git-bug comment](git-bug_comment.md) - Display or add comments +* [git-bug deselect](git-bug_deselect.md) - Clear the implicitly selected bug * [git-bug label](git-bug_label.md) - Display, add or remove labels * [git-bug ls](git-bug_ls.md) - List bugs * [git-bug ls-label](git-bug_ls-label.md) - List valid labels diff --git a/doc/md/git-bug_deselect.md b/doc/md/git-bug_deselect.md new file mode 100644 index 00000000..dbc86dc9 --- /dev/null +++ b/doc/md/git-bug_deselect.md @@ -0,0 +1,32 @@ +## git-bug deselect + +Clear the implicitly selected bug + +### Synopsis + +Clear the implicitly selected bug + +``` +git-bug deselect [flags] +``` + +### Examples + +``` +git bug select 2f15 +git bug comment +git bug status +git bug deselect + +``` + +### Options + +``` + -h, --help help for deselect +``` + +### SEE ALSO + +* [git-bug](git-bug.md) - A bug tracker embedded in Git + diff --git a/misc/bash_completion/git-bug b/misc/bash_completion/git-bug index 496c900b..69f73d2c 100644 --- a/misc/bash_completion/git-bug +++ b/misc/bash_completion/git-bug @@ -430,6 +430,26 @@ _git-bug_comment() noun_aliases=() } +_git-bug_deselect() +{ + last_command="git-bug_deselect" + + 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_label_add() { last_command="git-bug_label_add" @@ -790,6 +810,7 @@ _git-bug_root_command() commands+=("bridge") commands+=("commands") commands+=("comment") + commands+=("deselect") commands+=("label") commands+=("ls") commands+=("ls-label") diff --git a/misc/zsh_completion/git-bug b/misc/zsh_completion/git-bug index 8d2d9208..2deae548 100644 --- a/misc/zsh_completion/git-bug +++ b/misc/zsh_completion/git-bug @@ -8,7 +8,7 @@ case $state in level1) case $words[1] in git-bug) - _arguments '1: :(add bridge commands comment label ls ls-label pull push select show status termui title webui)' + _arguments '1: :(add bridge commands comment deselect label ls ls-label pull push select show status termui title webui)' ;; *) _arguments '*: :_files' @@ -17,6 +17,9 @@ case $state in ;; level2) case $words[2] in + bridge) + _arguments '2: :(configure pull rm)' + ;; comment) _arguments '2: :(add)' ;; @@ -29,9 +32,6 @@ case $state in title) _arguments '2: :(edit)' ;; - bridge) - _arguments '2: :(configure pull rm)' - ;; *) _arguments '*: :_files' ;; |