Skip to content

Commit ff65882

Browse files
committed
gpgv: New completion
1 parent bdd6458 commit ff65882

File tree

5 files changed

+78
-0
lines changed

5 files changed

+78
-0
lines changed

completions/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ gmake
5959
gmplayer
6060
gnumake
6161
gpc
62+
gpgv2
6263
hciattach
6364
hciconfig
6465
hd

completions/Makefile.am

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ bashcomp_DATA = 2to3 \
129129
gpasswd \
130130
gpg \
131131
gpg2 \
132+
gpgv \
132133
gphoto2 \
133134
gprof \
134135
groupadd \
@@ -517,6 +518,7 @@ CLEANFILES = \
517518
gmplayer \
518519
gnumake \
519520
gpc \
521+
gpgv2 \
520522
hciattach \
521523
hciconfig \
522524
hd \
@@ -785,6 +787,10 @@ symlinks: $(targetdir) $(DATA)
785787
rm -f $(targetdir)/$$file && \
786788
$(LN_S) gkrellm $(targetdir)/$$file ; \
787789
done
790+
for file in gpgv2 ; do \
791+
rm -f $(targetdir)/$$file && \
792+
$(LN_S) gpgv $(targetdir)/$$file ; \
793+
done
788794
for file in pigz ; do \
789795
rm -f $(targetdir)/$$file && \
790796
$(LN_S) gzip $(targetdir)/$$file ; \

completions/gpgv

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# gpgv(1) completion -*- shell-script -*-
2+
3+
_gpgv()
4+
{
5+
local cur prev words cword
6+
_init_completion || return
7+
8+
case $prev in
9+
--help|--version|--weak-digest|--*-fd|-!(-*)[?h]*)
10+
return
11+
;;
12+
--keyring)
13+
_filedir "@(gpg|kbx)"
14+
return
15+
;;
16+
--homedir)
17+
_filedir -d
18+
return
19+
;;
20+
esac
21+
22+
local args
23+
_count_args "" "--@(weak-digest|*-fd|keyring|homedir)"
24+
25+
if [[ $cur == -* && $args -eq 1 ]]; then
26+
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
27+
return
28+
fi
29+
30+
if [[ $args -gt 1 ]]; then
31+
if [[ ${COMP_LINE,,} == *.@(asc|sig|sign)\ * ]]; then
32+
# Detached signature, only complete one arbitrary file arg and -
33+
if [[ $args -eq 2 ]]; then
34+
COMPREPLY=( $( compgen -W '-' -- "$cur" ) )
35+
_filedir
36+
fi
37+
else
38+
_filedir gpg
39+
fi
40+
else
41+
_filedir "@(asc|gpg|sig|sign)"
42+
fi
43+
} &&
44+
complete -F _gpgv gpgv gpgv2
45+
46+
# ex: filetype=sh

test/completion/gpgv.exp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
assert_source_completions gpgv

test/lib/completions/gpgv.exp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
proc setup {} {
2+
save_env
3+
}
4+
5+
6+
proc teardown {} {
7+
assert_env_unmodified
8+
}
9+
10+
11+
setup
12+
13+
14+
assert_complete_any "gpgv "
15+
sync_after_int
16+
17+
assert_complete_any "gpgv -"
18+
sync_after_int
19+
20+
assert_no_complete "gpgv foo.sig foo "
21+
sync_after_int
22+
23+
24+
teardown

0 commit comments

Comments
 (0)