From e56de3b0fd460a76b34b2b76f7499302acbd0cdf Mon Sep 17 00:00:00 2001 From: =?utf8?q?Felix=20K=C3=A4stner?= Date: Fri, 27 Aug 2021 14:22:07 +0200 Subject: [PATCH] clean the code for _tssh_completion function --- README.md | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index dde0ade..992ad74 100644 --- a/README.md +++ b/README.md @@ -101,9 +101,14 @@ tssh() { ssh -t "$@" "$(trccmd --xz)" } _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 + # when completion is requested, load completion for ssh and use it for tssh, otherwise disable completion for tssh + # see https://stackoverflow.com/questions/61539494/how-does-bash-do-ssh-autocompletion + if __load_completion "ssh"; then + complete -F _ssh tssh + return 124 + else + complete -r tssh + fi } complete -F _tssh_completion tssh # this just loads the correct completion function -- 2.30.2