[PATCH 3/3] shell completion: complete -q/--qrcode option to show/generate

Johannes Altmanninger aclopte at gmail.com
Fri Apr 17 14:39:52 UTC 2026


Test case:

	fish -c 'complete -C"pass -"' | grep qrcode
---
 src/completion/pass.bash-completion | 4 ++--
 src/completion/pass.fish-completion | 2 ++
 src/completion/pass.zsh-completion  | 6 +++++-
 3 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/completion/pass.bash-completion b/src/completion/pass.bash-completion
index 2d23cbf..e73fe90 100644
--- a/src/completion/pass.bash-completion
+++ b/src/completion/pass.bash-completion
@@ -101,7 +101,7 @@ _pass()
 				_pass_complete_entries
 				;;
 			show|-*)
-				COMPREPLY+=($(compgen -W "-c --clip" -- ${cur}))
+				COMPREPLY+=($(compgen -W "-c --clip -q --qrcode" -- ${cur}))
 				_pass_complete_entries 1
 				;;
 			insert)
@@ -109,7 +109,7 @@ _pass()
 				_pass_complete_entries
 				;;
 			generate)
-				COMPREPLY+=($(compgen -W "-n --no-symbols -c --clip -f --force -i --in-place" -- ${cur}))
+				COMPREPLY+=($(compgen -W "-n --no-symbols -c --clip -f --force -i --in-place -q --qrcode" -- ${cur}))
 				_pass_complete_entries
 				;;
 			cp|copy|mv|rename)
diff --git a/src/completion/pass.fish-completion b/src/completion/pass.fish-completion
index 4b43998..9dc3584 100644
--- a/src/completion/pass.fish-completion
+++ b/src/completion/pass.fish-completion
@@ -80,6 +80,7 @@ complete -c $PROG -f -n '__fish_pass_uses_command generate' -s n -l no-symbols -
 complete -c $PROG -f -n '__fish_pass_uses_command generate' -s c -l clip -d 'Put the password in clipboard'
 complete -c $PROG -f -n '__fish_pass_uses_command generate' -s f -l force -d 'Do not prompt before overwritting'
 complete -c $PROG -f -n '__fish_pass_uses_command generate' -s i -l in-place -d 'Replace only the first line with the generated password'
+complete -c $PROG -f -n '__fish_pass_uses_command generate' -s q -l qrcode -d 'Display the password as QR code'
 complete -c $PROG -f -n '__fish_pass_uses_command generate' -a "(__fish_pass_print_entry_dirs)"
 
 complete -c $PROG -f -n '__fish_pass_needs_command' -a mv -d 'Command: rename existing password'
@@ -102,6 +103,7 @@ complete -c $PROG -f -n '__fish_pass_needs_command' -a show -d 'Command: show ex
 # When no command is given, `show` is defaulted.
 set --local uses_show_command '__fish_pass_uses_command --regex -- "^(?:show|-.*)\$"'
 complete -c $PROG -f -n "$uses_show_command || __fish_pass_needs_command" -s c -l clip -d 'Put password in clipboard'
+complete -c $PROG -f -n "$uses_show_command || __fish_pass_needs_command" -s q -l qrcode -d 'Display password as QR code'
 complete -c $PROG -f -n "$uses_show_command || __fish_pass_needs_command" -a "(__fish_pass_print_entries)"
 
 complete -c $PROG -f -n '__fish_pass_needs_command' -a git -d 'Command: execute a git command'
diff --git a/src/completion/pass.zsh-completion b/src/completion/pass.zsh-completion
index d911e12..0eef548 100644
--- a/src/completion/pass.zsh-completion
+++ b/src/completion/pass.zsh-completion
@@ -52,6 +52,8 @@ _pass () {
 					"--no-symbols[don't include symbols in password]" \
 					"-c[copy password to the clipboard]" \
 					"--clip[copy password to the clipboard]" \
+					"-q[display password as QR code]" \
+					"--qrcode[display password as QR code]" \
 					"-f[force overwrite]" \
 					"--force[force overwrite]" \
 					"-i[replace first line]" \
@@ -117,7 +119,9 @@ _pass () {
 _pass_cmd_show () {
 	_arguments : \
 		"-c[put it on the clipboard]" \
-		"--clip[put it on the clipboard]"
+		"--clip[put it on the clipboard]" \
+		"-q[display as QR code]" \
+		"--qrcode[display as QR code]"
 	_pass_complete_entries
 }
 _pass_complete_entries_helper () {
-- 
2.54.0.rc2.1.gf65aba1e87



More information about the Password-Store mailing list