commit 5df912f036039fc825352e1b047521b47faa5508
parent 73dfc499bfb73b51661e161aa24ba858373414b3
Author: Sean Enck <sean@ttypty.com>
Date: Sun, 7 Sep 2025 10:05:05 -0400
completions have got a bit verbose/duplicative, fixing
Diffstat:
2 files changed, 5 insertions(+), 17 deletions(-)
diff --git a/internal/app/completions/shell/bash.sh b/internal/app/completions/shell/bash.sh
@@ -16,9 +16,7 @@ _{{ $.Executable }}() {
chosen=${COMP_WORDS[1]}
found=0
{{- range $idx, $value := $.Options }}
- if [ "$chosen" == "{{ $value }}" ]; then
- found=1
- fi
+ [ "$chosen" == "{{ $value }}" ] && found=1
{{- end}}
if [ "$found" -eq 0 ]; then
return
@@ -34,8 +32,8 @@ _{{ $.Executable }}() {
"{{ $.InsertCommand }}")
opts="$opts $({{ $.DoFields }})"
;;
- "{{ $.UnsetCommand }}")
- opts="$opts $({{ $.DoList }})"
+ "{{ $.UnsetCommand }}" | "{{ $.ShowCommand }}" | "{{ $.JSONCommand }}" | "{{ $.ClipCommand }}")
+ opts=$({{ $.DoList }})
;;
"{{ $.TOTPCommand }}")
opts="{{ $.TOTPListCommand }} "
@@ -43,9 +41,6 @@ _{{ $.Executable }}() {
opts="$opts {{ $value }}"
{{- end}}
;;
- "{{ $.ShowCommand }}" | "{{ $.JSONCommand }}" | "{{ $.ClipCommand }}")
- opts=$({{ $.DoList }})
- ;;
esac
else
if [ "$COMP_CWORD" -eq 3 ]; then
diff --git a/internal/app/completions/shell/zsh.sh b/internal/app/completions/shell/zsh.sh
@@ -26,9 +26,7 @@ _{{ $.Executable }}() {
chosen=$words[2]
found=0
{{- range $idx, $value := $.Options }}
- if [[ "$chosen" == "{{ $value }}" ]]; then
- found=1
- fi
+ [[ "$chosen" == "{{ $value }}" ]] && found=1
{{- end }}
if [ "$found" -eq 0 ]; then
return
@@ -50,7 +48,7 @@ _{{ $.Executable }}() {
compadd "$@" $({{ $.DoFields }})
fi
;;
- "{{ $.UnsetCommand }}")
+ "{{ $.UnsetCommand }}" | "{{ $.ShowCommand }}" | "{{ $.JSONCommand }}" | "{{ $.ClipCommand }}")
if [ "$len" -eq 3 ]; then
compadd "$@" $({{ $.DoList }})
fi
@@ -80,11 +78,6 @@ _{{ $.Executable }}() {
esac
esac
;;
- "{{ $.ShowCommand }}" | "{{ $.JSONCommand }}" | "{{ $.ClipCommand }}")
- if [ "$len" -eq 3 ]; then
- compadd "$@" $({{ $.DoList }})
- fi
- ;;
esac
esac
}