diff --git a/.gitignore b/.gitignore index be1fc3f1c79365fda767169a31550b13d22bf273..c61d1233896a273a3cdfcc20a8af53b2d14b964c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,8 @@ git-bug -!/misc/bash_completion/git-bug -!/misc/fish_completion/git-bug -!/misc/powershell_completion/git-bug -!/misc/zsh_completion/git-bug +!/misc/completion/bash/git-bug +!/misc/completion/fish/git-bug +!/misc/completion/powershell/git-bug +!/misc/completion/zsh/git-bug .gitkeep dist coverage.txt diff --git a/README.md b/README.md index 8c51d6d584e324baab784d05dadbfe6dcb3d9b0a..323e4391f6a9a5d7e2d490671f4be9ea1e4d582e 100644 --- a/README.md +++ b/README.md @@ -272,9 +272,7 @@ Interested by how it works ? Have a look at the [data model](doc/model.md) and t ## Misc -- [Bash completion](misc/bash_completion) -- [Zsh completion](misc/zsh_completion) -- [PowerShell completion](misc/powershell_completion) +- [Bash, Zsh, fish, powershell completion](misc/completion) - [ManPages](doc/man) ## Planned features diff --git a/git-bug.go b/git-bug.go index 995fc559da14b53db37962fd40f5c66b17171caf..99fe81c5a20ec5ddc206567c03f219e8f2a93fe7 100644 --- a/git-bug.go +++ b/git-bug.go @@ -1,5 +1,5 @@ //go:generate go run doc/gen_docs.go -//go:generate go run misc/gen_completion.go +//go:generate go run misc/completion/gen_completion.go package main diff --git a/misc/bash_completion/git-bug b/misc/completion/bash/git-bug similarity index 99% rename from misc/bash_completion/git-bug rename to misc/completion/bash/git-bug index 85d2a15b7a471710879968c8f0a40d3ba8f02a42..92b90d3cc2ef4486ba3f3e48091e98ccb9c5a02d 100644 --- a/misc/bash_completion/git-bug +++ b/misc/completion/bash/git-bug @@ -287,6 +287,8 @@ fi # ex: ts=4 sw=4 et filetype=sh +# Custom bash code to connect the git completion for "git bug" to the +# git-bug completion for "git-bug" _git_bug() { local cur prev words cword split diff --git a/misc/fish_completion/git-bug b/misc/completion/fish/git-bug similarity index 100% rename from misc/fish_completion/git-bug rename to misc/completion/fish/git-bug diff --git a/misc/gen_completion.go b/misc/completion/gen_completion.go similarity index 87% rename from misc/gen_completion.go rename to misc/completion/gen_completion.go index 1f86124df9fc262f3ca5255b61ef2da3f70af9d1..5f64383246b0e63a070f17432132e2ad09cea208 100644 --- a/misc/gen_completion.go +++ b/misc/completion/gen_completion.go @@ -44,13 +44,15 @@ func genBash(root *cobra.Command) error { if err != nil { return err } - f, err := os.Create(filepath.Join(cwd, "misc", "bash_completion", "git-bug")) + f, err := os.Create(filepath.Join(cwd, "misc", "completion", "bash", "git-bug")) if err != nil { return err } defer f.Close() const patch = ` +# Custom bash code to connect the git completion for "git bug" to the +# git-bug completion for "git-bug" _git_bug() { local cur prev words cword split @@ -102,7 +104,7 @@ func genFish(root *cobra.Command) error { if err != nil { return err } - dir := filepath.Join(cwd, "misc", "fish_completion", "git-bug") + dir := filepath.Join(cwd, "misc", "completion", "fish", "git-bug") return root.GenFishCompletionFile(dir, true) } @@ -111,7 +113,7 @@ func genPowerShell(root *cobra.Command) error { if err != nil { return err } - path := filepath.Join(cwd, "misc", "powershell_completion", "git-bug") + path := filepath.Join(cwd, "misc", "completion", "powershell", "git-bug") return root.GenPowerShellCompletionFile(path) } @@ -120,6 +122,6 @@ func genZsh(root *cobra.Command) error { if err != nil { return err } - path := filepath.Join(cwd, "misc", "zsh_completion", "git-bug") + path := filepath.Join(cwd, "misc", "completion", "zsh", "git-bug") return root.GenZshCompletionFile(path) } diff --git a/misc/powershell_completion/git-bug b/misc/completion/powershell/git-bug similarity index 100% rename from misc/powershell_completion/git-bug rename to misc/completion/powershell/git-bug diff --git a/misc/zsh_completion/git-bug b/misc/completion/zsh/git-bug similarity index 100% rename from misc/zsh_completion/git-bug rename to misc/completion/zsh/git-bug