completion: Finish args
This commit is contained in:
parent
a1bf937fd8
commit
39333ad0cb
1 changed files with 5 additions and 5 deletions
|
@ -4,19 +4,19 @@
|
||||||
shopt -s nullglob
|
shopt -s nullglob
|
||||||
|
|
||||||
_neofetch_completions() {
|
_neofetch_completions() {
|
||||||
local flags cur prev usage
|
local flags cur prev
|
||||||
|
|
||||||
usage="$(neofetch --help)"
|
|
||||||
|
|
||||||
# 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.
|
# Generate a list of flags.
|
||||||
IFS=$'\n' read -d "" -ra flags < <(awk '/^ --/{print $1}' <<< "$usage")
|
IFS=$'\n' read -d "" -ra flags \
|
||||||
|
< <(neofetch --help | awk '/^ --/{print $1}')
|
||||||
|
|
||||||
# Complete partial matches.
|
# Complete partial matches.
|
||||||
IFS=$'\n' read -d "" -ra COMPREPLY < <(compgen -W "${flags[*]}" -- "$cur")
|
IFS=$'\n' read -d "" -ra COMPREPLY \
|
||||||
|
< <(compgen -W "${flags[*]}" -- "$cur")
|
||||||
|
|
||||||
case "$prev" in
|
case "$prev" in
|
||||||
"--disable")
|
"--disable")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue