completion: Finish args
This commit is contained in:
parent
f8b5e3bb32
commit
530928186f
1 changed files with 384 additions and 376 deletions
|
@ -4,25 +4,29 @@
|
||||||
shopt -s nullglob
|
shopt -s nullglob
|
||||||
|
|
||||||
_neofetch_completions() {
|
_neofetch_completions() {
|
||||||
local cur prev
|
local cur prev usage
|
||||||
|
|
||||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||||
|
|
||||||
IFS=$'\n' read -d "" -ra COMPREPLY \
|
if [[ "$cur" == -* ]]; then
|
||||||
< <(compgen -W "$(neofetch -h | awk '/ --/{printf $1" "}')" -- "$cur")
|
usage="$(neofetch -h | awk '/^ --/{printf $1" "}')"
|
||||||
|
|
||||||
|
IFS=$'\n' read -d "" -ra COMPREPLY \
|
||||||
|
< <(compgen -W "$usage" -- "$cur")
|
||||||
|
|
||||||
|
else
|
||||||
case "$prev" in
|
case "$prev" in
|
||||||
"--disable")
|
"--disable")
|
||||||
conf="${HOME}/.config/neofetch/config.conf"
|
conf="${HOME}/.config/neofetch/config.conf"
|
||||||
|
|
||||||
[[ -f "$conf" ]] &&
|
[[ -f "$conf" ]] &&
|
||||||
IFS=$'\n' read -d "" -ra COMPREPLY \
|
IFS=$'\n' read -d "" -ra values \
|
||||||
< <(awk '/ info /&&!a[$0]++{print $NF}' "$conf")
|
< <(awk '/ info /&&!a[$0]++{print $NF}' "$conf")
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"--backend")
|
"--backend")
|
||||||
COMPREPLY=(
|
values=(
|
||||||
"ascii"
|
"ascii"
|
||||||
"caca"
|
"caca"
|
||||||
"iterm2"
|
"iterm2"
|
||||||
|
@ -58,14 +62,14 @@ _neofetch_completions() {
|
||||||
"--color_blocks"|\
|
"--color_blocks"|\
|
||||||
"--bar_border"|\
|
"--bar_border"|\
|
||||||
"--ascii_bold")
|
"--ascii_bold")
|
||||||
COMPREPLY=(
|
values=(
|
||||||
"on"
|
"on"
|
||||||
"off"
|
"off"
|
||||||
)
|
)
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"--speed_type")
|
"--speed_type")
|
||||||
COMPREPLY=(
|
values=(
|
||||||
"current"
|
"current"
|
||||||
"min"
|
"min"
|
||||||
"max"
|
"max"
|
||||||
|
@ -77,7 +81,7 @@ _neofetch_completions() {
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"--cpu_cores")
|
"--cpu_cores")
|
||||||
COMPREPLY=(
|
values=(
|
||||||
"logical"
|
"logical"
|
||||||
"physical"
|
"physical"
|
||||||
"off"
|
"off"
|
||||||
|
@ -85,7 +89,7 @@ _neofetch_completions() {
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"--cpu_temp")
|
"--cpu_temp")
|
||||||
COMPREPLY=(
|
values=(
|
||||||
"C"
|
"C"
|
||||||
"F"
|
"F"
|
||||||
"off"
|
"off"
|
||||||
|
@ -93,7 +97,7 @@ _neofetch_completions() {
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"--gpu_type")
|
"--gpu_type")
|
||||||
COMPREPLY=(
|
values=(
|
||||||
"all"
|
"all"
|
||||||
"dedicated"
|
"dedicated"
|
||||||
"integrated"
|
"integrated"
|
||||||
|
@ -101,14 +105,14 @@ _neofetch_completions() {
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"--disk_show")
|
"--disk_show")
|
||||||
COMPREPLY=(
|
values=(
|
||||||
"/dev/sd"*
|
"/dev/sd"*
|
||||||
"/"
|
"/"
|
||||||
)
|
)
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"--disk_subtitle")
|
"--disk_subtitle")
|
||||||
COMPREPLY=(
|
values=(
|
||||||
"name"
|
"name"
|
||||||
"mount"
|
"mount"
|
||||||
"dir"
|
"dir"
|
||||||
|
@ -116,20 +120,20 @@ _neofetch_completions() {
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"--ip_host")
|
"--ip_host")
|
||||||
COMPREPLY=(
|
values=(
|
||||||
"http://ident.me"
|
"http://ident.me"
|
||||||
)
|
)
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"--song_format")
|
"--song_format")
|
||||||
COMPREPLY=(
|
values=(
|
||||||
"\"%artist% - %album% - %title%\""
|
"\"%artist% - %album% - %title%\""
|
||||||
"\"%artist - %title\""
|
"\"%artist - %title\""
|
||||||
)
|
)
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"--music_player")
|
"--music_player")
|
||||||
COMPREPLY=(
|
values=(
|
||||||
"amarok"
|
"amarok"
|
||||||
"audacious"
|
"audacious"
|
||||||
"banshee"
|
"banshee"
|
||||||
|
@ -165,14 +169,14 @@ _neofetch_completions() {
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"--install_time_format")
|
"--install_time_format")
|
||||||
COMPREPLY=(
|
values=(
|
||||||
"12h"
|
"12h"
|
||||||
"24h"
|
"24h"
|
||||||
)
|
)
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"--underline_char")
|
"--underline_char")
|
||||||
COMPREPLY=(
|
values=(
|
||||||
"_"
|
"_"
|
||||||
"-"
|
"-"
|
||||||
"."
|
"."
|
||||||
|
@ -184,7 +188,7 @@ _neofetch_completions() {
|
||||||
"--block_width"|\
|
"--block_width"|\
|
||||||
"--block_height"|\
|
"--block_height"|\
|
||||||
"--bar_length")
|
"--bar_length")
|
||||||
COMPREPLY=(
|
values=(
|
||||||
{1..9}
|
{1..9}
|
||||||
)
|
)
|
||||||
;;
|
;;
|
||||||
|
@ -193,7 +197,7 @@ _neofetch_completions() {
|
||||||
"--memory_display"|\
|
"--memory_display"|\
|
||||||
"--battery_display"|\
|
"--battery_display"|\
|
||||||
"--disk_display")
|
"--disk_display")
|
||||||
COMPREPLY=(
|
values=(
|
||||||
"bar"
|
"bar"
|
||||||
"infobar"
|
"infobar"
|
||||||
"barinfo"
|
"barinfo"
|
||||||
|
@ -212,7 +216,7 @@ _neofetch_completions() {
|
||||||
"--termpix"|\
|
"--termpix"|\
|
||||||
"--tycat"|\
|
"--tycat"|\
|
||||||
"--w3m")
|
"--w3m")
|
||||||
COMPREPLY=(
|
values=(
|
||||||
"auto"
|
"auto"
|
||||||
"ascii"
|
"ascii"
|
||||||
"wallpaper"
|
"wallpaper"
|
||||||
|
@ -224,7 +228,7 @@ _neofetch_completions() {
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"--ascii_distro")
|
"--ascii_distro")
|
||||||
COMPREPLY=(
|
values=(
|
||||||
"aix"
|
"aix"
|
||||||
"alpine"
|
"alpine"
|
||||||
"alpine_small"
|
"alpine_small"
|
||||||
|
@ -371,7 +375,7 @@ _neofetch_completions() {
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"--size")
|
"--size")
|
||||||
COMPREPLY=(
|
values=(
|
||||||
"00px"
|
"00px"
|
||||||
"00%"
|
"00%"
|
||||||
"auto"
|
"auto"
|
||||||
|
@ -380,7 +384,7 @@ _neofetch_completions() {
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"--crop_mode")
|
"--crop_mode")
|
||||||
COMPREPLY=(
|
values=(
|
||||||
"normal"
|
"normal"
|
||||||
"fit"
|
"fit"
|
||||||
"fill"
|
"fill"
|
||||||
|
@ -388,7 +392,7 @@ _neofetch_completions() {
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"--crop_offset")
|
"--crop_offset")
|
||||||
COMPREPLY=(
|
values=(
|
||||||
"northwest"
|
"northwest"
|
||||||
"north"
|
"north"
|
||||||
"northeast"
|
"northeast"
|
||||||
|
@ -402,12 +406,16 @@ _neofetch_completions() {
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"--config")
|
"--config")
|
||||||
COMPREPLY=(
|
values=(
|
||||||
"none"
|
"none"
|
||||||
"/path/to/config"
|
"/path/to/config"
|
||||||
)
|
)
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
IFS=$'\n' read -d "" -ra COMPREPLY \
|
||||||
|
< <(compgen -W "${values[*]}" -- "$cur")
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
complete -F _neofetch_completions neofetch
|
complete -F _neofetch_completions neofetch
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue