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