#compdef hush _hush() { local state _arguments \ '1: :->command' \ '*: :->args' \ && return 0 case $state in command) local commands=( 'daemon:Start the daemon in the foreground' 'start:Begin a new recording' 'stop:Stop recording and transcribe' 'abort:Cancel and discard the current recording' 'toggle:Start recording if idle, stop if recording' 'status:Show daemon state and recording duration' 'latency-test:Run a full STT+LLM round-trip latency test' 'setup:Interactive configuration wizard' 'show:Display current configuration' 'profiles:Manage configuration profiles' ) _describe 'command' commands ;; args) case $words[2] in show) _arguments \ '--plain[Show plain key=value pairs instead of a table]' \ '--json[Show raw JSON output]' ;; toggle|stop) _arguments \ '--profile[Profile name to apply when processing]:profile:_hush_profiles' \ '-p[Profile name to apply when processing]:profile:_hush_profiles' ;; profiles) local subcommands=( 'list:List all available profiles' 'get:Print the contents of a profile' 'new:Create a new profile' 'edit:Open a profile in $EDITOR' ) _describe 'profiles subcommand' subcommands ;; esac ;; esac } _hush_profiles() { local profiles_dir="${HOME}/.config/hush/profiles" if [[ -d "$profiles_dir" ]]; then local profiles=("${profiles_dir}"/*(N:t)) _describe 'profile' profiles fi } _hush "$@"