1
0
Fork 0

Fix Zsh completions, define functions before calling them

This commit is contained in:
tastytea 2022-05-04 03:58:54 +02:00
parent e74efe64d6
commit 70c7643214
Signed by: tastytea
SSH Key Fingerprint: SHA256:FBkvrOlhq5use1XEttyUGT4bUTDVA1ar9SgIc9P03cM
2 changed files with 9 additions and 9 deletions

View File

@ -1,13 +1,13 @@
#compdef ssh-sign
_arguments '-f[key file]:filename:_files' '-n[namespace]:namespace:_ssh-sign_namespaces' '-h[short help text]' '*:file:_files'
function _ssh-sign_namespaces()
{
local -a namespaces=(file email git "@$(dnsdomainname)")
_values "namespace" ${namespaces}
}
_arguments '-f[key file]:filename:_files' '-n[namespace]:namespace:_ssh-sign_namespaces' '-h[short help text]' '*:file:_files'
# Local Variables:
# mode: shell-script
# End:

View File

@ -1,12 +1,5 @@
#compdef translate
_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:'
function _translate_languages()
{
local -a languages=($(curl -s https://libretranslate.de/languages \
@ -14,6 +7,13 @@ function _translate_languages()
_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: