Skip to content

Commit e06d62e

Browse files
committed
fish complete: add --logo-color-[1-9] completion
1 parent ed69a70 commit e06d62e

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

completions/fastfetch.fish

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,21 @@ function __fastfetch_complete_structure
6060
end
6161

6262
echo '
63-
import json, subprocess, sys
63+
import json
64+
import subprocess
65+
import sys
66+
6467
6568
def main():
6669
data: dict[str, list[dict]] = json.loads(subprocess.check_output(["fastfetch", "--help-raw"]))
6770
6871
for key in data:
6972
for flag in data[key]:
73+
if flag["long"] == "logo-color-[1-9]":
74+
for i in range(1, 10):
75+
print(f"""complete -c fastfetch -d "{flag["desc"]}" -l "logo-color-{i}" -x -a "(__fastfetch_complete_color)" """)
76+
continue
77+
7078
if flag.get("pseudo", False):
7179
continue
7280
@@ -75,7 +83,7 @@ def main():
7583
command_prefix += f""" -o {flag["short"]}"""
7684
7785
if "arg" in flag:
78-
type: str = flag["arg"]["type"];
86+
type: str = flag["arg"]["type"]
7987
if type == "bool":
8088
print(f"{command_prefix} -x -a \"(__fastfetch_complete_bool)\"")
8189
elif type == "color":
@@ -98,9 +106,11 @@ def main():
98106
else:
99107
print(f"{command_prefix} -f")
100108
109+
101110
if __name__ == "__main__":
102111
try:
103112
main()
104-
except:
113+
except Exception as e:
114+
print(f"Error: {e}", file=sys.stderr)
105115
sys.exit(1)
106116
' | python3 | source

0 commit comments

Comments
 (0)