Fix completion scripts: remove remaining maxclaw references
- Rewrote langcode.bash with full unified CLI support - Rewrote langcode.zsh with full unified CLI support - All commands: chat, server, tui, config, analytics, dashboard, version - Config subcommands: list, add, remove, use, active, test, export, import, search
This commit is contained in:
1 parent
eda22811ce
commit
55a31278a8
2 files changed
+128
-58
No files matched your search
+55
-13
@@ -1,15 +1,18 @@
|
||||
#!/bin/bash
|
||||
# Bash completion for MaxClaw Agent CLI
|
||||
# Bash completion for LangCode Agent CLI
|
||||
|
||||
_maxclaw_completions()
|
||||
_langcode_completions()
|
||||
{
|
||||
local cur prev commands
|
||||
local cur prev commands subcommands
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
|
||||
# Main commands
|
||||
commands="list search add remove set-active active test export import help"
|
||||
commands="chat server tui config analytics dashboard version"
|
||||
|
||||
# Config subcommands
|
||||
config_subcommands="list add remove use active test export import search"
|
||||
|
||||
# Handle main command completion
|
||||
if [[ ${COMP_CWORD} -eq 1 ]]; then
|
||||
@@ -17,19 +20,40 @@ _maxclaw_completions()
|
||||
return 0
|
||||
fi
|
||||
|
||||
# Handle config subcommand completion
|
||||
if [[ "${COMP_WORDS[1]}" == "config" && ${COMP_CWORD} -eq 2 ]]; then
|
||||
COMPREPLY=( $(compgen -W "${config_subcommands}" -- ${cur}) )
|
||||
return 0
|
||||
fi
|
||||
|
||||
# Handle subcommand-specific completions
|
||||
case "${prev}" in
|
||||
server)
|
||||
local server_options="--port --host"
|
||||
COMPREPLY=( $(compgen -W "${server_options}" -- ${cur}) )
|
||||
return 0
|
||||
;;
|
||||
analytics)
|
||||
local analytics_options="--report --clear"
|
||||
COMPREPLY=( $(compgen -W "${analytics_options}" -- ${cur}) )
|
||||
return 0
|
||||
;;
|
||||
dashboard)
|
||||
local dashboard_options="--clear"
|
||||
COMPREPLY=( $(compgen -W "${dashboard_options}" -- ${cur}) )
|
||||
return 0
|
||||
;;
|
||||
search)
|
||||
# Search term - no completion
|
||||
return 0
|
||||
;;
|
||||
add)
|
||||
# Add command options
|
||||
local add_options="--non-interactive --name --provider --model --api-key --base-url --set-active"
|
||||
local add_options="--name --provider --model --api-key --base-url --activate"
|
||||
COMPREPLY=( $(compgen -W "${add_options}" -- ${cur}) )
|
||||
return 0
|
||||
;;
|
||||
remove|set-active|test)
|
||||
remove|use|test)
|
||||
# Configuration names - try to get from config list
|
||||
if command -v python3 &> /dev/null; then
|
||||
local configs=$(python3 -c "
|
||||
@@ -57,25 +81,43 @@ except:
|
||||
COMPREPLY=( $(compgen -f -- ${cur}) )
|
||||
return 0
|
||||
;;
|
||||
--provider)
|
||||
--provider|-p)
|
||||
# Provider options
|
||||
local providers="openai ollama openrouter"
|
||||
local providers="openai ollama openrouter anthropic google"
|
||||
COMPREPLY=( $(compgen -W "${providers}" -- ${cur}) )
|
||||
return 0
|
||||
;;
|
||||
--format)
|
||||
--format|-f)
|
||||
# Format options
|
||||
local formats="json yaml"
|
||||
COMPREPLY=( $(compgen -W "${formats}" -- ${cur}) )
|
||||
return 0
|
||||
;;
|
||||
--port|-p)
|
||||
# Port suggestions
|
||||
local ports="8000 3000 8080 5000"
|
||||
COMPREPLY=( $(compgen -W "${ports}" -- ${cur}) )
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
|
||||
# Handle option arguments
|
||||
case "${cur}" in
|
||||
-*)
|
||||
# Option completion
|
||||
local options="--non-interactive --name --provider --model --api-key --base-url --set-active --format --output"
|
||||
# Option completion based on context
|
||||
if [[ "${COMP_WORDS[1]}" == "server" ]]; then
|
||||
local options="--port --host"
|
||||
elif [[ "${COMP_WORDS[1]}" == "config" && "${COMP_WORDS[2]}" == "add" ]]; then
|
||||
local options="--name --provider --model --api-key --base-url --activate"
|
||||
elif [[ "${COMP_WORDS[1]}" == "config" && "${COMP_WORDS[2]}" == "export" ]]; then
|
||||
local options="--format --output"
|
||||
elif [[ "${COMP_WORDS[1]}" == "analytics" ]]; then
|
||||
local options="--report --clear"
|
||||
elif [[ "${COMP_WORDS[1]}" == "dashboard" ]]; then
|
||||
local options="--clear"
|
||||
else
|
||||
local options="--help --version"
|
||||
fi
|
||||
COMPREPLY=( $(compgen -W "${options}" -- ${cur}) )
|
||||
return 0
|
||||
;;
|
||||
@@ -84,5 +126,5 @@ except:
|
||||
return 0
|
||||
}
|
||||
|
||||
complete -F _maxclaw_completions python3 config_cli.py
|
||||
complete -F _maxclaw_completions python config_cli.py
|
||||
complete -F _langcode_completions langcode
|
||||
complete -F _langcode_completions langcode.py
|
||||
Reference in new issue
Block a user