Browse Source

New bash-completion file for mssh

Héctor García 10 years ago
parent
commit
f8da12ad6e
2 changed files with 35 additions and 0 deletions
  1. 1 0
      debian/changelog
  2. 34 0
      debian/mssh.bash-completion

+ 1 - 0
debian/changelog

@@ -6,6 +6,7 @@ mssh (1.3-1) unstable; urgency=low
     - Document on man page where aliases are defined. Closes: #583807.
     - Can specify conection port number on command line. Closes: #729881.
     - Allow window to be smaller than 1024x768. Closes: #654954.
+  * Added bash_completion file. Closes: #635226.
 
  -- Hector Garcia <[email protected]>  Wed, 15 Jan 2014 18:12:21 +0100
 

+ 34 - 0
debian/mssh.bash-completion

@@ -0,0 +1,34 @@
+# bash completion for mssh
+# Written by Héctor García <[email protected]>
+
+_mssh_alias()
+{
+  COMPREPLY=( $( compgen -W '$( command cat ~/.mssh_clusters 2>/dev/null \
+     | grep -v "^\s*$" | grep -v "^#" | sed -e "s/:.*$//" )' -- $cur ) )
+}  
+
+_mssh()
+{
+  local cur=${COMP_WORDS[COMP_CWORD]} 
+  local prev=${COMP_WORDS[COMP_CWORD-1]}
+
+  COMPREPLY=()
+
+  case "$prev" in
+   -a)
+     _mssh_alias
+     return 0
+     ;;
+  esac
+
+  # completing -a option
+  if [[ "$cur" == -* ]]; then
+    COMPREPLY=( $( compgen -W "-a" -- $cur ) )
+    return 0
+  fi
+
+  _known_hosts_real "$cur"
+
+}
+
+complete -F _mssh mssh