33function _fastfetch() {
44 local state
55
6- local -a opts
7- opts=(${(f)" $(
8- python << EOF
6+ local -a opts=(" ${(f)$(
7+ python3 <<EOF
98import json
109import subprocess
1110import sys
@@ -18,6 +17,12 @@ def main():
1817
1918 for key in data:
2019 for flag in data[key]:
20+ if flag["long"] == " logo-color-[1-9]" :
21+ for i in range(1, 10):
22+ command_prefix = f" --logo-color-{i}[{flag[" desc" ]} ({i})]"
23+ print_command(command_prefix, flag)
24+ continue
25+
2126 if flag.get(" pseudo" , False):
2227 continue
2328
@@ -36,7 +41,7 @@ def print_command(command_prefix: str, flag: dict):
3641 if type == " bool" :
3742 print(f" {command_prefix}::bool:(true false)" )
3843 elif type == " color" :
39- print(f"{command_prefix}:color:(black red green yellow blue magenta cyan white default) ")
44+ print(f" {command_prefix}:color:->colors " )
4045 elif type == " command" :
4146 print(f" {command_prefix}::module:->modules" )
4247 elif type == " config" :
@@ -62,22 +67,26 @@ if __name__ == "__main__":
6267 except Exception:
6368 sys.exit(1)
6469EOF
65- ) " } )
70+ )} " )
6671
6772 _arguments " $opts [@]"
6873
6974 case $state in
75+ colors)
76+ local -a colors=(black red green yellow blue magenta cyan white default)
77+ _describe ' color' colors
78+ ;;
7079 modules)
7180 local -a modules=(" ${(f)$(fastfetch --list-modules autocompletion)} " )
72- modules=(${(L)^modules%%:* } -format format color)
81+ modules=(${(L)^modules[@] %%:* } -format format color)
7382 _describe ' module' modules
7483 ;;
7584 presets)
7685 local -a presets=(
7786 " ${(f)$(fastfetch --list-presets autocompletion)} "
7887 " none:Disable loading config file"
7988 )
80- _describe ' preset' presets
89+ _describe ' preset' presets || _files
8190 ;;
8291 structures)
8392 local -a structures=(" ${(f)$(fastfetch --list-modules autocompletion)} " )
0 commit comments