diff options
| author | Sébastien M-B <essembeh@gmail.com> | 2011-12-15 16:15:23 +0100 | 
|---|---|---|
| committer | Sébastien M-B <essembeh@gmail.com> | 2011-12-15 16:15:23 +0100 | 
| commit | 37266112759a5759536cc4ea84ea063695cd1f2e (patch) | |
| tree | 8888b8b8a30c1ef7a395bd26bd1f0590c87c4e45 /plugins | |
| parent | 9969fca25b3205c2969a543aa1495aeb6eed772b (diff) | |
| parent | c133f41833ba1ce6a3868a644ad29caa17bfa75a (diff) | |
| download | zsh-37266112759a5759536cc4ea84ea063695cd1f2e.tar.gz zsh-37266112759a5759536cc4ea84ea063695cd1f2e.tar.bz2 zsh-37266112759a5759536cc4ea84ea063695cd1f2e.zip  | |
Merge remote branch 'upstream/master'
Diffstat (limited to 'plugins')
| -rw-r--r-- | plugins/autojump/autojump.plugin.zsh | 4 | ||||
| -rw-r--r-- | plugins/pip/_pip | 64 | ||||
| -rw-r--r-- | plugins/rails3/rails3.plugin.zsh | 2 | ||||
| -rw-r--r-- | plugins/wakeonlan/README | 29 | ||||
| -rw-r--r-- | plugins/wakeonlan/_wake | 4 | ||||
| -rw-r--r-- | plugins/wakeonlan/wakeonlan.plugin.zsh | 14 | 
6 files changed, 98 insertions, 19 deletions
diff --git a/plugins/autojump/autojump.plugin.zsh b/plugins/autojump/autojump.plugin.zsh index da0a12765..6f9b80bff 100644 --- a/plugins/autojump/autojump.plugin.zsh +++ b/plugins/autojump/autojump.plugin.zsh @@ -1,3 +1,5 @@ -if [ -f `brew --prefix`/etc/autojump ]; then +if [ -f /opt/local/etc/profile.d/autojump.sh ]; then +  . /opt/local/etc/profile.d/autojump.sh +elif [ -f `brew --prefix`/etc/autojump ]; then    . `brew --prefix`/etc/autojump  fi diff --git a/plugins/pip/_pip b/plugins/pip/_pip index b58010173..df53ba5ce 100644 --- a/plugins/pip/_pip +++ b/plugins/pip/_pip @@ -3,30 +3,43 @@  # pip zsh completion, based on homebrew completion +_pip_all() { +  # we cache the list of packages (originally from the macports plugin) +  if (( ! $+piplist )); then +    echo -n " (caching package index...)" +	piplist=($(pip search * | cut -d ' ' -f 1 | tr '[A-Z]' '[a-z]')) +  fi +} +  _pip_installed() { -  installed_pkgs=(`pip freeze`) +  installed_pkgs=(`pip freeze | cut -d '=' -f 1`)  }  local -a _1st_arguments  _1st_arguments=( -  'bundle:Create pybundles (archives containing multiple packages)' -  'freeze:Output all currently installed packages (exact versions) to stdout' -  'help:Show available commands' -  'install:Install packages' -  'search:Search PyPI' -  'uninstall:Uninstall packages' -  'unzip:Unzip individual packages' -  'zip:Zip individual packages' +  'bundle:create pybundles (archives containing multiple packages)' +  'freeze:output all currently installed packages (exact versions) to stdout' +  'help:show available commands' +  'install:install packages' +  'search:search PyPI' +  'uninstall:uninstall packages' +  'unzip:unzip individual packages' +  'zip:zip individual packages'  )  local expl -local -a pkgs installed_pkgs +local -a all_pkgs installed_pkgs  _arguments \ -  '(--version)--version[Show version number of program and exit]' \ -  '(-v --verbose)'{-v,--verbose}'[Give more output]' \ -  '(-q --quiet)'{-q,--quiet}'[Give less output]' \ -  '(-h --help)'{-h,--help}'[Show help]' \ +  '(--version)--version[show version number of program and exit]' \ +  '(-h --help)'{-h,--help}'[show help]' \ +  '(-E --environment)'{-E,--environment}'[virtualenv environment to run pip in]' \ +  '(-s --enable-site-packages)'{-s,--enable-site-packages}'[include site-packages in virtualenv]' \ +  '(-v --verbose)'{-v,--verbose}'[give more output]' \ +  '(-q --quiet)'{-q,--quiet}'[give less output]' \ +  '(--log)--log[log file location]' \ +  '(--proxy)--proxy[proxy in form user:passwd@proxy.server:port]' \ +  '(--timeout)--timeout[socket timeout (default 15s)]' \    '*:: :->subcmds' && return 0  if (( CURRENT == 1 )); then @@ -35,10 +48,25 @@ if (( CURRENT == 1 )); then  fi  case "$words[1]" in -  list) -      if [[ "$state" == forms ]]; then -        _pip_installed -        _requested installed_pkgs expl 'installed packages' compadd -a installed_pkgs +  search) +    _arguments \ +      '(--index)--index[base URL of Python Package Index]' ;; +  freeze) +    _arguments \ +      '(-l --local)'{-l,--local}'[report only virtualenv packages]' ;; +  install) +  	_arguments \ +      '(-U --upgrade)'{-U,--upgrade}'[upgrade all packages to the newest available version]' \ +      '(-f --find-links)'{-f,--find-links}'[URL for finding packages]' \ +      '(--no-deps --no-dependencies)'{--no-deps,--no-dependencies}'[iIgnore package dependencies]' \ +      '(--no-install)--no-install[only download packages]' \ +      '(--no-download)--no-download[only install downloaded packages]' \ +      '(--install-option)--install-option[extra arguments to be supplied to the setup.py]' \ +      '1: :->packages' &&  return 0 +      +      if [[ "$state" == packages ]]; then +        _pip_all +        _wanted piplist expl 'packages' compadd -a piplist        fi ;;    uninstall)      _pip_installed diff --git a/plugins/rails3/rails3.plugin.zsh b/plugins/rails3/rails3.plugin.zsh index f4ee637e6..792cde2bd 100644 --- a/plugins/rails3/rails3.plugin.zsh +++ b/plugins/rails3/rails3.plugin.zsh @@ -17,3 +17,5 @@ alias rp='_rails_command plugin'  alias rs='_rails_command server'  alias rsd='_rails_command server --debugger'  alias devlog='tail -f log/development.log' +alias rdm='rake db:migrate' +alias rdr='rake db:rollback' diff --git a/plugins/wakeonlan/README b/plugins/wakeonlan/README new file mode 100644 index 000000000..16fdd4587 --- /dev/null +++ b/plugins/wakeonlan/README @@ -0,0 +1,29 @@ +This plugin provides a wrapper around the "wakeonlan" tool available from most +distributions' package repositories, or from the following website: + +http://gsd.di.uminho.pt/jpo/software/wakeonlan/ + +In order to use this wrapper, create the ~/.wakeonlan directory, and place in +that directory one file for each device you would like to be able to wake. Give +the file a name that describes the device, such as its hostname. Each file +should contain a line with the mac address of the target device and the network +broadcast address. + +For instance, there might be a file ~/.wakeonlan/leto with the following +contents: + +00:11:22:33:44:55:66 192.168.0.255 + +To wake that device, use the following command: + +# wake leto + +The available device names will be autocompleted, so: + +# wake <tab> + +...will suggest "leto", along with any other configuration files that were +placed in the ~/.wakeonlan directory. + +For more information regarding the configuration file format, check the +wakeonlan man page. diff --git a/plugins/wakeonlan/_wake b/plugins/wakeonlan/_wake new file mode 100644 index 000000000..4ab10d374 --- /dev/null +++ b/plugins/wakeonlan/_wake @@ -0,0 +1,4 @@ +#compdef wake +#autoload + +_arguments "1:device to wake:_files -W '$HOME/.wakeonlan'" && return 0 diff --git a/plugins/wakeonlan/wakeonlan.plugin.zsh b/plugins/wakeonlan/wakeonlan.plugin.zsh new file mode 100644 index 000000000..6cef7d44a --- /dev/null +++ b/plugins/wakeonlan/wakeonlan.plugin.zsh @@ -0,0 +1,14 @@ +function wake() { +  local config_file="$HOME/.wakeonlan/$1" +  if [[ ! -f "$config_file" ]]; then +    echo "ERROR: There is no configuration file at \"$config_file\"." +    return 1 +  fi + +  if (( ! $+commands[wakeonlan] )); then +    echo "ERROR: Can't find \"wakeonlan\".  Are you sure it's installed?" +    return 1 +  fi + +  wakeonlan -f "$config_file" +}  | 
