create_ap

create a nat-ed wifi ap
git clone git://git.2f30.org/create_ap
Log | Files | Refs | README | LICENSE

commit 9c24f50dee909e3c2405401cec7707a08774fcd1
parent 27c39948ca380ab51ef33c0bd988077758889d74
Author: Karthik K <hashken.distro@gmail.com>
Date:   Mon, 13 Apr 2015 17:24:15 +0530

Add new file that provides bash completion routine

Diffstat:
MMakefile | 1+
Abash_completion | 31+++++++++++++++++++++++++++++++
2 files changed, 32 insertions(+), 0 deletions(-)

diff --git a/Makefile b/Makefile @@ -4,3 +4,4 @@ all: install: cp create_ap /usr/bin/create_ap [ ! -d /lib/systemd/system ] || cp create_ap.service /lib/systemd/system + [ ! -d /usr/share/bash-completion/completions ] || cp bash_completion /usr/share/bash-completion/completions/create_ap diff --git a/bash_completion b/bash_completion @@ -0,0 +1,31 @@ +# +# Bash Completion routine for create_ap +# + +_create_ap() { + awk_cmd=' + ($1 ~ /^-/){ + for (i = 1; i <= NF; i++) { + if ($i ~ /,$/) { + print substr ($i, 0, length ($i)-1) + } + else { + print $i + break + } + } + } + ' + + local cur prev opts + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + opts=$("$1" --help | awk "$awk_cmd") + + COMPREPLY=( $(compgen -W "${opts}" -- $cur) ) + return 0 +} +complete -F _create_ap create_ap + +# vim: set ft=sh: