Files
fastfetch/completions/bash
T

434 lines
10 KiB
Bash
Raw Normal View History

2021-03-07 11:11:21 +01:00
#!/usr/bin/env bash
2021-03-06 22:40:05 +01:00
__fastfetch_complete_help()
{
local __ff_helps=(
"color"
2021-03-21 11:18:06 +01:00
"format"
2021-04-25 11:48:25 +02:00
"load-config"
2021-03-12 10:17:49 +01:00
"os-format"
2021-03-12 12:16:41 +01:00
"host-format"
2021-03-19 20:57:07 +01:00
"kernel-format"
2022-09-15 15:41:24 +02:00
"uptime-format"
"processes-format"
2021-03-12 12:16:41 +01:00
"packages-format"
2021-03-19 20:57:07 +01:00
"shell-format"
2023-01-18 01:37:47 +08:00
"display-format"
2021-03-19 20:57:07 +01:00
"de-format"
"wm-format"
2022-09-15 15:41:24 +02:00
"wm-theme-format"
2021-03-19 20:57:07 +01:00
"theme-format"
"icons-format"
2021-03-23 19:48:52 +01:00
"font-format"
2022-09-15 15:41:24 +02:00
"cursor-format"
2021-03-19 20:57:07 +01:00
"terminal-format"
"terminal-font-format"
"cpu-format"
2021-11-24 16:16:25 +08:00
"cpu-usage-format"
2021-03-19 20:57:07 +01:00
"gpu-format"
"memory-format"
2022-09-15 15:41:24 +02:00
"swap-format"
2021-03-19 20:57:07 +01:00
"disk-format"
2021-03-12 12:16:41 +01:00
"battery-format"
2022-09-23 14:59:28 +08:00
"poweradapter-format"
2021-03-19 20:57:07 +01:00
"locale-format"
2023-06-08 21:04:56 +08:00
"localip-format"
"publicip-format"
2022-09-15 15:41:24 +02:00
"player-format"
"media-format"
2022-02-25 13:30:37 +01:00
"datetime-format"
"date-format"
"time-format"
2022-09-15 15:41:24 +02:00
"vulkan-format"
"opengl-format"
"opencl-format"
2023-01-24 10:39:33 +01:00
"bluetooth-format"
2021-03-06 22:40:05 +01:00
)
2021-03-07 11:11:21 +01:00
COMPREPLY=($(compgen -W "${__ff_helps[*]}" -- "$CURRENT_WORD"))
2021-03-06 22:40:05 +01:00
}
__fastfetch_complete_bool()
{
2021-03-07 11:11:21 +01:00
COMPREPLY=($(compgen -W "true false" -- "$CURRENT_WORD"))
2021-03-06 22:40:05 +01:00
}
__fastfetch_complete_string()
{
if [[ $CURRENT_WORD != "" ]]; then
COMPREPLY=("$CURRENT_WORD")
fi
}
2021-03-11 22:15:48 +01:00
__fastfetch_complete_path()
{
COMPREPLY=($(compgen -A file -- "$CURRENT_WORD"))
}
2021-03-06 22:40:05 +01:00
__fastfetch_complete_logo()
{
2021-11-09 16:53:08 +01:00
COMPREPLY=($(compgen -W "$(fastfetch --list-logos-autocompletion)" -- "$CURRENT_WORD"))
2021-03-06 22:40:05 +01:00
}
2022-09-15 15:41:24 +02:00
__fastfetch_complete_logo_type()
{
local __ff_logo_types=(
"auto"
"builtin"
"file"
"raw"
"sixel"
"kitty"
"chafa"
)
COMPREPLY=($(compgen -W "${__ff_logo_types[*]}" -- "$CURRENT_WORD"))
}
__fastfetch_complete_binary_prefix()
{
local __ff_binary_prefixes=(
"iec"
"si"
"jedec"
)
COMPREPLY=($(compgen -W "${__ff_binary_prefixes[*]}" -- "$CURRENT_WORD"))
}
__fastfetch_complete_gl()
{
local __ff_gl_types=(
"auto"
"egl"
"glx"
"osmesa"
)
COMPREPLY=($(compgen -W "${__ff_gl_types[*]}" -- "$CURRENT_WORD"))
}
2021-03-06 22:40:05 +01:00
__fastfetch_complete_option()
{
local FF_OPTIONS_ALL=(
"${FF_OPTIONS_BOOL[@]}"
"${FF_OPTIONS_STRING[@]}"
2021-03-11 22:15:48 +01:00
"${FF_OPTIONS_PATH[@]}"
2021-03-06 22:40:05 +01:00
"${FF_OPTIONS_LOGO[@]}"
2022-09-15 15:41:24 +02:00
"${FF_OPTIONS_LOGO_TYPE[@]}"
"${FF_OPTIONS_BINARY_PREFIX[@]}"
"${FF_OPTIONS_OPENGL[@]}"
2021-03-06 22:40:05 +01:00
)
2021-03-07 11:11:21 +01:00
if [[ $WORD_COUND -lt 3 ]]; then
2021-03-06 22:40:05 +01:00
FF_OPTIONS_ALL+=(
"${FF_OPTIONS_SINGLE[@]}"
"${FF_OPTIONS_HELP[@]}"
)
fi
2021-03-07 11:11:21 +01:00
for ff_word in ${COMP_WORDS[@]}; do
if [[ $ff_word == $CURRENT_WORD ]]; then
break
fi
FF_OPTIONS_ALL=("${FF_OPTIONS_ALL[@]/$ff_word}")
done
2021-03-06 22:40:05 +01:00
COMPREPLY=($(compgen -W "${FF_OPTIONS_ALL[*]}" -- "$CURRENT_WORD"))
}
__fastfetch_previous_matches()
{
for ff_option in "$@"; do
2021-03-07 11:11:21 +01:00
if [[ $ff_option == "$PREVIOUS_WORD" ]]; then
2021-03-06 22:40:05 +01:00
return 0
fi
done
return 1
}
__fastfetch_completion()
{
local CURRENT_WORD="${COMP_WORDS[$COMP_CWORD]}"
local PREVIOUS_WORD="${COMP_WORDS[$COMP_CWORD - 1]}"
local WORD_COUND="${#COMP_WORDS[@]}"
local FF_OPTIONS_SINGLE=(
"-v"
"--version"
"--list-logos"
2021-10-23 14:59:11 +02:00
"--list-modules"
"--list-presets"
"--list-features"
2021-03-06 22:40:05 +01:00
"--print-logos"
2022-07-21 14:37:13 +02:00
"--print-config-system"
"--print-config-user"
2021-10-23 14:59:11 +02:00
"--print-structure"
"--gen-config"
"--gen-config-force"
2021-03-06 22:40:05 +01:00
)
local FF_OPTIONS_HELP=(
"-h"
"--help"
)
local FF_OPTIONS_BOOL=(
"-r"
"--show-errors"
2022-04-02 14:35:43 +02:00
"--logo-print-remaining"
2021-04-07 17:36:03 +02:00
"--multithreading"
2022-12-14 11:30:50 +08:00
"--stat"
2021-05-09 21:41:17 +02:00
"--allow-slow-operations"
2021-06-17 13:49:25 +02:00
"--disable-linewrap"
"--hide-cursor"
"--cpu-temp"
"--gpu-temp"
"--battery-temp"
2023-03-10 11:04:46 +08:00
"--display-detect-name"
"--display-precise-refresh-rate"
2021-10-17 12:42:15 +08:00
"--localip-show-ipv4"
"--localip-show-ipv6"
"--localip-show-loop"
2022-09-26 16:20:51 +08:00
"--localip-name-prefix"
"--localip-compact-type"
2022-06-02 23:06:49 +02:00
"--escape-bedrock"
2022-06-08 10:59:33 +02:00
"--pipe"
2022-07-22 19:36:00 +02:00
"--title-fqdn"
2022-09-15 15:41:24 +02:00
"--escape-bedrock"
"--disk-folders"
"--disk-show-external"
2022-10-17 17:35:06 +02:00
"--disk-show-hidden"
2023-01-16 11:52:54 +01:00
"--disk-show-subvolumes"
2023-01-12 11:41:07 +01:00
"--gpu-hide-integrated"
"--gpu-hide-discrete"
2023-03-25 13:24:28 +08:00
"--gpu-force-vulkan"
"--disk-show-unknown"
2023-01-24 12:02:20 +01:00
"--bluetooth-show-disconnected"
2021-03-06 22:40:05 +01:00
)
local FF_OPTIONS_STRING=(
2022-04-02 14:35:43 +02:00
"--logo-type"
"--logo-padding"
"--logo-padding-left"
"--logo-padding-right"
2023-01-01 17:24:37 +08:00
"--logo-padding-top"
2022-04-02 14:35:43 +02:00
"--logo-color-1"
"--logo-color-2"
"--logo-color-3"
"--logo-color-4"
"--logo-color-5"
"--logo-color-6"
"--logo-color-7"
"--logo-color-8"
2022-09-15 15:41:24 +02:00
"--logo-width"
"--logo-height"
2022-04-02 14:35:43 +02:00
"--logo-color-9"
2021-03-06 22:40:05 +01:00
"-c"
"--color"
2022-09-15 15:41:24 +02:00
"--color-keys"
"--color-title"
2023-03-10 11:04:46 +08:00
"--display-compact-type"
2021-05-15 12:36:25 +02:00
"--separator"
2022-04-02 14:35:43 +02:00
"-s"
2021-03-19 20:57:07 +01:00
"--structure"
"--set"
2022-08-18 10:44:21 +02:00
"--set-keyless"
2022-09-15 15:41:24 +02:00
"--player-name"
"--percent-type"
2023-06-08 21:04:56 +08:00
"--publicip-url"
"--publicip-timeout"
2022-09-29 17:05:01 +08:00
"--weather-output-format"
"--weather-timeout"
2021-04-03 11:39:59 +02:00
"--os-key"
2022-09-15 15:41:24 +02:00
"--os-format"
2023-06-18 12:58:27 +08:00
"--os-key-color"
2021-04-03 11:39:59 +02:00
"--host-key"
2022-09-15 15:41:24 +02:00
"--host-format"
2023-06-18 12:58:27 +08:00
"--host-key-color"
2021-04-03 11:39:59 +02:00
"--kernel-key"
2022-09-15 15:41:24 +02:00
"--kernel-format"
2023-06-18 12:58:27 +08:00
"--kernel-key-color"
2021-04-03 11:39:59 +02:00
"--uptime-key"
2022-09-15 15:41:24 +02:00
"--uptime-format"
2023-06-18 12:58:27 +08:00
"--uptime-key-color"
2021-10-18 22:38:00 +08:00
"--processes-key"
2022-09-15 15:41:24 +02:00
"--processes-format"
2023-06-18 12:58:27 +08:00
"--processes-key-color"
2021-04-03 11:39:59 +02:00
"--packages-key"
2022-09-15 15:41:24 +02:00
"--packages-format"
2023-06-18 12:58:27 +08:00
"--packages-key-color"
2021-04-03 11:39:59 +02:00
"--shell-key"
2022-09-15 15:41:24 +02:00
"--shell-format"
2023-06-18 12:58:27 +08:00
"--shell-key-color"
2023-01-18 01:37:47 +08:00
"--display-key"
"--display-format"
2023-06-18 12:58:27 +08:00
"--display-key-color"
2021-04-03 11:39:59 +02:00
"--de-key"
2022-09-15 15:41:24 +02:00
"--de-format"
2023-06-18 12:58:27 +08:00
"--de-key-color"
2021-04-03 11:39:59 +02:00
"--wm-key"
2022-09-15 15:41:24 +02:00
"--wm-format"
2023-06-18 12:58:27 +08:00
"--wm-key-color"
2021-04-03 23:10:14 +02:00
"--wm-theme-key"
2022-09-15 15:41:24 +02:00
"--wm-theme-format"
2023-06-18 12:58:27 +08:00
"--wm-theme-key-color"
2021-04-03 11:39:59 +02:00
"--theme-key"
2022-09-15 15:41:24 +02:00
"--theme-format"
2023-06-18 12:58:27 +08:00
"--theme-key-color"
2021-04-03 11:39:59 +02:00
"--icons-key"
2022-09-15 15:41:24 +02:00
"--icons-format"
2023-06-18 12:58:27 +08:00
"--icons-key-color"
2021-04-03 11:39:59 +02:00
"--font-key"
2022-09-15 15:41:24 +02:00
"--font-format"
2023-06-18 12:58:27 +08:00
"--font-key-color"
2021-06-20 21:04:55 +02:00
"--cursor-key"
2022-09-15 15:41:24 +02:00
"--cursor-format"
2023-06-18 12:58:27 +08:00
"--cursor-key-color"
2021-04-03 11:39:59 +02:00
"--terminal-key"
2022-09-15 15:41:24 +02:00
"--terminal-format"
2023-06-18 12:58:27 +08:00
"--terminal-key-color"
2021-04-03 11:39:59 +02:00
"--terminal-font-key"
2022-09-15 15:41:24 +02:00
"--terminal-font-format"
2023-06-18 12:58:27 +08:00
"--terminal-font-key-color"
2021-04-03 11:39:59 +02:00
"--cpu-key"
2022-09-15 15:41:24 +02:00
"--cpu-format"
2023-06-18 12:58:27 +08:00
"--cpu-key-color"
2022-09-15 15:41:24 +02:00
"--cpu-useage-key"
"--cpu-useage-format"
2023-06-18 12:58:27 +08:00
"--cpu-useage-key-color"
2021-04-03 11:39:59 +02:00
"--gpu-key"
2022-09-15 15:41:24 +02:00
"--gpu-format"
2023-06-18 12:58:27 +08:00
"--gpu-key-color"
2021-04-03 11:39:59 +02:00
"--memory-key"
2022-09-15 15:41:24 +02:00
"--memory-format"
2023-06-18 12:58:27 +08:00
"--memory-key-color"
2022-09-15 15:41:24 +02:00
"--swap-key"
"--swap-format"
2023-06-18 12:58:27 +08:00
"--swap-key-color"
2021-04-03 11:39:59 +02:00
"--disk-key"
2022-09-15 15:41:24 +02:00
"--disk-format"
2023-06-18 12:58:27 +08:00
"--disk-key-color"
2021-04-03 11:39:59 +02:00
"--battery-key"
2022-09-15 15:41:24 +02:00
"--battery-format"
2023-06-18 12:58:27 +08:00
"--battery-key-color"
2022-09-23 14:59:28 +08:00
"--poweradapter-key"
"--poweradapter-format"
2023-06-18 12:58:27 +08:00
"--poweradapter-key-color"
2021-04-03 11:39:59 +02:00
"--locale-key"
2022-09-15 15:41:24 +02:00
"--locale-format"
2023-06-18 12:58:27 +08:00
"--locale-key-color"
2023-06-08 21:04:56 +08:00
"--localip-key"
"--localip-format"
2023-06-18 12:58:27 +08:00
"--localip-key-color"
2023-06-08 21:04:56 +08:00
"--publicip-key"
"--publicip-format"
2023-06-18 12:58:27 +08:00
"--publicip-key-color"
2022-11-26 18:23:08 +08:00
"--wifi-key"
"--wifi-format"
2023-06-18 12:58:27 +08:00
"--wifi-key-color"
2022-09-29 17:05:01 +08:00
"--weather-key"
"--weather-format"
2023-06-18 12:58:27 +08:00
"--weather-key-color"
2022-02-13 23:51:13 +01:00
"--player-key"
2022-09-15 15:41:24 +02:00
"--player-format"
2023-06-18 12:58:27 +08:00
"--player-key-color"
2022-09-11 13:09:33 +02:00
"--media-key"
2022-09-15 15:41:24 +02:00
"--media-format"
2023-06-18 12:58:27 +08:00
"--media-key-color"
2022-06-17 20:40:51 +02:00
"--datetime-key"
"--datetime-format"
2023-06-18 12:58:27 +08:00
"--datetime-key-color"
2022-02-25 13:30:37 +01:00
"--date-key"
2022-09-15 15:41:24 +02:00
"--date-format"
2023-06-18 12:58:27 +08:00
"--date-key-color"
2022-02-25 13:30:37 +01:00
"--time-key"
2022-09-15 15:41:24 +02:00
"--time-format"
2023-06-18 12:58:27 +08:00
"--time-key-color"
2022-06-05 00:18:40 +02:00
"--vulkan-key"
"--vulkan-format"
2023-06-18 12:58:27 +08:00
"--vulkan-key-color"
2022-06-05 00:18:40 +02:00
"--opengl-key"
"--opengl-format"
2023-06-18 12:58:27 +08:00
"--opengl-key-color"
2022-06-05 00:18:40 +02:00
"--opencl-key"
"--opencl-format"
2023-06-18 12:58:27 +08:00
"--opencl-key-color"
2022-09-26 23:45:46 +08:00
"--users-key"
"--users-format"
2023-06-18 12:58:27 +08:00
"--users-key-color"
2023-01-24 10:39:33 +01:00
"--bluetooth-key"
"--bluetooth-format"
2023-06-18 12:58:27 +08:00
"--bluetooth-key-color"
2021-03-06 22:40:05 +01:00
)
2021-03-11 22:15:48 +01:00
local FF_OPTIONS_PATH=(
2022-09-15 15:41:24 +02:00
"--load-config"
2022-01-18 18:56:37 +01:00
"--os-file"
2022-09-15 15:41:24 +02:00
"--lib-pci"
2021-11-13 18:25:35 +01:00
"--lib-vulkan"
2022-01-05 14:40:57 +01:00
"--lib-wayland"
"--lib-xcb-randr"
"--lib-xcb"
2022-09-15 15:41:24 +02:00
"--lib-xrandr"
2022-01-05 14:40:57 +01:00
"--lib-X11"
2021-05-02 21:06:01 +02:00
"--lib-gio"
2022-09-15 15:41:24 +02:00
"--lib-dconf"
"--lib-dbus"
"--lib-xfconf"
2022-05-23 19:30:02 +02:00
"--lib-sqlite3"
2022-05-24 13:36:33 +02:00
"--lib-rpm"
2022-04-14 15:11:14 +02:00
"--lib-imagemagick"
"--lib-z"
2022-04-28 19:15:46 +02:00
"--lib-chafa"
2022-06-04 15:21:34 +02:00
"--lib-egl"
"--lib-glx"
2022-06-04 19:30:26 +02:00
"--lib-osmesa"
2022-06-05 00:18:40 +02:00
"--lib-opencl"
2023-01-26 15:48:28 +01:00
"--lib-pulse"
2021-04-24 13:05:43 +02:00
"--battery-dir"
2021-03-11 22:15:48 +01:00
)
2021-03-06 22:40:05 +01:00
local FF_OPTIONS_LOGO=(
"-l"
"--logo"
)
2022-09-15 15:41:24 +02:00
local FF_OPTIONS_LOGO_TYPE=(
"--logo-type"
)
local FF_OPTIONS_BINARY_PREFIX=(
"--binary-prefix"
)
local FF_OPTIONS_OPENGL=(
"--opengl-type"
2022-09-15 15:41:24 +02:00
)
2021-03-06 22:40:05 +01:00
if __fastfetch_previous_matches "${FF_OPTIONS_SINGLE[@]}"; then
return
2021-03-07 11:11:21 +01:00
elif [[ $WORD_COUND -gt 3 && ( ${COMP_WORDS[$COMP_CWORD - 2]} == "--help" || ${COMP_WORDS[$COMP_CWORD - 2]} == "-h" ) ]]; then
2021-03-06 22:40:05 +01:00
return
elif [[ $CURRENT_WORD == "-"* ]]; then
__fastfetch_complete_option
elif __fastfetch_previous_matches "${FF_OPTIONS_HELP[@]}"; then
__fastfetch_complete_help
elif __fastfetch_previous_matches "${FF_OPTIONS_BOOL[@]}"; then
__fastfetch_complete_bool
elif __fastfetch_previous_matches "${FF_OPTIONS_STRING[@]}"; then
__fastfetch_complete_string
2021-03-11 22:15:48 +01:00
elif __fastfetch_previous_matches "${FF_OPTIONS_PATH[@]}"; then
__fastfetch_complete_path
2021-03-06 22:40:05 +01:00
elif __fastfetch_previous_matches "${FF_OPTIONS_LOGO[@]}"; then
__fastfetch_complete_logo
2022-09-15 15:41:24 +02:00
elif __fastfetch_previous_matches "${FF_OPTIONS_LOGO_TYPE[@]}"; then
__fastfetch_complete_logo_type
elif __fastfetch_previous_matches "${FF_OPTIONS_BINARY_PREFIX[@]}"; then
__fastfetch_complete_binary_prefix
elif __fastfetch_previous_matches "${FF_OPTIONS_OPENGL[@]}"; then
2022-09-15 15:41:24 +02:00
__fastfetch_complete_gl
2021-03-06 22:40:05 +01:00
else
__fastfetch_complete_option
fi
2022-09-15 19:34:14 +03:00
}
2021-03-06 22:40:05 +01:00
2021-03-27 18:14:19 +01:00
complete -F __fastfetch_completion fastfetch