summaryrefslogtreecommitdiff
path: root/completion/completion.go
diff options
context:
space:
mode:
authorewy <ewy0@protonmail.com>2026-05-17 02:13:25 +0200
committerewy <ewy0@protonmail.com>2026-05-17 02:13:25 +0200
commit5cfc8bd701037a215c62789916cda283a018d3fd (patch)
treed29c1b65e69314917e15390ce43e8bba0ae2bc2d /completion/completion.go
parenteb340173fe0508240da4bb03d37a5a2fa259c2fd (diff)
add priority to version and completion to reduce start times for those modes
Diffstat (limited to 'completion/completion.go')
-rw-r--r--completion/completion.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/completion/completion.go b/completion/completion.go
index 641eb8a..9d3ae72 100644
--- a/completion/completion.go
+++ b/completion/completion.go
@@ -31,8 +31,10 @@ var completionFileByShell = map[string]string{
"zsh": ".zshrc",
}
+// AlreadyInstalledError is returned when we already found completion code in your shell rc file
var AlreadyInstalledError = errors.New("completion already installed")
+// Add finds the right file to append the completion code to and does that
func Add(shell string) error {
f := filepath.Join(paths.HomeDir.String(), completionFileByShell[shell])
content, err := os.ReadFile(f)
@@ -59,6 +61,8 @@ func successMessage(shell string, file string) {
_, _ = spool.Print("Installed completion for %s in %s\n", shell, file)
}
+// Echo prints the actual completion script
+// because it is baked in with the program it should always be version-appropriate
func Echo() error {
_, err := spool.Print("%s", completionCode)
return err