Unverified Commit cad48e38 authored by Marc Cornellà's avatar Marc Cornellà Committed by GitHub
Browse files

Merge branch 'master' into fabric_task_description

parents 225425fe 40df67bc
# pip plugin
This plugin adds completion for [pip](https://pip.pypa.io/en/latest/),
the Python package manager.
To use it, add `pip` to the plugins array in your zshrc file:
```zsh
plugins=(... pip)
```
## pip cache
The pip plugin caches the names of available pip packages from the PyPI index.
To trigger the caching process, try to complete `pip install`,
or you can run `zsh-pip-cache-packages` directly.
To reset the cache, run `zsh-pip-clear-cache` and it will be rebuilt next
the next time you autocomplete `pip install`.
#compdef pip pip2 pip-2.7 pip3 pip-3.2 pip-3.3 pip-3.4 #compdef pip pip2 pip-2.7 pip3 pip-3.2 pip-3.3 pip-3.4
#autoload #autoload
# pip zsh completion, based on homebrew completion # pip zsh completion, based on last stable release (pip8)
# homebrew completion and backwards compatibility
_pip_all() { _pip_all() {
# we cache the list of packages (originally from the macports plugin) # we cache the list of packages (originally from the macports plugin)
...@@ -17,30 +18,43 @@ _pip_installed() { ...@@ -17,30 +18,43 @@ _pip_installed() {
local -a _1st_arguments local -a _1st_arguments
_1st_arguments=( _1st_arguments=(
'bundle:create pybundles (archives containing multiple packages)' 'install:install packages'
'download:download packages'
'uninstall:uninstall packages'
'freeze:output all currently installed packages (exact versions) to stdout' 'freeze:output all currently installed packages (exact versions) to stdout'
'help:show available commands' 'list:list installed packages'
'show:show information about installed packages' 'show:show information about installed packages'
'install:install packages'
'search:search PyPI' 'search:search PyPI'
'uninstall:uninstall packages' 'wheel:build individual wheel archives for your requirements and dependencies'
'unzip:unzip individual packages' 'hash:compute a hash of a local package archive'
'zip:zip individual packages' 'help:show available commands'
'bundle:create pybundles (archives containing multiple packages)(deprecated)'
'unzip:unzip individual packages(deprecated)'
'zip:zip individual packages(deprecated)'
) )
local expl local expl
local -a all_pkgs installed_pkgs local -a all_pkgs installed_pkgs
_arguments \ _arguments \
'(--version)--version[show version number of program and exit]' \
'(-h --help)'{-h,--help}'[show help]' \ '(-h --help)'{-h,--help}'[show help]' \
'(-E --environment)'{-E,--environment}'[virtualenv environment to run pip in]' \ '(--isolated)--isolated[run pip in isolated mode, ignores environment variables and user configuration]' \
'(-s --enable-site-packages)'{-s,--enable-site-packages}'[include site-packages in virtualenv]' \
'(-v --verbose)'{-v,--verbose}'[give more output]' \ '(-v --verbose)'{-v,--verbose}'[give more output]' \
'(-V --version)'{-V,--version}'[show version number of program and exit]' \
'(-q --quiet)'{-q,--quiet}'[give less output]' \ '(-q --quiet)'{-q,--quiet}'[give less output]' \
'(--log)--log[log file location]' \ '(--log)--log[log file location]' \
'(--proxy)--proxy[proxy in form user:passwd@proxy.server:port]' \ '(--proxy)--proxy[proxy in form user:passwd@proxy.server:port]' \
'(--retries)--retries[max number of retries per connection (default 5 times)]' \
'(--timeout)--timeout[socket timeout (default 15s)]' \ '(--timeout)--timeout[socket timeout (default 15s)]' \
'(--exists-action)--exists-action[default action when a path already exists: (s)witch, (i)gnore, (w)ipe, (b)ackup]' \
'(--trusted-host)--trusted-host[mark this host as trusted]' \
'(--cert)--cert[path to alternate CA bundle]' \
'(--client-cert)--client-cert[path to SSL client certificate]' \
'(--cache-dir)--cache-dir[store the cache data in specified directory]' \
'(--no-cache-dir)--no-cache-dir[disable de cache]' \
'(--disable-pip-version-check)--disable-pip-version-check[do not check periodically for new pip version downloads]' \
'(-E --environment)'{-E,--environment}'[virtualenv environment to run pip in (deprecated)]' \
'(-s --enable-site-packages)'{-s,--enable-site-packages}'[include site-packages in virtualenv (deprecated)]' \
'*:: :->subcmds' && return 0 '*:: :->subcmds' && return 0
if (( CURRENT == 1 )); then if (( CURRENT == 1 )); then
...@@ -56,8 +70,9 @@ case "$words[1]" in ...@@ -56,8 +70,9 @@ case "$words[1]" in
_arguments \ _arguments \
'(-l --local)'{-l,--local}'[report only virtualenv packages]' ;; '(-l --local)'{-l,--local}'[report only virtualenv packages]' ;;
install) install)
_arguments \ _arguments \
'(-U --upgrade)'{-U,--upgrade}'[upgrade all packages to the newest available version]' \ '(-U --upgrade)'{-U,--upgrade}'[upgrade all packages to the newest available version]' \
'(--user)--user[install packages to user home]' \
'(-f --find-links)'{-f,--find-links}'[URL for finding packages]' \ '(-f --find-links)'{-f,--find-links}'[URL for finding packages]' \
'(-r --requirement)'{-r,--requirement}'[Requirements file for packages to install]:File:_files' \ '(-r --requirement)'{-r,--requirement}'[Requirements file for packages to install]:File:_files' \
'(--no-deps --no-dependencies)'{--no-deps,--no-dependencies}'[iIgnore package dependencies]' \ '(--no-deps --no-dependencies)'{--no-deps,--no-dependencies}'[iIgnore package dependencies]' \
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
# "zsh-pip-clear-cache". # "zsh-pip-clear-cache".
ZSH_PIP_CACHE_FILE=~/.pip/zsh-cache ZSH_PIP_CACHE_FILE=~/.pip/zsh-cache
ZSH_PIP_INDEXES=(https://pypi.python.org/simple/) ZSH_PIP_INDEXES=(https://pypi.org/simple/)
zsh-pip-clear-cache() { zsh-pip-clear-cache() {
rm $ZSH_PIP_CACHE_FILE rm $ZSH_PIP_CACHE_FILE
...@@ -29,9 +29,10 @@ zsh-pip-cache-packages() { ...@@ -29,9 +29,10 @@ zsh-pip-cache-packages() {
if [[ ! -f $ZSH_PIP_CACHE_FILE ]]; then if [[ ! -f $ZSH_PIP_CACHE_FILE ]]; then
echo -n "(...caching package index...)" echo -n "(...caching package index...)"
tmp_cache=/tmp/zsh_tmp_cache tmp_cache=/tmp/zsh_tmp_cache
touch $tmp_cache
for index in $ZSH_PIP_INDEXES ; do for index in $ZSH_PIP_INDEXES ; do
# well... I've already got two problems # well... I've already got two problems
curl $index 2>/dev/null | \ curl -L $index 2>/dev/null | \
zsh-pip-clean-packages \ zsh-pip-clean-packages \
>> $tmp_cache >> $tmp_cache
done done
......
# Pipenv
## Installation
In your `.zshrc` file, add `pipenv` to the plugins section
```
plugins=(... pipenv ...)
```
## Features
This plugin provides some features to simplify the use of Pipenv while working on ZSH.
- Adds completion for pipenv
- Auto activates and deactivates pipenv shell
- Adds short aliases for common pipenv commands
- `pch` is aliased to `pipenv check`
- `pcl` is aliased to `pipenv clean`
- `pgr` is aliased to `pipenv graph`
- `pi` is aliased to `pipenv install`
- `pidev` is aliased to `pipenv install --dev`
- `pl` is aliased to `pipenv lock`
- `po` is aliased to `pipenv open`
- `prun` is aliased to `pipenv run`
- `psh` is aliased to `pipenv shell`
- `psy` is aliased to `pipenv sync`
- `pu` is aliased to `pipenv uninstall`
- `pwh` is aliased to `pipenv --where`
- `pvenv` is aliased to `pipenv --venv`
- `ppy` is aliased to `pipenv --py`
# Pipenv completion
_pipenv() {
eval $(env COMMANDLINE="${words[1,$CURRENT]}" _PIPENV_COMPLETE=complete-zsh pipenv)
}
compdef _pipenv pipenv
# Automatic pipenv shell activation/deactivation
_togglePipenvShell() {
# deactivate shell if Pipfile doesn't exist and not in a subdir
if [[ ! -a "$PWD/Pipfile" ]]; then
if [[ "$PIPENV_ACTIVE" == 1 ]]; then
if [[ "$PWD" != "$pipfile_dir"* ]]; then
exit
fi
fi
fi
# activate the shell if Pipfile exists
if [[ "$PIPENV_ACTIVE" != 1 ]]; then
if [[ -a "$PWD/Pipfile" ]]; then
export pipfile_dir="$PWD"
pipenv shell
fi
fi
}
chpwd_functions+=(_togglePipenvShell)
# Aliases
alias pch="pipenv check"
alias pcl="pipenv clean"
alias pgr="pipenv graph"
alias pi="pipenv install"
alias pidev="pipenv install --dev"
alias pl="pipenv lock"
alias po="pipenv open"
alias prun="pipenv run"
alias psh="pipenv shell"
alias psy="pipenv sync"
alias pu="pipenv uninstall"
alias pwh="pipenv --where"
alias pvenv="pipenv --venv"
alias ppy="pipenv --py"
# please plugin
[Please](https://please.build) is a cross-language build system with an emphasis on
high performance, extensibility and reproduceability. It supports a number of popular
languages and can automate nearly any aspect of your build process.
This plugin adds autocomplete and major aliases for `plz`, the command line tool for
Please.
To use it, add `please` to the plugins array in your zshrc file:
```zsh
plugins=(... please)
```
## Aliases
| Alias | Command |
|-------|-------------|
| `pb` | `plz build` |
| `pt` | `plz test` |
| `pw` | `plz watch` |
## Maintainer
[@thought-machine](https://github.com/thought-machine)
if (( $+commands[plz] )); then
source <(plz --completion_script)
fi
alias pb='plz build'
alias pt='plz test'
alias pw='plz watch'
# pod
This plugin adds completion for [`CocoaPods`](https://cocoapods.org/).
CocoaPods is a dependency manager for Swift and Objective-C Cocoa projects.
To use it, add `pod` to the plugins array in your zshrc file:
```zsh
plugins=(... pod)
```
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# FILE: _pod # FILE: _pod
# DESCRIPTION: Cocoapods (0.33.1) autocomplete plugin for Oh-My-Zsh # DESCRIPTION: Cocoapods (0.33.1) autocomplete plugin for Oh-My-Zsh
# http://cocoapods.org # https://cocoapods.org
# Generated with `pod --completion-script # Generated with `pod --completion-script
# AUTHOR: Alexandre Joly (alexandre.joly@mekanics.ch) # AUTHOR: Alexandre Joly (alexandre.joly@mekanics.ch)
# GITHUB: https://github.com/mekanics # GITHUB: https://github.com/mekanics
......
# Postgres plugin
This plugin adds some aliases for useful Postgres commands.
:warning: this plugin works exclusively with Postgres installed via Homebrew on OSX
because Postgres paths are hardcoded to `/usr/local/var/postgres`.
To use it, add `postgres` to the plugins array in your zshrc file:
```zsh
plugins=(... postgres)
```
## Aliases
| Alias | Command | Description |
|-------------|---------------------------------------------------------------------------------|-------------------------------------------------------------|
| startpost | `pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start` | Start postgres server |
| stoppost | `pg_ctl -D /usr/local/var/postgres stop -s -m fast` | Stop postgres server |
| restartpost | `stoppost && sleep 1 && startpost` | Restart (calls stop, then start) |
| reloadpost | `pg_ctl reload -D /usr/local/var/postgres -s` | Reload postgres configuration (some setting require restart)|
| statuspost | `pg_ctl status -D /usr/local/var/postgres -s` | Check startus of postgres server (running, stopped) |
# pow plugin
This plugin adds completion and commands for [pow](http://pow.cx/), a
zero-configuration Rack server for macOS.
To use it, add pow to the plugins array of your zshrc file:
```sh
plugins=(... pow)
```
## Commands
- `kapow` will restart an app.
```bash
kapow myapp
```
- `kaput` will show the standard output from any pow app.
- `repow` will restart the pow process.
...@@ -73,7 +73,7 @@ powed(){ ...@@ -73,7 +73,7 @@ powed(){
} }
# Restart pow process # Restart pow process
# taken from http://www.matthewratzloff.com/blog/2011/12/23/restarting-pow-when-dns-stops-responding # taken from https://www.matthewratzloff.com
repow(){ repow(){
lsof | grep 20560 | awk '{print $2}' | xargs kill -9 lsof | grep 20560 | awk '{print $2}' | xargs kill -9
launchctl unload ~/Library/LaunchAgents/cx.pow.powd.plist launchctl unload ~/Library/LaunchAgents/cx.pow.powd.plist
......
# powify plugin
This plugin adds autocompletion for [powify](https://github.com/sethvargo/powify),
an easy-to-use wrapper for Basecamp's [pow](https://github.com/basecamp/pow).
To use it, add powify to the plugins array of your zshrc file:
```sh
plugins=(... powify)
```
# pyenv
This plugin looks for [pyenv](https://github.com/pyenv/pyenv), a Simple Python version
management system, and loads it if it's found. It also loads pyenv-virtualenv, a pyenv
plugin to manage virtualenv, if it's found.
To use it, add `pyenv` to the plugins array in your zshrc file:
```zsh
plugins=(... pyenv)
```
## Functions
- `pyenv_prompt_info`: displays the Python version in use by pyenv; or the global Python
version, if pyenv wasn't found.
_homebrew-installed() { # This plugin loads pyenv into the current shell and provides prompt info via
type brew &> /dev/null # the 'pyenv_prompt_info' function. Also loads pyenv-virtualenv if available.
}
_pyenv-from-homebrew-installed() { FOUND_PYENV=$+commands[pyenv]
brew --prefix pyenv &> /dev/null
}
FOUND_PYENV=0 if [[ $FOUND_PYENV -ne 1 ]]; then
pyenvdirs=("$HOME/.pyenv" "/usr/local/pyenv" "/opt/pyenv") pyenvdirs=("$HOME/.pyenv" "/usr/local/pyenv" "/opt/pyenv" "/usr/local/opt/pyenv")
if _homebrew-installed && _pyenv-from-homebrew-installed ; then for dir in $pyenvdirs; do
pyenvdirs=($(brew --prefix pyenv) "${pyenvdirs[@]}") if [[ -d $dir/bin ]]; then
export PATH="$PATH:$dir/bin"
FOUND_PYENV=1
break
fi
done
fi fi
for pyenvdir in "${pyenvdirs[@]}" ; do if [[ $FOUND_PYENV -ne 1 ]]; then
if [ -d $pyenvdir/bin -a $FOUND_PYENV -eq 0 ] ; then if (( $+commands[brew] )) && dir=$(brew --prefix pyenv 2>/dev/null); then
FOUND_PYENV=1 if [[ -d $dir/bin ]]; then
export PYENV_ROOT=$pyenvdir export PATH="$PATH:$dir/bin"
export PATH=${pyenvdir}/bin:$PATH FOUND_PYENV=1
eval "$(pyenv init - zsh)"
if pyenv commands | command grep -q virtualenv-init; then
eval "$(pyenv virtualenv-init - zsh)"
fi fi
function pyenv_prompt_info() {
echo "$(pyenv version-name)"
}
fi fi
done fi
unset pyenvdir
if [ $FOUND_PYENV -eq 0 ] ; then if [[ $FOUND_PYENV -eq 1 ]]; then
function pyenv_prompt_info() { echo "system: $(python -V 2>&1 | cut -f 2 -d ' ')" } eval "$(pyenv init - zsh)"
if (( $+commands[pyenv-virtualenv-init] )); then
eval "$(pyenv virtualenv-init - zsh)"
fi
function pyenv_prompt_info() {
echo "$(pyenv version-name)"
}
else
# fallback to system python
function pyenv_prompt_info() {
echo "system: $(python -V 2>&1 | cut -f 2 -d ' ')"
}
fi fi
unset FOUND_PYENV pyenvdirs dir
# pylint
This plugin adds code analysis for python through [Pylint](https://www.pylint.org/).
To use it, add `pylint` to the plugins array in your zshrc file:
```zsh
plugins=(... pylint)
```
## Aliases
| Alias | Command | Description |
| -------------| -------------------- | -------------------------------------------------------------------------------------------------------------------------|
| pylint-quick | `pylint --reports=n` | Displays a set of reports each one focusing on a particular aspect of the project, default set `no` for multiple reports | |
# python plugin
The plugin adds several aliases for useful [python](https://www.python.org/) commands.
To use it, add `python` to the plugins array of your zshrc file:
```
plugins=(... python)
```
## Aliases
| Command | Description |
|------------------|---------------------------------------------------------------------------------|
| `pyfind` | Finds .py files recursively in the current directory |
| `pyclean [dirs]` | Deletes byte-code and cache files from a list of directories or the current one |
| `pygrep <text>` | Looks for `text` in .py files |
#compdef python
# Python 2.6
# Python 3.0
local curcontext="$curcontext" state line expl
typeset -A opt_args
local -a args
if _pick_variant python3=Python\ 3 python2 --version; then
args=(
'(-bb)-b[issue warnings about str(bytes_instance), str(bytearray_instance) and comparing bytes/bytearray with str]'
'(-b)-bb[issue errors about str(bytes_instance), str(bytearray_instance) and comparing bytes/bytearray with str]'
)
else
args=(
'-Q+[division options]:division option:(old warn warnall new)'
'(-tt)-t[issue warnings about inconsistent tab usage]'
'(-t)-tt[issue errors about inconsistent tab usage]'
'-3[warn about Python 3.x incompatibilities]'
)
fi
_arguments -C -s -S "$args[@]" \
"-B[don't write .py\[co\] files on import]" \
'(1 -)-c+[program passed in as string (terminates option list)]:python command:' \
'-d[debug output from parser]' \
'-E[ignore PYTHON* environment variables (such as PYTHONPATH)]' \
'(1 * -)-h[display help information]' \
'-i[inspect interactively after running script]' \
'(1 * -)-m[run library module as a script (terminates option list)]:module:->modules' \
'-O[optimize generated bytecode slightly]' \
'-OO[remove doc-strings in addition to the -O optimizations]' \
"-s[don't add user site directory to sys.path]" \
"-S[don't imply 'import site' on initialization]" \
'-u[unbuffered binary stdout and stderr]' \
'-v[verbose (trace import statements)]' \
'(1 * -)'{-V,--version}'[display version information]' \
'-W+[warning control]:warning filter (action\:message\:category\:module\:lineno):(default always ignore module once error)' \
'-x[skip first line of source, allowing use of non-Unix forms of #!cmd]' \
'(-)1:script file:_files -g "*.py(|c|o)(-.)"' \
'*::script argument: _normal' && return
if [[ "$state" = modules ]]; then
local -a modules
modules=(
${${=${(f)"$(_call_program modules $words[1] -c \
'from\ pydoc\ import\ help\;\ help\(\"modules\"\)')"}[2,-3]}:#\(package\)}
)
_wanted modules expl module compadd -a modules && return
fi
return 1
# Find python file # Find python file
alias pyfind='find . -name "*.py"' alias pyfind='find . -name "*.py"'
# Remove python compiled byte-code in either current directory or in a # Remove python compiled byte-code and mypy cache in either current directory or in a
# list of specified directories # list of specified directories
function pyclean() { function pyclean() {
ZSH_PYCLEAN_PLACES=${*:-'.'} ZSH_PYCLEAN_PLACES=${*:-'.'}
find ${ZSH_PYCLEAN_PLACES} -type f -name "*.py[co]" -delete find ${ZSH_PYCLEAN_PLACES} -type f -name "*.py[co]" -delete
find ${ZSH_PYCLEAN_PLACES} -type d -name "__pycache__" -delete find ${ZSH_PYCLEAN_PLACES} -type d -name "__pycache__" -delete
find ${ZSH_PYCLEAN_PLACES} -type d -name ".mypy_cache" -delete
} }
# Grep among .py files # Grep among .py files
alias pygrep='grep --include="*.py"' alias pygrep='grep -r --include="*.py"'
# Rails
This plugin adds completion for [Ruby On Rails Framework](https://rubyonrails.org/) and [Rake](https://ruby.github.io/rake/) commands, as well as some aliases for logs and environment variables.
To use it, add `rails` to the plugins array in your zshrc file:
```zsh
plugins=(... rails)
```
## List of Aliases
### Rails aliases
| Alias | Command | Description |
|-------|----------------------------|----------------------------------------------------|
| `rc` | `rails console` | Interact with your Rails app from the CLI |
| `rcs` | `rails console --sandbox` | Test code in a sandbox, without changing any data |
| `rd` | `rails destroy` | Undo a generate operation |
| `rdb` | `rails dbconsole` | Interact with your db from the console |
| `rgen` | `rails generate` | Generate boilerplate code |
| `rgm` | `rails generate migration` | Generate a db migration |
| `rp` | `rails plugin` | Run a Rails plugin command |
| `ru` | `rails runner` | Run Ruby code in the context of Rails |
| `rs` | `rails server` | Launch a web server |
| `rsd` | `rails server --debugger` | Launch a web server with debugger |
| `rsp` | `rails server --port` | Launch a web server and specify the listening port |
### Rake aliases
| Alias | Command | Description |
|---------|---------------------------------|--------------------------------------------------------|
| `rdm` | `rake db:migrate` | Run pending db migrations |
| `rdms` | `rake db:migrate:status` | Show current db migration status |
| `rdmtc` | `rake db:migrate db:test:clone` | Run pending migrations and clone db into test database |
| `rdr` | `rake db:rollback` | Roll back the last migration |
| `rdc` | `rake db:create` | Create the database |
| `rds` | `rake db:seed` | Seed the database |
| `rdd` | `rake db:drop` | Delete the database |
| `rdrs` | `rake db:reset` | Delete the database and set it up again |
| `rdtc` | `rake db:test:clone` | Clone the database into the test database |
| `rdtp` | `rake db:test:prepare` | Duplicate the db schema into your test database |
| `rdsl` | `rake db:schema:load` | Load the database schema |
| `rlc` | `rake log:clear` | Clear Rails logs |
| `rn` | `rake notes` | Search for notes (`FIXME`, `TODO`) in code comments |
| `rr` | `rake routes` | List all defined routes |
| `rrg` | `rake routes | grep` | List and filter the defined routes |
| `rt` | `rake test` | Run Rails tests |
| `rmd` | `rake middleware` | Interact with Rails middlewares |
| `rsts` | `rake stats` | Print code statistics |
### Utility aliases
| Alias | Command | Description |
|-----------|-------------------------------|------------------------------------------------|
| `devlog` | `tail -f log/development.log` | Show and follow changes to the development log |
| `prodlog` | `tail -f log/production.log` | Show and follow changes to the production log |
| `testlog` | `tail -f log/test.log` | Show and follow changes to the test log |
### Environment settings
| Alias | Command | Description |
|-------|-------------------------|---------------------------------|
| `RED` | `RAILS_ENV=development` | Sets `RAILS_ENV` to development |
| `REP` | `RAILS_ENV=production` | Sets `RAILS_ENV` to production |
| `RET` | `RAILS_ENV=test` | Sets `RAILS_ENV` to test |
These are global aliases. Use in combination with a command or just run them
separately. For example: `REP rake db:migrate` will migrate the production db.
### Legacy stuff
| Alias | Command |
|---------|------------------------------------|
| `sstat` | `thin --stats "/thin/stats" start` |
| `sg` | `ruby script/generate` |
| `sd` | `ruby script/destroy` |
| `sp` | `ruby script/plugin` |
| `sr` | `ruby script/runner` |
| `ssp` | `ruby script/spec` |
| `sc` | `ruby script/console` |
| `sd` | `ruby script/server --debugger` |
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment