Skip to content

Commit

Permalink
geoiplookup: New completion
Browse files Browse the repository at this point in the history
  • Loading branch information
scop committed Jan 27, 2018
1 parent b547f22 commit 7c7dfe8
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 0 deletions.
1 change: 1 addition & 0 deletions completions/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ g4
g77
g95
gcj
geoiplookup6
gfortran
gkrellm2
gmake
Expand Down
6 changes: 6 additions & 0 deletions completions/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ bashcomp_DATA = 2to3 \
genaliases \
gendiff \
genisoimage \
geoiplookup \
getconf \
getent \
gkrellm \
Expand Down Expand Up @@ -497,6 +498,7 @@ CLEANFILES = \
g77 \
g95 \
gcj \
geoiplookup6 \
gfortran \
gkrellm2 \
gmake \
Expand Down Expand Up @@ -753,6 +755,10 @@ symlinks: $(targetdir) $(DATA)
rm -f $(targetdir)/$$file && \
$(LN_S) genisoimage $(targetdir)/$$file ; \
done
for file in geoiplookup6 ; do \
rm -f $(targetdir)/$$file && \
$(LN_S) geoiplookup $(targetdir)/$$file ; \
done
for file in gkrellm2 ; do \
rm -f $(targetdir)/$$file && \
$(LN_S) gkrellm $(targetdir)/$$file ; \
Expand Down
33 changes: 33 additions & 0 deletions completions/geoiplookup
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# geoiplookup(1) completion -*- shell-script -*-

_geoiplookup()
{
local cur prev words cword
_init_completion || return

case $prev in
-h|-'?'|-v)
return
;;
-d)
_filedir -d
return
;;
-f)
_filedir dat
return
;;
esac

if [[ $cur == -* ]]; then
COMPREPLY=( $( compgen -W '$( _parse_usage "$1" -h )' -- "$cur" ) )
return
fi

local ipvx
[[ $1 == *6 ]] && ipvx=-6 || ipvx=-4
_known_hosts_real $ipvx -- "$cur"
} &&
complete -F _geoiplookup geoiplookup geoiplookup6

# ex: filetype=sh
1 change: 1 addition & 0 deletions test/completion/geoiplookup.exp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
assert_source_completions geoiplookup
18 changes: 18 additions & 0 deletions test/lib/completions/geoiplookup.exp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
proc setup {} {
save_env
}


proc teardown {} {
assert_env_unmodified
}


setup


assert_complete_any "geoiplookup -"
sync_after_int


teardown

0 comments on commit 7c7dfe8

Please sign in to comment.