Make color completion a bit smarter and a bit slower

This commit is contained in:
Sergei Eremenko 2021-10-15 22:31:55 +03:00
parent cce23c2918
commit 9c422d9d49
No known key found for this signature in database
GPG key ID: AB6D54C1C16D2507
2 changed files with 15 additions and 8 deletions

View file

@ -5,10 +5,12 @@
# @link: https://github.com/PapirusDevelopmentTeam/papirus-folders
_get_colors() {
local -a colors=(black blue bluegrey breeze brown carmine cyan
darkcyan deeporange green grey indigo magenta nordic orange
palebrown paleorange pink purple red teal violet white yaru
yellow)
if ! command -v papirus-folders >/dev/null; then
_message "unable to find papirus-folders script"
return 1
fi
local -a colors=( $(papirus-folders -l | tr -d '>\n') )
_wanted colors exlp 'color' compadd -- "${colors[@]}"
return 0
}

View file

@ -4,6 +4,14 @@
# @license: MIT license (MIT)
# @link: https://github.com/PapirusDevelopmentTeam/papirus-folders
__get_colors() {
if ! command -v papirus-folders >/dev/null; then
return 1
fi
papirus-folders -l | tr -d '>\n'
}
__get_themes() {
local data_dir icons_dir icon_theme
local -a data_dirs=()
@ -32,10 +40,7 @@ __get_themes() {
_papirus_folders() {
local cur prev
local -a colors=(black blue bluegrey breeze brown carmine cyan
darkcyan deeporange green grey indigo magenta nordic orange
palebrown paleorange pink purple red teal violet white yaru
yellow)
local -a colors=( $(__get_colors) )
local -a opts=(
-h --help
-V --version