completion: Rename to shell completion (#167)

We expect a 'shell prompt' command in the future
that could be used in a shell prompt.

Put completion under the same namespace instead of polluting top level.
This commit is contained in:
Abhinav Gupta
2024-06-08 09:22:45 -07:00
committed by GitHub
parent 193658a0e1
commit 91ed7eea3c
5 changed files with 23 additions and 17 deletions
@@ -0,0 +1,3 @@
kind: Changed
body: (*Breaking*) Rename `completion` to `shell completion`. Other shell helpers are expected in the future.
time: 2024-06-08T09:16:34.91796-07:00
+7 -8
View File
@@ -14,27 +14,26 @@ gs (git-spice) is a command line tool for stacking Git branches.
* `-C`, `--dir=DIR`: Change to DIR before doing anything
* `--[no-]prompt`: Whether to prompt for missing information
## gs completion
## gs shell completion
```
gs completion <shell> [flags]
gs shell completion <shell>
```
Generate shell completion script
Generates shell completion scripts.
To install the script, add the output of this command to your
shell's rc file.
For example:
To install the script, add the following line to your shell's
rc file.
# bash
gs completion bash >> ~/.bashrc
eval "$(gs shell completion bash)"
# zsh
gs completion zsh >> ~/.zshrc
eval "$(gs shell completion zsh)"
# fish
gs completion fish >> ~/.config/fish/config.fish
eval "$(gs shell completion fish)"
**Arguments**
+1 -1
View File
@@ -188,7 +188,7 @@ type globalOptions struct {
type mainCmd struct {
globalOptions `group:"globals"`
Completion completionCmd `cmd:"" group:"Setup" help:"Generate shell completion script"`
Shell shellCmd `cmd:"" group:"Shell"`
Repo repoCmd `cmd:"" aliases:"r" group:"Repository"`
Log logCmd `cmd:"" aliases:"l" group:"Log"`
+5
View File
@@ -0,0 +1,5 @@
package main
type shellCmd struct {
Completion shellCompletionCmd `cmd:"" help:"Generate shell completion script"`
}
+7 -8
View File
@@ -11,25 +11,24 @@ import (
"go.abhg.dev/gs/internal/text"
)
type completionCmd struct {
type shellCompletionCmd struct {
*komplete.Command `embed:""`
}
func (c *completionCmd) Help() string {
func (c *shellCompletionCmd) Help() string {
return text.Dedent(`
Generates shell completion scripts.
To install the script, add the output of this command to your
shell's rc file.
For example:
To install the script, add the following line to your shell's
rc file.
# bash
gs completion bash >> ~/.bashrc
eval "$(gs shell completion bash)"
# zsh
gs completion zsh >> ~/.zshrc
eval "$(gs shell completion zsh)"
# fish
gs completion fish >> ~/.config/fish/config.fish
eval "$(gs shell completion fish)"
`)
}