From 4f744b67722ff8c038865bd4055f64c758789e68 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Felix=20K=C3=A4stner?= Date: Fri, 27 Aug 2021 14:08:56 +0200 Subject: [PATCH] fix/improve completion for function tssh --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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" -- 2.30.2