dotfiles/.config/zsh/completions/_translate

20 lines
594 B
Plaintext

#compdef translate
function _translate_languages()
{
local -a languages=($(curl -s https://libretranslate.de/languages \
| jq --raw-output '.[].code'))
_values "language" ${languages}
}
_arguments '-h[short help text]' \
'--help[short help text]' \
'--domain[domain of instance to use]:domain:_ssh_hosts' \
'--from[Language to translate from]:language:_translate_languages' \
'--to[Language to translate to]:language:_translate_languages' \
'*:text:'
# Local Variables:
# mode: shell-script
# End: