completion: Finish args
This commit is contained in:
parent
39333ad0cb
commit
fb5d20a9c4
2 changed files with 3 additions and 7 deletions
|
@ -4,19 +4,15 @@
|
||||||
shopt -s nullglob
|
shopt -s nullglob
|
||||||
|
|
||||||
_neofetch_completions() {
|
_neofetch_completions() {
|
||||||
local flags cur prev
|
local cur prev
|
||||||
|
|
||||||
# User input.
|
# User input.
|
||||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||||
|
|
||||||
# Generate a list of flags.
|
|
||||||
IFS=$'\n' read -d "" -ra flags \
|
|
||||||
< <(neofetch --help | awk '/^ --/{print $1}')
|
|
||||||
|
|
||||||
# Complete partial matches.
|
# Complete partial matches.
|
||||||
IFS=$'\n' read -d "" -ra COMPREPLY \
|
IFS=$'\n' read -d "" -ra COMPREPLY \
|
||||||
< <(compgen -W "${flags[*]}" -- "$cur")
|
< <(compgen -W "$(neofetch -h | awk '/^ --/{printf $1" "}')" -- "$cur")
|
||||||
|
|
||||||
case "$prev" in
|
case "$prev" in
|
||||||
"--disable")
|
"--disable")
|
||||||
|
|
2
neofetch
2
neofetch
|
@ -4705,7 +4705,7 @@ get_args() {
|
||||||
"-v") verbose="on" ;;
|
"-v") verbose="on" ;;
|
||||||
"--print_config") printf "%s\\n" "$config"; exit ;;
|
"--print_config") printf "%s\\n" "$config"; exit ;;
|
||||||
"-vv") set -x; verbose="on" ;;
|
"-vv") set -x; verbose="on" ;;
|
||||||
"--help") usage ;;
|
"-h"|"--help") usage ;;
|
||||||
"--version")
|
"--version")
|
||||||
printf "%s\\n" "Neofetch $version"
|
printf "%s\\n" "Neofetch $version"
|
||||||
exit 1
|
exit 1
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue