aboutsummaryrefslogtreecommitdiffstats
path: root/misc
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2020-07-28 20:24:24 +0200
committerMichael Muré <batolettre@gmail.com>2020-07-28 20:24:24 +0200
commitae5c0967cec40a7dcf9804ff592a4d15f1b26569 (patch)
tree7c1ba7626fd8158be030876d44ba55daf465d694 /misc
parent51c887ff9dd4f2a5f65d2d3de57f8a7729b1010d (diff)
downloadgit-bug-ae5c0967cec40a7dcf9804ff592a4d15f1b26569.tar.gz
commands: cleanup the command's usage to avoid warnings when generating the doc
Diffstat (limited to 'misc')
-rw-r--r--misc/bash_completion/git-bug21
-rw-r--r--misc/gen_completion.go26
-rw-r--r--misc/powershell_completion/git-bug4
-rw-r--r--misc/zsh_completion/git-bug8
4 files changed, 48 insertions, 11 deletions
diff --git a/misc/bash_completion/git-bug b/misc/bash_completion/git-bug
index 4152725f..8e2de8df 100644
--- a/misc/bash_completion/git-bug
+++ b/misc/bash_completion/git-bug
@@ -897,6 +897,26 @@ _git-bug_push()
noun_aliases=()
}
+_git-bug_rm()
+{
+ last_command="git-bug_rm"
+
+ 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_select()
{
last_command="git-bug_select"
@@ -1239,6 +1259,7 @@ _git-bug_root_command()
commands+=("ls-label")
commands+=("pull")
commands+=("push")
+ commands+=("rm")
commands+=("select")
commands+=("show")
commands+=("status")
diff --git a/misc/gen_completion.go b/misc/gen_completion.go
index 80b89902..0bc546f7 100644
--- a/misc/gen_completion.go
+++ b/misc/gen_completion.go
@@ -6,13 +6,17 @@ import (
"path"
"sync"
+ "github.com/spf13/cobra"
+
"github.com/MichaelMure/git-bug/commands"
)
func main() {
fmt.Println("Generating completion files ...")
- tasks := map[string]func() error{
+ root := commands.NewRootCommand()
+
+ tasks := map[string]func(*cobra.Command) error{
"Bash": genBash,
"Fish": genFish,
"PowerShell": genPowerShell,
@@ -22,9 +26,9 @@ func main() {
var wg sync.WaitGroup
for name, f := range tasks {
wg.Add(1)
- go func(name string, f func() error) {
+ go func(name string, f func(*cobra.Command) error) {
defer wg.Done()
- err := f()
+ err := f(root)
if err != nil {
fmt.Printf(" - %s: %v\n", name, err)
return
@@ -36,26 +40,26 @@ func main() {
wg.Wait()
}
-func genBash() error {
+func genBash(root *cobra.Command) error {
cwd, _ := os.Getwd()
dir := path.Join(cwd, "misc", "bash_completion", "git-bug")
- return commands.NewRootCommand().GenBashCompletionFile(dir)
+ return root.GenBashCompletionFile(dir)
}
-func genFish() error {
+func genFish(root *cobra.Command) error {
cwd, _ := os.Getwd()
dir := path.Join(cwd, "misc", "fish_completion", "git-bug")
- return commands.NewRootCommand().GenFishCompletionFile(dir, true)
+ return root.GenFishCompletionFile(dir, true)
}
-func genPowerShell() error {
+func genPowerShell(root *cobra.Command) error {
cwd, _ := os.Getwd()
filepath := path.Join(cwd, "misc", "powershell_completion", "git-bug")
- return commands.NewRootCommand().GenPowerShellCompletionFile(filepath)
+ return root.GenPowerShellCompletionFile(filepath)
}
-func genZsh() error {
+func genZsh(root *cobra.Command) error {
cwd, _ := os.Getwd()
filepath := path.Join(cwd, "misc", "zsh_completion", "git-bug")
- return commands.NewRootCommand().GenZshCompletionFile(filepath)
+ return root.GenZshCompletionFile(filepath)
}
diff --git a/misc/powershell_completion/git-bug b/misc/powershell_completion/git-bug
index 40831a11..c2aa0adf 100644
--- a/misc/powershell_completion/git-bug
+++ b/misc/powershell_completion/git-bug
@@ -28,6 +28,7 @@ Register-ArgumentCompleter -Native -CommandName 'git-bug' -ScriptBlock {
[CompletionResult]::new('ls-label', 'ls-label', [CompletionResultType]::ParameterValue, 'List valid labels.')
[CompletionResult]::new('pull', 'pull', [CompletionResultType]::ParameterValue, 'Pull bugs update from a git remote.')
[CompletionResult]::new('push', 'push', [CompletionResultType]::ParameterValue, 'Push bugs update to a git remote.')
+ [CompletionResult]::new('rm', 'rm', [CompletionResultType]::ParameterValue, 'Remove an existing bug.')
[CompletionResult]::new('select', 'select', [CompletionResultType]::ParameterValue, 'Select a bug for implicit use in future commands.')
[CompletionResult]::new('show', 'show', [CompletionResultType]::ParameterValue, 'Display the details of a bug.')
[CompletionResult]::new('status', 'status', [CompletionResultType]::ParameterValue, 'Display or change a bug status.')
@@ -175,6 +176,9 @@ Register-ArgumentCompleter -Native -CommandName 'git-bug' -ScriptBlock {
'git-bug;push' {
break
}
+ 'git-bug;rm' {
+ break
+ }
'git-bug;select' {
break
}
diff --git a/misc/zsh_completion/git-bug b/misc/zsh_completion/git-bug
index fbd52be5..4ae10382 100644
--- a/misc/zsh_completion/git-bug
+++ b/misc/zsh_completion/git-bug
@@ -22,6 +22,7 @@ function _git-bug {
"ls-label:List valid labels."
"pull:Pull bugs update from a git remote."
"push:Push bugs update to a git remote."
+ "rm:Remove an existing bug."
"select:Select a bug for implicit use in future commands."
"show:Display the details of a bug."
"status:Display or change a bug status."
@@ -69,6 +70,9 @@ function _git-bug {
push)
_git-bug_push
;;
+ rm)
+ _git-bug_rm
+ ;;
select)
_git-bug_select
;;
@@ -323,6 +327,10 @@ function _git-bug_push {
_arguments
}
+function _git-bug_rm {
+ _arguments
+}
+
function _git-bug_select {
_arguments
}