-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
dadav
committed
Apr 18, 2020
1 parent
eb76cc7
commit 2dee398
Showing
1 changed file
with
17 additions
and
0 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
builder/data/etc/bash_completion.d/pwnagotchi_completion.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
_show_complete() | ||
{ | ||
local cur prev opts node_names | ||
COMPREPLY=() | ||
cur="${COMP_WORDS[COMP_CWORD]}" | ||
cmd="${COMP_WORDS[@]:0:${#COMP_WORDS[@]}-1}" | ||
if [[ ${cur} == -* ]] ; then | ||
opts="$($cmd --help | tr ' ' '\n' | awk '/^ *-/{gsub("[^a-zA-Z0-9-]","",$1);print $1}')" | ||
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) | ||
return 0 | ||
fi | ||
|
||
opts="$($cmd --help | sed -n '/positional arguments:/ {n;p}' | tr ',' '\n' | awk '{gsub("[^a-zA-Z0-9-]", "", $1); print $1}')" | ||
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) | ||
} | ||
|
||
complete -F _show_complete pwnagotchi |