feat: Add Zsh shell completion support for the toak command and integrate its installation.
This commit is contained in:
56
_toak
Normal file
56
_toak
Normal file
@@ -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 "$@"
|
||||||
@@ -9,4 +9,10 @@ dotnet publish -c Release -r linux-x64
|
|||||||
echo "Installing to /usr/bin/toak... (This may prompt for your sudo password)"
|
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
|
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 "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."
|
||||||
|
|||||||
Reference in New Issue
Block a user