aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--commands/select.go50
-rw-r--r--doc/man/git-bug-close.129
-rw-r--r--doc/man/git-bug-new.141
-rw-r--r--doc/man/git-bug-open.129
-rw-r--r--doc/man/git-bug-select.143
-rw-r--r--doc/man/git-bug.12
-rw-r--r--doc/md/git-bug.md1
-rw-r--r--doc/md/git-bug_select.md31
-rw-r--r--misc/bash_completion/git-bug21
-rw-r--r--misc/zsh_completion/git-bug2
10 files changed, 148 insertions, 101 deletions
diff --git a/commands/select.go b/commands/select.go
new file mode 100644
index 00000000..c810b85a
--- /dev/null
+++ b/commands/select.go
@@ -0,0 +1,50 @@
+package commands
+
+import (
+ "errors"
+ "fmt"
+
+ "github.com/MichaelMure/git-bug/cache"
+ "github.com/MichaelMure/git-bug/commands/select"
+ "github.com/spf13/cobra"
+)
+
+func runSelect(cmd *cobra.Command, args []string) error {
+ if len(args) == 0 {
+ return errors.New("You must provide a bug id")
+ }
+
+ backend, err := cache.NewRepoCache(repo)
+ if err != nil {
+ return err
+ }
+ defer backend.Close()
+
+ prefix := args[0]
+
+ b, err := backend.ResolveBugPrefix(prefix)
+ if err != nil {
+ return err
+ }
+
+ _select.Select(backend, b.Id())
+
+ fmt.Printf("selected bug %s: %s\n", b.HumanId(), b.Snapshot().Title)
+
+ return nil
+}
+
+var selectCmd = &cobra.Command{
+ Use: "select [<id>]",
+ Short: "Select a bug for implicit use in future commands",
+ Example: `git bug select 2f15
+git bug comment
+git bug status
+`,
+ RunE: runSelect,
+}
+
+func init() {
+ RootCmd.AddCommand(selectCmd)
+ selectCmd.Flags().SortFlags = false
+}
diff --git a/doc/man/git-bug-close.1 b/doc/man/git-bug-close.1
deleted file mode 100644
index 4b7157f8..00000000
--- a/doc/man/git-bug-close.1
+++ /dev/null
@@ -1,29 +0,0 @@
-.TH "GIT-BUG" "1" "Sep 2018" "Generated from git-bug's source code" ""
-.nh
-.ad l
-
-
-.SH NAME
-.PP
-git\-bug\-close \- Mark the bug as closed
-
-
-.SH SYNOPSIS
-.PP
-\fBgit\-bug 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(1)\fP
diff --git a/doc/man/git-bug-new.1 b/doc/man/git-bug-new.1
deleted file mode 100644
index f963ea57..00000000
--- a/doc/man/git-bug-new.1
+++ /dev/null
@@ -1,41 +0,0 @@
-.TH "GIT-BUG" "1" "Sep 2018" "Generated from git-bug's source code" ""
-.nh
-.ad l
-
-
-.SH NAME
-.PP
-git\-bug\-new \- Create a new bug
-
-
-.SH SYNOPSIS
-.PP
-\fBgit\-bug new [flags]\fP
-
-
-.SH DESCRIPTION
-.PP
-Create a new bug
-
-
-.SH OPTIONS
-.PP
-\fB\-t\fP, \fB\-\-title\fP=""
- Provide a title to describe the issue
-
-.PP
-\fB\-m\fP, \fB\-\-message\fP=""
- Provide a message to describe the issue
-
-.PP
-\fB\-F\fP, \fB\-\-file\fP=""
- Take the message from the given file. Use \- to read the message from the standard input
-
-.PP
-\fB\-h\fP, \fB\-\-help\fP[=false]
- help for new
-
-
-.SH SEE ALSO
-.PP
-\fBgit\-bug(1)\fP
diff --git a/doc/man/git-bug-open.1 b/doc/man/git-bug-open.1
deleted file mode 100644
index 8cd433b6..00000000
--- a/doc/man/git-bug-open.1
+++ /dev/null
@@ -1,29 +0,0 @@
-.TH "GIT-BUG" "1" "Sep 2018" "Generated from git-bug's source code" ""
-.nh
-.ad l
-
-
-.SH NAME
-.PP
-git\-bug\-open \- Mark the bug as open
-
-
-.SH SYNOPSIS
-.PP
-\fBgit\-bug 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(1)\fP
diff --git a/doc/man/git-bug-select.1 b/doc/man/git-bug-select.1
new file mode 100644
index 00000000..f73582fa
--- /dev/null
+++ b/doc/man/git-bug-select.1
@@ -0,0 +1,43 @@
+.TH "GIT-BUG" "1" "Sep 2018" "Generated from git-bug's source code" ""
+.nh
+.ad l
+
+
+.SH NAME
+.PP
+git\-bug\-select \- Select a bug for implicit use in future commands
+
+
+.SH SYNOPSIS
+.PP
+\fBgit\-bug select [<id>] [flags]\fP
+
+
+.SH DESCRIPTION
+.PP
+Select a bug for implicit use in future commands
+
+
+.SH OPTIONS
+.PP
+\fB\-h\fP, \fB\-\-help\fP[=false]
+ help for select
+
+
+.SH EXAMPLE
+.PP
+.RS
+
+.nf
+git bug select 2f15
+git bug comment
+git bug status
+
+
+.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 adcdd999..ae56f4a2 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\-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
+\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\-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 6825f481..f38c3c36 100644
--- a/doc/md/git-bug.md
+++ b/doc/md/git-bug.md
@@ -27,6 +27,7 @@ git-bug [flags]
* [git-bug ls](git-bug_ls.md) - List bugs
* [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 select](git-bug_select.md) - Select a bug for implicit use in future commands
* [git-bug show](git-bug_show.md) - Display the details of a bug
* [git-bug status](git-bug_status.md) - Show the bug status
* [git-bug termui](git-bug_termui.md) - Launch the terminal UI
diff --git a/doc/md/git-bug_select.md b/doc/md/git-bug_select.md
new file mode 100644
index 00000000..014ba512
--- /dev/null
+++ b/doc/md/git-bug_select.md
@@ -0,0 +1,31 @@
+## git-bug select
+
+Select a bug for implicit use in future commands
+
+### Synopsis
+
+Select a bug for implicit use in future commands
+
+```
+git-bug select [<id>] [flags]
+```
+
+### Examples
+
+```
+git bug select 2f15
+git bug comment
+git bug status
+
+```
+
+### Options
+
+```
+ -h, --help help for select
+```
+
+### SEE ALSO
+
+* [git-bug](git-bug.md) - A bugtracker embedded in Git
+
diff --git a/misc/bash_completion/git-bug b/misc/bash_completion/git-bug
index d0613dc7..9d8482c8 100644
--- a/misc/bash_completion/git-bug
+++ b/misc/bash_completion/git-bug
@@ -487,6 +487,26 @@ _git-bug_push()
noun_aliases=()
}
+_git-bug_select()
+{
+ last_command="git-bug_select"
+
+ 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_show()
{
last_command="git-bug_show"
@@ -670,6 +690,7 @@ _git-bug_root_command()
commands+=("ls")
commands+=("pull")
commands+=("push")
+ commands+=("select")
commands+=("show")
commands+=("status")
commands+=("termui")
diff --git a/misc/zsh_completion/git-bug b/misc/zsh_completion/git-bug
index 35506b76..4ad6663a 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 commands comment label ls pull push show status termui title webui)'
+ _arguments '1: :(add commands comment label ls pull push select show status termui title webui)'
;;
*)
_arguments '*: :_files'