mirror of
https://github.com/arthur-pbty/arthur-os.git
synced 2026-08-01 20:28:16 +02:00
Make sure arg enums can autocomplete too
This commit is contained in:
@@ -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"))
|
||||
|
||||
Reference in New Issue
Block a user