From: Felix Kästner Date: Fri, 27 Aug 2021 12:08:56 +0000 (+0200) Subject: fix/improve completion for function tssh X-Git-Url: https://fpunktk.de/gitweb/?p=travelrc.git;a=commitdiff_plain;h=4f744b67722ff8c038865bd4055f64c758789e68 fix/improve completion for function tssh --- diff --git a/README.md b/README.md index c19713b..dde0ade 100644 --- a/README.md +++ b/README.md @@ -100,7 +100,12 @@ tssh() { # use -t to force the allocation of a terminal ssh -t "$@" "$(trccmd --xz)" } -complete -F _ssh tssh # this is the same as for ssh; function _ssh might not exist when this is called, but will be created automagically when requesting completion for ssh +_tssh_completion() { + # when completion is requested, it will be redefined to use _ssh and then load the completion function for ssh, see https://stackoverflow.com/questions/61539494/how-does-bash-do-ssh-autocompletion + complete -F _ssh tssh + __load_completion "ssh" && return 124 || complete -r tssh # if loading completion is successful then return, otherwise disable completion for tssh +} +complete -F _tssh_completion tssh # this just loads the correct completion function tdocker() { local dcmd="$1"