diff --git a/_toak b/_toak new file mode 100644 index 0000000..20fa6de --- /dev/null +++ b/_toak @@ -0,0 +1,56 @@ +#compdef toak + +_toak() { + local line + local -a commands + local -a global_options + + global_options=( + '(-v --verbose)'{-v,--verbose}'[Enable detailed debug logging]' + '(-h --help)'{-h,--help}'[Show help message]' + '--version[Show version information]' + ) + + commands=( + 'toggle:Starts or stops the recording' + 'discard:Abort current recording without transcribing' + 'onboard:Configure the application' + 'latency-test:Benchmark full pipeline without recording' + 'show:Show current configuration' + 'config:Update a specific configuration setting' + ) + + _arguments -C \ + $global_options \ + '1: :->cmds' \ + '*:: :->args' + + case $state in + cmds) + _describe -t commands 'command' commands + ;; + args) + case $words[1] in + toggle) + _arguments \ + '(-p --pipe)'{-p,--pipe}'[Output transcription to stdout instead of typing]' \ + '--copy[Copy to clipboard instead of typing]' + ;; + discard) + _arguments \ + '(-p --pipe)'{-p,--pipe}'[Output transcription to stdout instead of typing]' + ;; + config) + _arguments \ + '1:key:(llm whisper language lang backend punctuation tech)' \ + '2:value:' + ;; + *) + _message "no more arguments" + ;; + esac + ;; + esac +} + +_toak "$@" diff --git a/install.sh b/install.sh index 44563fa..408e7f6 100755 --- a/install.sh +++ b/install.sh @@ -9,4 +9,10 @@ dotnet publish -c Release -r linux-x64 echo "Installing to /usr/bin/toak... (This may prompt for your sudo password)" sudo cp bin/Release/net10.0/linux-x64/publish/Toak /usr/bin/toak +if [ -d "/usr/share/zsh/site-functions" ]; then + echo "Installing zsh completions..." + sudo cp _toak /usr/share/zsh/site-functions/_toak +fi + echo "Installation complete! You can now run 'toak' from anywhere." +echo "Note: You may need to restart your zsh shell or run 'autoload -Uz compinit && compinit' to enable completions."