Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

mysqlshow completion



Hi!

I just swung together a rather convenient (old-style/compctl) completion
behaviour for mysqlshow; perhaps worth including in zsh completion archive
batch supplied with zsh:s?

function mysqlshow-completions ()
{
  local args
  setopt LOCAL_OPTIONS
  unsetopt GLOB
  read -c -A args
  if [[ $args[-1] != '' ]];then
    reply=($($args[0,-2] $args[-1]*|sed -n '4,${
/^| [^ ]/s/..\([^ ]*\).*$/\1/gp
}'))
  else
    reply=($($args|sed -n '4,${
/^| [^ ]/s/..\([^ ]*\).*$/\1/gp
}'))
  fi
}
compctl -K mysqlshow-completions mysqlshow

It does completion on database, table and column names using the already
specified options on the command line.

/Johan Sundström



Messages sorted by: Reverse Date, Date, Thread, Author