This commit is contained in:
54
.shell/bash_completion.sh
Normal file
54
.shell/bash_completion.sh
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
# CLI Command Memory - Bash Completion
|
||||||
|
# Source this file for bash auto-completion support
|
||||||
|
|
||||||
|
_cli-memory_completion() {
|
||||||
|
local cur prev words cword
|
||||||
|
_init_completion || return
|
||||||
|
|
||||||
|
local commands="status init detect record search suggest workflow export shell autocomplete"
|
||||||
|
local record_commands="start single recent sync"
|
||||||
|
local search_commands="commands workflows tech recent stats"
|
||||||
|
local suggest_commands="next autocomplete train patterns"
|
||||||
|
local workflow_commands="play preview generate show list delete"
|
||||||
|
local export_commands="commands workflows import all scripts"
|
||||||
|
local shell_commands="setup"
|
||||||
|
local autocomplete_commands="enable disable"
|
||||||
|
|
||||||
|
if [[ "$cur" == -* ]]; then
|
||||||
|
COMPREPLY=($(compgen -W "--help --version --config --verbose -c -v" -- "$cur"))
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
local cmd="${words[1]}"
|
||||||
|
local subcmd="${words[2]}"
|
||||||
|
|
||||||
|
case "$cmd" in
|
||||||
|
record)
|
||||||
|
COMPREPLY=($(compgen -W "$record_commands" -- "$cur"))
|
||||||
|
;;
|
||||||
|
search)
|
||||||
|
COMPREPLY=($(compgen -W "$search_commands" -- "$cur"))
|
||||||
|
;;
|
||||||
|
suggest)
|
||||||
|
COMPREPLY=($(compgen -W "$suggest_commands" -- "$cur"))
|
||||||
|
;;
|
||||||
|
workflow)
|
||||||
|
COMPREPLY=($(compgen -W "$workflow_commands" -- "$cur"))
|
||||||
|
;;
|
||||||
|
export)
|
||||||
|
COMPREPLY=($(compgen -W "$export_commands" -- "$cur"))
|
||||||
|
;;
|
||||||
|
shell)
|
||||||
|
COMPREPLY=($(compgen -W "$shell_commands" -- "$cur"))
|
||||||
|
;;
|
||||||
|
autocomplete)
|
||||||
|
COMPREPLY=($(compgen -W "$autocomplete_commands" -- "$cur"))
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
COMPREPLY=($(compgen -W "$commands" -- "$cur"))
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
complete -F _cli-memory_completion cli-memory
|
||||||
|
complete -F _cli-memory_completion cm
|
||||||
Reference in New Issue
Block a user