Make sure arg enums can autocomplete too

This commit is contained in:
David Heinemeier Hansson
2026-05-08 16:06:10 +02:00
parent 7b90929129
commit 8c5fb7abc3
+11
View File
@@ -40,6 +40,17 @@ _omarchy_complete() {
candidates+=("--all" "--json" "--markdown" "--check")
fi
if (( ${#candidates[@]} == 0 )) && [[ -x $bin_dir/$prefix ]]; then
local args enum
args=$(grep -m 1 '^# omarchy:args=<' "$bin_dir/$prefix" 2>/dev/null)
enum="${args#*<}"
enum="${enum%%>*}"
if [[ $enum == *"|"* && $enum != *" "* ]]; then
read -r -a candidates <<<"${enum//|/ }"
fi
fi
if (( ${#candidates[@]} > 0 )); then
local IFS=$'\n'
COMPREPLY=($(compgen -W "${candidates[*]}" -- "$cur"))