Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions completions/fastfetch.fish
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,21 @@ function __fastfetch_complete_structure
end

echo '
import json, subprocess, sys
import json
import subprocess
import sys


def main():
data: dict[str, list[dict]] = json.loads(subprocess.check_output(["fastfetch", "--help-raw"]))

for key in data:
for flag in data[key]:
if flag["long"] == "logo-color-[1-9]":
Copy link

Copilot AI May 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Consider adding an inline comment explaining that the loop generates distinct completions for logo-color flags (1-9) to improve clarity for future maintainers.

Copilot uses AI. Check for mistakes.
for i in range(1, 10):
print(f"""complete -c fastfetch -d "{flag["desc"]}" -l "logo-color-{i}" -x -a "(__fastfetch_complete_color)" """)
continue

if flag.get("pseudo", False):
continue

Expand All @@ -75,7 +83,7 @@ def main():
command_prefix += f""" -o {flag["short"]}"""

if "arg" in flag:
type: str = flag["arg"]["type"];
type: str = flag["arg"]["type"]
if type == "bool":
print(f"{command_prefix} -x -a \"(__fastfetch_complete_bool)\"")
elif type == "color":
Expand All @@ -98,9 +106,11 @@ def main():
else:
print(f"{command_prefix} -f")


if __name__ == "__main__":
try:
main()
except:
except Exception as e:
print(f"Error: {e}", file=sys.stderr)
sys.exit(1)
' | python3 | source
Loading