commit c79361ba99d01a2a3d2885a9ddd7f6c492e9e5e5
parent 5df912f036039fc825352e1b047521b47faa5508
Author: Sean Enck <sean@ttypty.com>
Date: Sun, 7 Sep 2025 10:10:01 -0400
clean up some totp completion verbosity
Diffstat:
3 files changed, 3 insertions(+), 10 deletions(-)
diff --git a/internal/app/completions/core_test.go b/internal/app/completions/core_test.go
@@ -52,7 +52,7 @@ func TestFeatures(t *testing.T) {
without int
}
for k := range tests {
- for _, feature := range []counts{{"clip", 5, 1}, {"totp", 9, 1}} {
+ for _, feature := range []counts{{"clip", 5, 1}} {
store.Clear()
key := fmt.Sprintf("LOCKBOX_FEATURE_%s", strings.ToUpper(feature.cmd))
store.SetBool(key, true)
@@ -65,9 +65,6 @@ func TestFeatures(t *testing.T) {
func testCompletionFeature(t *testing.T, completionMode, cmd string, expect int) {
e := expect
- if cmd == "totp" && completionMode == "bash" {
- e++
- }
v, _ := completions.Generate(completionMode, "lb")
if cnt := strings.Count(strings.Join(v, "\n"), cmd); cnt != e {
t.Errorf("completion mismatch %s: %d != %d (%s)", completionMode, cnt, expect, cmd)
diff --git a/internal/app/completions/shell/bash.sh b/internal/app/completions/shell/bash.sh
@@ -50,11 +50,9 @@ _{{ $.Executable }}() {
;;
"{{ $.TOTPCommand }}")
case "${COMP_WORDS[2]}" in
-{{- range $key, $value := $.TOTPSubCommands }}
- "{{ $value }}")
+ {{range $key, $value := $.TOTPSubCommands }}{{ if gt $key 0 }} | {{end}}"{{ $value }}"{{end}})
opts=$({{ $.DoTOTPList }})
;;
-{{- end}}
esac
;;
esac
diff --git a/internal/app/completions/shell/zsh.sh b/internal/app/completions/shell/zsh.sh
@@ -70,11 +70,9 @@ _{{ $.Executable }}() {
;;
4)
case $words[3] in
-{{- range $key, $value := .TOTPSubCommands }}
- "{{ $value }}")
+ {{range $key, $value := $.TOTPSubCommands }}{{ if gt $key 0 }} | {{end}}"{{ $value }}"{{end}})
compadd "$@" $({{ $.DoTOTPList }})
;;
-{{- end}}
esac
esac
;;