fix: include category-less tools in pos tab completion
gates / consistency-and-conventions (push) Successful in 23s
gates / consistency-and-conventions (push) Successful in 23s
_pos_complete_categories offered only hyphenated categories plus a hardcoded 'config', so 'pos <TAB>' never showed bank/tree. Category-less tools are now discovered from the executable scan, and the words==3 dispatch routes no-hyphen tools to _pos_complete_tool so 'pos bank <TAB>' offers list/add/show/run/edit/remove.
This commit is contained in:
+15
-2
@@ -115,7 +115,14 @@ _pos() {
|
||||
|
||||
# ── Helpers ────────────────────────────────────────────────
|
||||
_pos_complete_categories() {
|
||||
COMPREPLY=($(compgen -W "${!cat_cmds[*]} config" -- "$cur"))
|
||||
local solos=()
|
||||
for cmd in "${all_cmds[@]}"; do
|
||||
local cat_c="${cmd%%-*}"
|
||||
if [ "$cat_c" = "$cmd" ] && [ -z "${cat_cmds[$cmd]:-}" ]; then
|
||||
solos+=("$cmd")
|
||||
fi
|
||||
done
|
||||
COMPREPLY=($(compgen -W "${!cat_cmds[*]} ${solos[*]}" -- "$cur"))
|
||||
}
|
||||
|
||||
_pos_complete_subcats() {
|
||||
@@ -231,7 +238,13 @@ _pos() {
|
||||
3)
|
||||
case "${words[1]}" in
|
||||
config) _pos_config_scopes ;;
|
||||
*) _pos_complete_subcats ;;
|
||||
*)
|
||||
if [[ "${words[1]}" == *-* ]]; then
|
||||
_pos_complete_subcats
|
||||
else
|
||||
_pos_complete_tool "${words[1]}"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
4)
|
||||
|
||||
Reference in New Issue
Block a user