Skip to content
Snippets Groups Projects
Commit fdea8c4e authored by Gabriel Moreau's avatar Gabriel Moreau
Browse files

Better completion of computer name and log filename

parent 3163a827
No related branches found
No related tags found
No related merge requests found
Pipeline #86692 passed
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin
export LANG=C export LANG=C
VERSION='0.4.9' VERSION='0.4.10'
function usage() { function usage() {
cat <<END_USAGE cat <<END_USAGE
......
...@@ -9,11 +9,23 @@ _tssh() { ...@@ -9,11 +9,23 @@ _tssh() {
cur="${COMP_WORDS[COMP_CWORD]}" cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}" prev="${COMP_WORDS[COMP_CWORD-1]}"
if [[ "$cur" == '-*' || $COMP_CWORD -gt 1 ]] case $prev in
-l|--log)
COMPREPLY=($(compgen -f -- "$cur"|grep -v -f <(compgen -d --|sed -e 's/^/^/;s/$/\$/;'); compgen -d -S / -- "$cur"))
return 0
;;
esac
if [[ "$cur" == '-*' ]]
then then
COMPREPLY=($(compgen -W "$(tssh -h|grep '^ tssh'|sed -e 's/[\[]/\n/g;'|grep -- '^-'|cut -f 1 -d ']'|cut -f 1 -d ' '|sed -e 's/|/ /g;'|xargs echo -n)" -- "$cur")) COMPREPLY=($(compgen -W "$(tssh --help|grep '^ tssh'|sed -e 's/[\[]/\n/g;'|grep -- '^-'|cut -f 1 -d ']'|cut -f 1 -d ' '|sed -e 's/|/ /g;'|xargs echo -n)" -- "$cur"))
#elif [[ $COMP_CWORD -gt 1 && "$prev" != '-*' ]]
#then
# COMPREPLY=($(compgen -W "$(tr '\n' ' '<$HOME/.csshrc|sed -e 's/=/ /g;s/[[:space:]][[:space:]]*/ /g')" -- "$cur"))
else else
COMPREPLY=($(compgen -W "$(tssh -h|grep '^ tssh'|sed -e 's/[\[]/\n/g;'|grep -- '^-'|cut -f 1 -d ']'|cut -f 1 -d ' '|sed -e 's/|/ /g;'|xargs echo -n)" -- "$cur")) COMPREPLY=($(compgen -W "$((tssh --help|grep '^ tssh'|sed -e 's/[\[]/\n/g;'|grep -- '^-'|cut -f 1 -d ']'|cut -f 1 -d ' '|sed -e 's/|/ /g;';
tr '\n' ' '<$HOME/.csshrc|sed -e 's/=/ /g;s/[[:space:]][[:space:]]*/ /g'
) | xargs echo -n)" -- "$cur"))
fi fi
} && complete -F _tssh tssh } && complete -F _tssh tssh
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment