ba-auto-daily/completions/ba_dailies.bash

31 lines
1.1 KiB
Bash

# Bash tab-completion for ba_dailies.sh's subcommand argument.
#
# Installed automatically by setup.sh (copied to
# ~/.ba_dailies_completion.bash and sourced from ~/.bashrc) -- not meant to
# be sourced manually from the repo checkout, since it shells out to the
# deployed ~/ba_dailies.sh, not this file's own location.
#
# The command list is queried from ba_daily.py itself (--list-commands)
# rather than duplicated here, so it can never drift from the real TASKS
# dict when a task is added, renamed, or removed.
_ba_dailies_completions() {
local cur
cur="${COMP_WORDS[COMP_CWORD]}"
# Only the first argument is a phase name; ba_dailies.sh doesn't take
# any further positional args today.
if [ "$COMP_CWORD" -ne 1 ]; then
return 0
fi
local commands
commands="$("$HOME/ba_dailies.sh" --list-commands 2>/dev/null)"
COMPREPLY=($(compgen -W "$commands" -- "$cur"))
}
# Registered under every literal form CLAUDE.md documents running this as.
complete -F _ba_dailies_completions ba_dailies.sh
complete -F _ba_dailies_completions ./ba_dailies.sh
complete -F _ba_dailies_completions ~/ba_dailies.sh