1
0
mirror of https://github.com/akelge/zsh synced 2025-07-04 05:29:06 +00:00

migration

This commit is contained in:
Andrea Mistrali
2015-03-13 16:03:57 +01:00
parent fec1d63a8d
commit 0d61c334d7
160 changed files with 0 additions and 48269 deletions

30
zsh.d/00-options.zsh Normal file
View File

@ -0,0 +1,30 @@
# setopt ALL_EXPORT
setopt ALWAYS_TO_END
setopt APPEND_HISTORY
setopt AUTONAMEDIRS
setopt AUTO_PARAM_SLASH
setopt AUTO_REMOVE_SLASH
setopt AUTO_RESUME
setopt CDABLE_VARS
setopt CORRECT
setopt FUNCTION_ARGZERO
setopt HIST_IGNORE_ALL_DUPS
setopt HIST_NO_STORE
setopt HIST_REDUCE_BLANKS
setopt LIST_TYPES
setopt LONG_LIST_JOBS
setopt no_BEEP
setopt no_HUP
setopt NOTIFY
setopt PATH_DIRS
setopt SHORT_LOOPS
setopt prompt_subst
setopt AUTO_CD
setopt AUTO_MENU
setopt no_MENU_COMPLETE
setopt AUTO_LIST
# vim: set ts=4 sw=4 tw=0 ft=zsh :

33
zsh.d/10-environment.zsh Normal file
View File

@ -0,0 +1,33 @@
#######################################################################################
# Variables
## Vars used always
PATH="/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/usr/local/sbin:/usr/sbin:/sbin:$HOME/bin:."
# LANG="it_IT.UTF-8"
# TZ='Europe/Rome'
MIBS=all
LOGD=/var/log
## If we are not interactive quit
[ -z "$PS1" ] && return
## Vars only for interactive sessions
SAVEHIST=500
HISTFILE=~/.history
HISTSIZE=10000
PYTHONSTARTUP=~/.pythonrc.py
LOGCHECK=30
REPORTTIME=15
WATCH=notme
WATCHFMT="%n %a %l (%m) at %t."
EDITOR=vim
VISUAL=vim
#
# Hack for svn
export SVN_EDITOR=${VISUAL}
# Set umask to collaborative mode
umask 002
# vim: set ts=4 sw=4 tw=0 ft=zsh :

23
zsh.d/20-bindkeys.zsh Normal file
View File

@ -0,0 +1,23 @@
#######################################################################################
#
# Backward-kill-word stop on dir delimiter
autoload -U select-word-style
select-word-style bash
# Standard Linux
bindkey "^[[1;5C" forward-word
bindkey "^[[1;5D" backward-word
# Useful under iTerm
bindkey "-e"
bindkey "\eOH" beginning-of-line
bindkey "\eOF" end-of-line
bindkey "\e[1~" beginning-of-line
bindkey "\e[4~" end-of-line
bindkey "\e[3~" delete-char
bindkey "\eOA" history-search-backward
bindkey "\eOB" history-search-forward
bindkey "\e[A" history-search-backward
bindkey "\e[B" history-search-forward
# vim: set ts=4 sw=4 tw=0 ft=zsh :

21
zsh.d/20-complete.zsh Normal file
View File

@ -0,0 +1,21 @@
#######################################################################################
# Start autocomplete
autoload -U compinit; compinit -u
autoload -U compsys;
compctl -g "*(-/)" + -g ".*(-/)" cd
# allow approximate
zstyle ':completion:*' completer _complete _match _approximate
zstyle ':completion:*:match:*' original only
zstyle ':completion:*:approximate:*' max-errors 1 numeric
# # tab completion for PID :D
zstyle ':completion:*:*:kill:*' menu yes select
zstyle ':completion:*:kill:*' force-list always
# # cd not select parent dir
zstyle ':completion:*:cd:*' ignore-parents parent pwd
# compctl -g "*(-/)" + -g ".*(-/)" cd
#
# vim: set ts=4 sw=4 tw=0 ft=zsh :

52
zsh.d/20-termcolors.zsh Normal file
View File

@ -0,0 +1,52 @@
#######################################################################################
# Colorize terminal
autoload colors zsh/terminfo
zmodload zsh/terminfo
if [[ "$terminfo[colors]" -ge 8 ]]; then
colors
fi
# for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE; do
# eval PR_$color='%{$terminfo[bold]$fg[${(L)color}]%}'
# eval PR_LIGHT_$color='%{$fg[${(L)color}]%}'
# # (( count = $count + 1 ))
# done
# PR_NO_COLOR="%{$terminfo[sgr0]%}"
# unset color
#
typeset -Ag FX FG BG
FX=(
reset "%{%}"
bold "%{%}" no-bold "%{%}"
italic "%{%}" no-italic "%{%}"
underline "%{%}" no-underline "%{%}"
blink "%{%}" no-blink "%{%}"
reverse "%{%}" no-reverse "%{%}"
)
for color in {000..255}; do
FG[$color]="%{[38;5;${color}m%}"
BG[$color]="%{[48;5;${color}m%}"
done
ZSH_SPECTRUM_TEXT=${ZSH_SPECTRUM_TEXT:-Arma virumque cano Troiae qui primus ab oris}
# Show all 256 colors with color number
function spectrum_ls() {
for code in {000..255}; do
# print -P -- "$code: %F{$code}$ZSH_SPECTRUM_TEXT%f"
print -P -- "$FG[$code]$code: $ZSH_SPECTRUM_TEXT $FX[reset]"
done
}
# Show all 256 colors where the background is set to specific color
function spectrum_bls() {
for code in {000..255}; do
print -P -- "$BG[$code]$code: $ZSH_SPECTRUM_TEXT $FX[reset]"
done
}
# vim: set ts=4 sw=4 tw=0 ft=zsh :

41
zsh.d/30-aliases.zsh Normal file
View File

@ -0,0 +1,41 @@
#######################################################################################
# Aliases
alias ls='ls -F --color'
alias dir='ls -l'
alias la='ls -A'
alias ll='ls -l'
alias lla='ls -Al'
alias killall='killall -v'
alias cls='clear'
alias dc=cd
alias les=less
alias fu='sudo $(fc -ln -1)'
alias sudo='sudo '
alias mkdir='mkdir -p'
alias zap='rm -rf'
alias ftail='tail -f'
alias grep='grep --colour'
alias ns='host -t ns'
alias mx='host -t mx'
alias soa='host -t soa'
alias ptr='host -t ptr'
alias vi="vim "
alias du1="du -h --max-depth=1"
alias psg="ps ax|grep "
# Global Aliases
#
alias -g G="|grep "
alias -g L="|less"
alias -g NO="> /dev/null"
alias -g NE="2> /dev/null"
alias -g NA="> /dev/null 2>&1"
# vim: set ts=4 sw=4 tw=0 ft=zsh :

20
zsh.d/30-less.zsh Normal file
View File

@ -0,0 +1,20 @@
#######################################################################################
# Setup LESS
## make less colourful
LESS_TERMCAP_mb=$'\E[01;34m' # begin blinking
LESS_TERMCAP_md=$'\E[01;36m' # begin bold
LESS_TERMCAP_me=$'\E[0m' # end mode
LESS_TERMCAP_so=$'\E[01;47;34m' # begin standout-mode - info box
LESS_TERMCAP_se=$'\E[0m' # end standout-mode
LESS_TERMCAP_us=$'\E[04;32m' # begin underline
LESS_TERMCAP_ue=$'\E[0m' # end underline
LESS="-c -x4 -R -MM -PMFile\:?f%f:STDIN. ?BSize\:?B%B:Unk.?B\:?pb%pb\%:Unk.?B\:%i/%m"
LESSCHARSET=utf-8
READNULLCMD=/usr/bin/less
PAGER=/usr/bin/less
export LESS
export PAGER
# vim: set ts=4 sw=4 tw=0 ft=zsh :

5
zsh.d/30-prompt.zsh Normal file
View File

@ -0,0 +1,5 @@
fpath=($0:h/prompts $fpath)
autoload -U promptinit;promptinit
# vim: set ts=4 sw=4 tw=0 ft=zsh :

26
zsh.d/50-functions.zsh Normal file
View File

@ -0,0 +1,26 @@
#######################################################################################
# Functions
# cdb - Goes to folder by complete path
autoload -U cdb
# hist - Grep from history
autoload -U hist
# hdu - Human readable report of files and directories sizes
autoload -U hdu
# dust - list total size in . directory
autoload -U dust
# bak - remove backup files
autoload -U bak
#
# fancyTerm - returns true if we are on xterm/rxvt/screen, elsewhere false
autoload -U fancyTerm
# repo_char - returns a character based on the type of repo we are in
autoload -U repo_char
# vim: set ts=4 sw=4 tw=0 ft=zsh :

27
zsh.d/90-virtualenv.zsh Normal file
View File

@ -0,0 +1,27 @@
function venv {
# export WORKON_HOME=$HOME/Src/virtualenvs
# export PROJECT_HOME=$HOME/Src/projects
if [ -z $WORKON_HOME ] || [ -z $PROJECT_HOME ]; then
echo "Please, set WORKON_HOME and PROJECT_HOME first."
echo "Better place to set them is 99-local.zsh"
return
fi
VIRTUALENV_SCRIPT=/usr/local/bin/virtualenvwrapper.sh
[ -d $WORKON_HOME ] || mkdir -p $WORKON_HOME
[ -d $PROJECT_HOME ] || mkdir -p $PROJECT_HOME
source $VIRTUALENV_SCRIPT
echo "virtualenv enabled."
echo "WORKON_HOME: $WORKON_HOME"
echo "PROJECT_HOME: $PROJECT_HOME"
echo
echo "Virtualenvs:"
lsvirtualenv -b
echo
}
# vim: set ts=4 sw=4 tw=0 ft=sh :

View File

@ -0,0 +1,13 @@
# Darwin/OSX
# Environment and aliases for OSX
export LSCOLORS="GxgxcxdxCxegedabagacad"
alias ldd='otool -L'
alias ls='ls -F -G'
alias skill=killall
alias lsrebuild='/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -r -domain local -domain system -domain user'
alias vim='/Applications/MacVim.app/Contents/MacOS/Vim'
# alias mvim='mvim --remote-tab-silent '
# alias mvim='open -a MacVim '
# vim: set ts=4 sw=4 tw=0 ft=zsh :

View File

@ -0,0 +1,52 @@
# Mac Ports
[ ! -d /opt/local ] && return
# Setup PATH
if [ -z "$PATH" ]; then
PATH=/opt/local/bin:/opt/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin:~/bin
else
PATH=/opt/local/bin:/opt/local/sbin:$PATH
fi
export PATH
# # Setup MANPATH
# if [ -z "$MANPATH" ]; then
# MANPATH=`/usr/bin/manpath`
# fi
# MANPATH=/opt/local/man:$MANPATH
# export MANPTH
# # Setup INFOPATH
# if [ -z "$INFOPATH" ]; then
# INFOPATH=/opt/local/share/info:/opt/local/info:/usr/share/info
# else
# INFOPATH=/opt/local/share/info:/opt/local/info:$INFOPATH
# fi
# export INFOPATH
if [ -z "$PERL5LIB" ]; then
PERL5LIB=/opt/local/lib/perl5:/opt/local/lib/perl5/darwin
else
PERL5LIB=/opt/local/lib/perl5:/opt/local/lib/perl5/darwin:$PERL5LIB
fi
export PERL5LIB
# Add X11 paths (but only if the directories are readable)
if [ -r /usr/X11R6/bin ]; then
PATH=$PATH:/usr/X11R6/bin
export PATH
fi
# if [ -r /usr/X11R6/man ]; then
# MANPATH=$MANPATH:/usr/X11R6/man
# export MANPATH
# fi
# PY_VER="2.7"
# PYTHONPATH="/opt/local/lib/python/site-packages:/opt/local/Library/Frameworks/Python.framework/Versions/${PY_VER}/lib/python${PY_VER}/site-packages/"
# #PYTHONHOME="/opt/local/Library/Frameworks/Python.framework/Versions/${PY_VER}"
# export PYTHONPATH
#export PYTHONHOME
# vim: set ts=4 sw=4 tw=0 ft=zsh :

View File

@ -0,0 +1,19 @@
# Core Utils
which gcp > /dev/null
if [ $? -eq 0 ]; then
if [ -f /etc/zsh/gdircolors ]; then
eval `gdircolors /etc/zsh/gdircolors`
else
eval `gdircolors`
fi
#alias ls='gls --color -F' # OSX ls is better (supports extended attributes)
alias ll='ls -l'
alias la='ls -a'
alias cp='gcp'
alias mv='gmv'
alias rm='grm'
alias du='gdu'
alias df='gdf -a'
fi
# vim: set ts=4 sw=4 tw=0 ft=zsh :

View File

@ -0,0 +1,25 @@
BASE='/LDAPv3/dioniso.cube.lan'
KEYWORD="desktop"
function dsComputerUserList {
for c in `dscl $BASE -search Computers Keywords desktop|grep Keywords|cut -f1|sort`; do
echo -n $c:
dscl $BASE -read Computers/$c Comment|cut -d: -f3
done
}
function dsComputerList {
for c in `dsComputerUserList`; do
echo $c|cut -d: -f1
done
}
function dsUser {
COMPUTER=${1-`dscl . -list Computers|grep -v localhost`}
dsComputerUserList| grep -i $COMPUTER|cut -d: -f2
}
unset BASE
unset KEYWORD
# vim: set ts=4 sw=4 tw=0 ft=zsh :

2
zsh.d/Darwin/90-less.zsh Normal file
View File

@ -0,0 +1,2 @@
LESSPIPE=`whence -p lesspipe || whence -p lesspipe.sh`
eval `$LESSPIPE`

47
zsh.d/Darwin/mvim.diff Normal file
View File

@ -0,0 +1,47 @@
--- mvim~ 2013-07-09 21:55:06.000000000 +0200
+++ mvim 2013-07-07 21:24:15.000000000 +0200
@@ -13,6 +13,8 @@
# or by un-commenting and editing the following line:
# VIM_APP_DIR=/Applications
+tabs=true
+
if [ -z "$VIM_APP_DIR" ]
then
myDir="`dirname "$0"`"
@@ -58,15 +60,26 @@
esac
# Last step: fire up vim.
-# The program should fork by default when started in GUI mode, but it does
-# not; we work around this when this script is invoked as "gvim" or "rgview"
-# etc., but not when it is invoked as "vim -g".
if [ "$gui" ]; then
- # Note: this isn't perfect, because any error output goes to the
- # terminal instead of the console log.
- # But if you use open instead, you will need to fully qualify the
- # path names for any filenames you specify, which is hard.
- exec "$binary" -g $opts ${1:+"$@"}
+ if $tabs && [[ `$binary --serverlist` = "VIM" ]]; then
+ exec "$binary" -g $opts --remote-tab-silent ${1:+"$@"}
+ else
+ exec "$binary" -g $opts ${1:+"$@"}
+ fi
else
- exec "$binary" $opts ${1:+"$@"}
+ exec "$binary" $opts ${1:+"$@"}
fi
+
+# # Last step: fire up vim.
+# # The program should fork by default when started in GUI mode, but it does
+# # not; we work around this when this script is invoked as "gvim" or "rgview"
+# # etc., but not when it is invoked as "vim -g".
+# if [ "$gui" ]; then
+ # # Note: this isn't perfect, because any error output goes to the
+ # # terminal instead of the console log.
+ # # But if you use open instead, you will need to fully qualify the
+ # # path names for any filenames you specify, which is hard.
+ # exec "$binary" -g $opts ${1:+"$@"}
+# else
+ # exec "$binary" $opts ${1:+"$@"}
+# fi

14
zsh.d/Linux/50-linux.zsh Normal file
View File

@ -0,0 +1,14 @@
# Linux
if which dircolors > /dev/null; then
if [ -f /etc/dir_colors ]; then
eval `dircolors /etc/dir_colors`
else
eval `dircolors`
fi
fi
alias ls='LANG=C ls -F --color=auto --group-directories-first'
alias open='xdg-open '
# vim: set ts=4 sw=4 tw=0 ft=zsh :

2
zsh.d/Linux/90-less.zsh Normal file
View File

@ -0,0 +1,2 @@
LESSPIPE=`whence -p lesspipe || whence -p lesspipe.sh`
eval `$LESSPIPE`

15
zsh.d/README-local.txt Normal file
View File

@ -0,0 +1,15 @@
File 99-local.zsh is autocreated in zsh.d and zsh.d/$KERNEL
Useful customizations that you can add are
prompt <promptname> - redefine prompt
To use virtualenvs you MUST define
export WORKON_HOME <path to virtualenvs>
export PROJECT_HOME <path to projects>
then you can explicitly call 'venv' or leave it as a function to invoke at the
right moment
/* vim: set ts=4 sw=4 tw=78 ft=text : */

417
zsh.d/completions/_adb Normal file
View File

@ -0,0 +1,417 @@
#compdef adb
# ------------------------------------------------------------------------------
# Copyright (c) 2011 Github zsh-users - http://github.com/zsh-users
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the zsh-users nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL ZSH-USERS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# ------------------------------------------------------------------------------
# Description
# -----------
#
# Completion script for adb (Android Debug Bridge) 1.0.26
# (http://developer.android.com/guide/developing/tools/adb.html).
#
# ------------------------------------------------------------------------------
# Authors
# -------
#
# * Julien Nicoulaud <julien.nicoulaud@gmail.com>
#
# ------------------------------------------------------------------------------
_adb() {
typeset -A opt_args
local context state line curcontext="$curcontext" adb_args
local ret=1
_arguments -C \
'(-e -s)-d[directs command to the only connected USB device, returns an error if more than one USB device is present]' \
'(-d -s)-e[directs command to the only running emulator, returns an error if more than one emulator is running]' \
'(-d -e)-s[directs command to the USB device or emulator with the given serial number]: :_adb_serial_numbers' \
'-p[simple product name or a relative/absolute path to a product out directory]: :_adb_products' \
'1: :_adb_cmds' \
'*::arg:->args' \
&& ret=0
adb_args="${(fkv)opt_args[(I)-d|-e|-s|-p]}"
case "$state" in
(args)
curcontext="${curcontext%:*:*}:adb-cmd-$words[1]:"
case $words[1] in
(help|version|devices|jdwp|bugreport|wait-for-device|start-server|kill-server|get-state|get-serialno|status-window|remount|reboot-bootloader|root|usb)
_message 'no more arguments' && ret=0
;;
(connect|disconnect)
_arguments \
'1: :_adb_host_colon_ports' \
&& ret=0
;;
(push)
_arguments \
'1:local directory:_files -/' \
'2: :_adb_remote_files -/' \
&& ret=0
;;
(pull)
_arguments \
'1: :_adb_remote_files -/' \
'2:local directory:_files -/' \
&& ret=0
;;
(sync)
_arguments \
'-l[list but do not copy]' \
'1: :_adb_sync_directories' \
&& ret=0
;;
(shell|emu)
_arguments -C \
'1: :_adb_remote_commands' \
'*::remote-command-arg:->remote-command-args' \
&& ret=0
case "$state" in
(remote-command-args)
curcontext="${curcontext%:*:*}:adb-remote-cmd-$words[1]:"
if (( $+functions[_adb_remote_command_$words[1]_args] )); then
_adb_remote_command_$words[1] && ret=0
# TODO Write handlers for following commands:
# * am (Activity Manager)
# * pm (Package Manager)
# TODO Reuse existing compdefs for standard commands (ls, id, ifconfig, kill, etc) ?
# How do we tell them to use _remote_ files/pids/users/etc ?
else
_adb_remote_command_default && ret=0
fi
;;
esac
;;
(logcat)
local -a rotation_opts
[[ -n ${(M)words:#"-f"} ]] && rotation_opts+=('-r[rotates the log file every kbytes of output. The default value is 16]:value (in kb)')
[[ -n ${(M)words:#"-r"} ]] && rotation_opts+=('-n[sets the maximum number of rotated logs. The default value is 4]:count')
_arguments \
'-b[loads an alternate log buffer for viewing, such as event or radio. The main buffer is used by default]: :_adb_logcat_buffers' \
'-c[clears (flushes) the entire log and exits]' \
'-d[dumps the log to the screen and exits]' \
'-f[writes log message output to file. The default is stdout]: :_files' \
'-g[prints the size of the specified log buffer and exits]' \
'-s[sets the default filter spec to silent]' \
'-v[sets the output format for log messages]: :_adb_logcat_output_formats' \
"${rotation_opts[@]}" \
'*: :_adb_logcat_filter_specs' \
&& ret=0
;;
(forward)
_arguments \
'1: :_adb_local_forward_specs' \
'2: :_adb_remote_forward_specs' \
&& ret=0
;;
(install)
_arguments \
'-l[forward-lock the app]' \
'-r[reinstall the app, keeping its data]' \
'-s[install on SD card instead of internal storage]' \
'1: :_files' \
&& ret=0
;;
(uninstall)
_arguments \
'-k[keep the data and cache directories]' \
'1: :_adb_packages' \
&& ret=0
;;
(reboot)
_arguments \
'1:program:((bootloader:reboot\ into\ the\ bootloader\ program recovery:reboot\ into\ the\ recovery\ program))' \
&& ret=0
;;
(tcpip)
_arguments \
'1::port' \
&& ret=0
;;
(ppp)
# TODO Complete tty (See http://developer.android.com/guide/developing/tools/adb.html#commandsummary)
# TODO Complete PPP parameters (See http://ppp.samba.org/pppd.html)
_arguments \
'1::tty' \
'*::parameters' \
&& ret=0
;;
esac
;;
esac
return ret
}
(( $+functions[_adb_cmds] )) ||
_adb_cmds() {
_alternative \
'general-commands:general command:_adb_general_cmds' \
'device-commands:device command:_adb_device_cmds' \
'scripting-commands:scripting command:_adb_scripting_cmds'
}
(( $+functions[_adb_general_cmds] )) ||
_adb_general_cmds() {
local commands; commands=(
'help:show help message'
'version:show version number'
'devices:list all connected devices'
'connect:connect to a device via TCP/IP'
'disconnect:disconnect from a TCP/IP device'
)
_describe -t general-commands 'general command' commands "$@"
}
(( $+functions[_adb_device_cmds] )) ||
_adb_device_cmds() {
local commands; commands=(
'push:copy file/dir to device'
'pull:copy file/dir from device'
'sync:copy host->device only if changed'
'shell:run remote shell interactively or command'
'emu:run emulator console command'
'logcat:view device log'
'forward:forward socket connections'
'jdwp:list PIDs of processes hosting a JDWP transport'
'install:push this padbage file to the device and install it'
'uninstall:remove this app padbage from the device'
'bugreport:return all information from the device'
)
_describe -t device-commands 'device command' commands "$@"
}
(( $+functions[_adb_scripting_cmds] )) ||
_adb_scripting_cmds() {
local commands; commands=(
'wait-for-device:block until device is online'
'start-server:ensure that there is a server running'
'kill-server:kill the server if it is running'
'get-state:prints\: offline | bootloader | device'
'get-serialno:prints\: <serial-number>'
'status-window:continuously print device status for a specified device'
'remount:remounts the /system partition on the device read-write'
'reboot:reboots the device, optionally into the bootloader or recovery program'
'reboot-bootloader:reboots the device into the bootloader'
'root:restarts the adbd daemon with root permissions'
'usb:restarts the adbd daemon listening on USB'
'tcpip:restarts the adbd daemon listening on TCP on the specified port'
'ppp:run PPP over USB'
)
_describe -t scripting-commands 'scripting command' commands "$@"
}
(( $+functions[_adb_products] )) ||
_adb_products() {
_alternative \
'product-names:product name:_adb_product_names' \
'directories:directory:_files -/'
}
(( $+functions[_adb_product_names] )) ||
_adb_product_names() {
local ret=1
if [[ -n "$ANDROID_PRODUCT_OUT" ]]; then
local product_names; product_names=("$ANDROID_PRODUCT_OUT:default value set in ANDROID_PRODUCT_OUT environment variable")
_describe -t product-names 'product name' product_names && ret=0
else
_message -e product-names 'product name' && ret=0
fi
return ret
}
(( $+functions[_adb_serial_numbers] )) ||
_adb_serial_numbers() {
local serial_numbers; serial_numbers=(${${(M)${(f)"$(_call_program devices $service devices)"}:#*device}%%[[:space:]]*}":connected device")
[[ -n "$ANDROID_SERIAL" ]] && serial_numbers+=("$ANDROID_SERIAL:default value set in ANDROID_SERIAL environment variable")
_describe -t serial-numbers 'serial number' serial_numbers "$@" && ret=0
}
(( $+functions[_adb_packages] )) ||
_adb_packages() {
local packages; packages=(${${(ps:\r\n:)"$(_call_program packages $service $adb_args shell 'ls /data/data 2>/dev/null')"}:#\**\*})
_multi_parts . packages
}
(( $+functions[_adb_host_colon_ports] )) ||
_adb_host_colon_ports() {
local ret=1
if compset -P '*:'; then
_message -e ports 'port' && ret=0
else
_wanted hosts expl 'host' _hosts -qS: && ret=0
fi
return ret
}
(( $+functions[_adb_remote_files] )) ||
_adb_remote_files() {
local dirsonly command="ls -d ${(S)words[CURRENT]/\/*//}*/ 2>/dev/null"
zparseopts -D -E '/=dirsonly'
(( ! $#dirsonly )) && command+="; ls -d ${words[CURRENT]}* 2>/dev/null"
local files; files=(${${(ps:\r\n:)"$(_call_program files $service $adb_args shell "'$command'" 2>/dev/null)"}:#\**\*})
_multi_parts "$@" / files
}
(( $+functions[_adb_remote_commands] )) ||
_adb_remote_commands() {
local commands; commands=(${${(ps:\r\n:)"$(_call_program commands $service $adb_args shell "'IFS=:;for path_dir in \$PATH; do ls \$path_dir 2>/dev/null; done'" 2>/dev/null)"}:#\**\*})
_describe -t remote-commands 'remote command' commands && ret=0
}
(( $+functions[_adb_local_forward_specs] )) ||
_adb_local_forward_specs() {
local ret=1
if compset -P '*:'; then
case ${IPREFIX%:} in
(tcp)
_message -e ports 'port' && ret=0
;;
(localabstract|localreserved)
_wanted sockets expl 'socket' _socket && ret=0
;;
(localfilesystem)
_wanted socket-files expl 'socket file' _files && ret=0
;;
(dev)
_wanted devices expl 'device' _files -g "/dev/**" && ret=0
;;
esac
else
local modes; modes=(
'tcp:TCP socket'
'localabstract:local abstract socket'
'localreserved:local reserved socket'
'localfilesystem:local filesystem socket'
'dev:device'
)
_describe -t forward-modes 'forward mode' modes -qS: && ret=0
fi
return ret
}
(( $+functions[_adb_remote_forward_specs] )) ||
_adb_remote_forward_specs() {
local ret=1
if compset -P '*:'; then
case ${IPREFIX%:} in
(tcp)
_message -e ports 'remote port' && ret=0
;;
(localabstract|localreserved|localfilesystem)
_message -e sockets 'remote socket' && ret=0
;;
(dev)
_message -e devices 'remote device' && ret=0
;;
(jdwp)
local pids; pids=(${${(f)"$(_call_program pids $service $adb_args jdwp 2>/dev/null)"}:#\**\*})
_describe -t remote-pids 'remote pid' pids && ret=0
;;
esac
else
local modes; modes=(
'tcp:TCP socket'
'localabstract:local abstract socket'
'localreserved:local reserved socket'
'localfilesystem:local filesystem socket'
'dev:device'
'jdwp:Java Debug Wire Protocol'
)
_describe -t forward-modes 'forward mode' modes -qS: && ret=0
fi
return ret
}
(( $+functions[_adb_sync_directories] )) ||
_adb_sync_directories() {
_alternative \
'partitions:partition:((system:the\ /system\ partition data:the\ /data\ partition))' \
'directories:directory:_adb_remote_files -/'
}
(( $+functions[_adb_logcat_filter_specs] )) ||
_adb_logcat_filter_specs() {
local ret=1
if compset -P '*:'; then
local priorities; priorities=(
'V:verbose (lowest priority)'
'D:debug'
'I:info'
'W:warning'
'E:error'
'F:fatal'
'S:silent (highest priority, on which nothing is ever printed)'
)
_describe -t log-priorities 'log priority' priorities "$@" && ret=0
else
local tags; tags=(${(u)${${${(f)"$(_call_program tags $service $adb_args logcat -d 2>/dev/null)"}%%[[:space:]]#\(*}##*\/}:#\**\*})
_describe -t log-tags 'log tag' tags -qS: "$@" && ret=0
fi
return ret
}
(( $+functions[_adb_logcat_output_formats] )) ||
_adb_logcat_output_formats() {
local formats; formats=(
'brief:display priority/tag and PID of originating process (the default format)'
'process:display PID only'
'tag:display the priority/tag only'
'thread:display process:thread and priority/tag only'
'raw:display the raw log message, with no other metadata fields'
'time:display the date, invocation time, priority/tag, and PID of the originating process'
'long:display all metadata fields and separate messages with a blank lines'
)
_describe -t log-formats 'log format' formats "$@" && ret=0
}
(( $+functions[_adb_logcat_buffers] )) ||
_adb_logcat_buffers() {
local buffers; buffers=(
'main:view the main log buffer (default)'
'radio:view the buffer that contains radio/telephony related messages'
'events:view the buffer containing events-related messages'
)
_describe -t log-buffers 'log buffer' buffers "$@" && ret=0
}
(( $+functions[_adb_remote_command_default] )) ||
_adb_remote_command_default() {
_wanted remote-files expl 'remote file' _adb_remote_files
}
_adb "$@"
# Local Variables:
# mode: Shell-Script
# sh-indentation: 2
# indent-tabs-mode: nil
# sh-basic-offset: 2
# End:
# vim: ft=zsh sw=2 ts=2 et

81
zsh.d/completions/_cpanm Normal file
View File

@ -0,0 +1,81 @@
#compdef cpanm
# ------------------------------------------------------------------------------
# Description
# -----------
#
# Completion script for cpanm (http://search.cpan.org/dist/App-cpanminus/lib/App/cpanminus.pm).
#
# Source: https://github.com/rshhh/cpanminus/blob/master/etc/_cpanm
#
# ------------------------------------------------------------------------------
# Authors
# -------
#
# * Ryushi (https://github.com/rshhh)
#
# ------------------------------------------------------------------------------
local arguments curcontext="$curcontext"
typeset -A opt_args
arguments=(
# Commands
# '(--install -i)'{--install,-i}'[Installs the modules]'
'(- :)--self-upgrade[Upgrades itself]'
'(- :)--info[Displays distribution info on CPAN]'
'(--installdeps)--installdeps[Only install dependencies]'
'(--look)--look[Download/unpack the distribution and then open the directory with your shell]'
'(- :)'{--help,-h}'[Displays help information]'
'(- :)'{--version,-V}'[Displays software version]'
# Options
{--force,-f}'[Force install]'
{--notest,-n}'[Do not run unit tests]'
{--sudo,-S}'[sudo to run install commands]'
'(-v --verbose --quiet -q)'{--verbose,-v}'[Turns on chatty output]'
'(-q --quiet --verbose -v)'{--quiet,-q}'[Turns off all output]'
{--local-lib,-l}'[Specify the install base to install modules]'
{--local-lib-contained,-L}'[Specify the install base to install all non-core modules]'
'--mirror[Specify the base URL for the mirror (e.g. http://cpan.cpantesters.org/)]:URLs:_urls'
'--mirror-only[Use the mirror\''s index file instead of the CPAN Meta DB]'
'--prompt[Prompt when configure/build/test fails]'
'--reinstall[Reinstall the distribution even if you already have the latest version installed]'
'--interactive[Turn on interactive configure]'
'--scandeps[Scan the depencencies of given modules and output the tree in a text format]'
'--format[Specify what format to display the scanned dependency tree]:scandeps format:(tree json yaml dists)'
'--save-dists[Specify the optional directory path to copy downloaded tarballs]'
# '--uninst-shadows[Uninstalls the shadow files of the distribution that you\''re installing]'
'--auto-cleanup[Number of days that cpanm\''s work directories expire in. Defaults to 7]'
'(--no-man-pages)--man-pages[Generates man pages for executables (man1) and libraries (man3)]'
'(--man-pages)--no-man-pages[Do not generate man pages]'
# Note: Normally with "--lwp", "--wget" and "--curl" options set to true (which is the default) cpanm tries LWP,
# Wget, cURL and HTTP::Tiny (in that order) and uses the first one available.
# (So that the exclusions are not enabled here for the completion)
'(--lwp)--lwp[Use LWP module to download stuff]'
'(--wget)--wget[Use GNU Wget (if available) to download stuff]'
'(--curl)--curl[Use cURL (if available) to download stuff]'
# Other completions
'*:Local directory or archive:_files -/ -g "*.(tar.gz|tgz|tar.bz2|zip)(-.)"'
# '*::args: _normal' # this looks for default files (any files)
)
_arguments -s $arguments \
&& return 0
return 1
# Local Variables:
# mode: Shell-Script
# sh-indentation: 2
# indent-tabs-mode: nil
# sh-basic-offset: 2
# End:
# vim: ft=zsh sw=2 ts=2 et

View File

@ -0,0 +1,65 @@
#compdef debuild
# ------------------------------------------------------------------------------
# Copyright (c) 2011 Github zsh-users - http://github.com/zsh-users
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the zsh-users nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL ZSH-USERS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# ------------------------------------------------------------------------------
# Description
# -----------
#
# Completion script for debuild 2.10.
#
# Status: incomplete.
#
# ------------------------------------------------------------------------------
# Authors
# -------
#
# * Julien Nicoulaud <julien.nicoulaud@gmail.com>
#
# ------------------------------------------------------------------------------
# FIXME --noconf is only allowed in first position
_arguments \
'(- 1 *)'{-h,--help}'[show help]' \
'(- 1 *)--version[show version and copyright information]' \
{--no-conf,--noconf}'[don'\''t read devscripts config files]' \
{-r-,--rootcmd=}'[command used to become root if debuild not setuid root (default: fakeroot)]: :_command_names' \
'*'{-e-,--preserve-envvar=}'[preserve environment variable]: :_vars' \
'(-e --preserve-envvar)--preserve-env[preserve all environment vars (except PATH)]' \
'*'{-e-,--set-envvar=}'[preserve environment variable]: :_vars -qS=' \
'--prepend-path=[prepend to the sanitised PATH]: :_files -/' \
'(-D)-d[skip checking of build dependencies]' \
'(-d)-D[force checking of build dependencies]' \
'--check-dirname-level[how much to check directory names]:level:((0\:never 1\:only\ if\ program\ changes\ directory\ \(default\) 2\:always))' \
'--check-dirname-regex[Perl regex defining matching directory names, the string PACKAGE will be replaced by the package name (default: '\''PACKAGE(-.+)?'\'')]:regex'
# Local Variables:
# mode: Shell-Script
# sh-indentation: 2
# indent-tabs-mode: nil
# sh-basic-offset: 2
# End:
# vim: ft=zsh sw=2 ts=2 et

125
zsh.d/completions/_pip Normal file
View File

@ -0,0 +1,125 @@
#compdef pip
# ------------------------------------------------------------------------------
# Description
# -----------
#
# Completion script for pip (http://pypi.python.org/pypi/pip).
#
# Source: https://github.com/technolize/zsh-completion-funcs
#
# ------------------------------------------------------------------------------
# Authors
# -------
#
# * technolize (https://github.com/technolize)
#
# ------------------------------------------------------------------------------
local ret=1 state
local -a common_ops
common_ops=(
"--version[display version number]"
{-h,--help}"[show help]"
{-E,--environment=}"[virtualenv environment to run pip]:environment:_directories"
{-s,--enable-site-packages}"[include site-packages in virtualenv]"
{-v,--verbose}"[give more output]"
{-q,--quiet}"[give less output]"
"--log=[log file where a complete record will be kept]"
"--proxy=[specify a proxy in the form user:passwd@proxy.server:port]:proxy"
"--timeout=[set the socket timeout (default 15 seconds)]:second"
)
_directories () {
_wanted directories expl directory _path_files -/ "$@" -
}
typeset -A opt_args
_arguments \
':subcommand:->subcommand' \
$common_ops \
'*::options:->options' && ret=0
case $state in
subcommand)
local -a subcommands
subcommands=(
"bundle:create pybundle"
"freeze:put all currently installed packages"
"help:show available commands"
"install:install packages"
"search:search pypi"
"uninstall:uninstall packages"
"unzip:unzip undividual packages"
"zip:zip dividual packages"
)
_describe -t subcommands 'pip subcommand' subcommands && ret=0
;;
options)
local -a args
args=(
$common_ops
)
local -a requirement
requirement=(
{-r,--requirement=}"[install all the packages listed in the given requirements file]:filename:_files"
)
local -a findlink
findlink=(
{-f,--find-links=}"[URL to look for packages at]:url"
)
case $words[1] in
bundle | install)
args+=(
{-e,--editable=}"[install a package directly from a checkout]:VCS+REPOS_URL[@REV]#egg=PACKAGE"
$requirement
$findlink
{-i,--index-url=,--pypi-url=}"[base URL of Python Package Index]:URL"
"--extra-index-url=[extra URLs of package indexes to use]:URL"
{-b,--build=,--build-dir=}"[unpack packages into DIR]:directory:_directories"
{--src=,--source=}"[check out --editable packages into DIR]:directory:_directories"
{-U,--upgrade}"[upgrade all packages to the newest available version]"
{-I,--ignore-installed}"[ignore the installed packages]"
"--noinstall[download and unpack all packages, but don't actually install them]"
"--install-option=[extra arguments to be supplied to the setup.py install command]"
)
;;
freeze)
args+=(
$requirement
$findlink
)
;;
unzip | zip)
args+=(
"--unzip[unzip a package]"
"--no-pyc[do not include .pyc files in zip files]"
{-l,--list}"[list the packages available, and their zip status]"
"--sort-files[with --list, sort packages according to how many files they contain]"
"--path=[restrict operation to the given paths]:paths"
{-n,--simulate}"[do not actually perform the zip/unzip operation]"
)
;;
esac
_arguments $args && ret=0
;;
esac
return ret
# Local Variables:
# mode: Shell-Script
# sh-indentation: 2
# indent-tabs-mode: nil
# sh-basic-offset: 2
# End:
# vim: ft=zsh sw=2 ts=2 et

102
zsh.d/completions/_port Normal file
View File

@ -0,0 +1,102 @@
#compdef port
# ------------------------------------------------------------------------------
# Description
# -----------
#
# Completion script for MacPorts (http://www.macports.org).
#
# ------------------------------------------------------------------------------
# Authors
# -------
#
# * Matt Cable <wozz@wookie.net>
# * Sorin Ionescu <sorin.ionescu@gmail.com>
#
# ------------------------------------------------------------------------------
local subcmds
subcmds=(
'activate'
'archive'
'build'
'cat'
'clean'
'configure'
'contents'
'deactivate'
'dependents'
'deps'
'destroot'
'dir'
'distcheck'
'distclean'
'dmg'
'echo'
'edit'
'extract'
'fetch'
'file'
'help'
'info'
'install'
'installed'
'list'
'livecheck'
'location'
'mpkg'
'outdated'
'patch'
'pkg'
'provides'
'rpmpackage'
'search'
'selfupdate'
'sync'
'test'
'unarchive'
'uninstall'
'upgrade'
'variants'
'version'
)
_arguments -C \
'-v[verbose mode (generate verbose messages)]' \
'-d[debug mode (generate debugging messages)]' \
'-q[quiet mode (suppress messages)]' \
'-D[specify portdir]' \
'-k[keep mode (do not autoclean after install)]' \
'-n[dont follow dependencies in upgrade (only for upgrading)]' \
'-a[upgrade all installed ports (only for upgrading)]' \
'-u[uninstall non-active ports when upgrading and uninstalling]' \
'-f[force mode (ignore state file)]' \
'-s[source-only mode]' \
'-b[binary-only mode]' \
'-o[honor state files older than Portfile]' \
'*::command:->command' \
&& return 0
case "$state" in
(command)
if (( CURRENT == 1 )); then
state='subcommands'
else
state='portname'
fi
;;
esac
case "$state" in
(subcommands)
_describe -t commands 'port commands' subcmds
;;
(portname)
# Cache the list of ports.
if (( ! $+_port_list )); then
_port_list=($(port echo all; echo "all current active inactive installed uninstalled outdated"))
fi
_describe -t commands 'available ports' _port_list
;;
esac

117
zsh.d/completions/_salt Normal file
View File

@ -0,0 +1,117 @@
#compdef salt
# ------------------------------------------------------------------------------
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the zsh-users nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL ZSH-USERS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# ------------------------------------------------------------------------------
# Description
# -----------
#
# Completion script for salt (http://saltstack.com/).
#
# ------------------------------------------------------------------------------
# Authors
# -------
#
# * Massimiliano Torromeo <massimiliano.torromeo@gmail.com>
#
# ------------------------------------------------------------------------------
_minions() {
ls /etc/salt/pki/master/minions | while read minion; do
_wanted 'target' expl 'target' compadd $minion
done
}
_modules() {
for module in $(salt-call sys.list_modules 2&>/dev/null --output=key | tail -n+2); do
_wanted 'module' expl 'module' compadd $module
done
}
_functions() {
for fn in $(salt-call sys.list_functions 2&>/dev/null --output=key | tail -n+2); do
_wanted 'function' expl 'function' compadd $fn
done
}
_salt() {
local _loglevels
_loglevels=(all garbage trace debug info warning error quiet)
_arguments -s \
"--version[show program's version number and exit]" \
"--versions-report[show program's dependencies version number and exit]" \
"(-h --help)"{-h,--help}"[show help message and exit]" \
"(-c --config-dir)"{-c+,--config-dir=}"[Pass in an alternative configuration directory.]:configuration directory:_files -/" \
"(-t --timeout)"{-t+,--timeout=}"[Change the timeout, if applicable, for the running command]:timeout" \
"(-s --static)"{-s,--static}"[Return the data from minions as a group after they all return]" \
"--async[Run the salt command but don't wait for a reply]" \
"(--state-output --state_output)"{--state-output=,--state_output=}"[Override the configured state_output value for minion output]:state output" \
"--subset=[Execute the routine on a random subset of the targeted minions]:subset" \
"(-v --verbose)"{-v,--verbose}"[Turn on command verbosity, display jid and active job queries]" \
"--show-timeout[Display minions that timeout]" \
"(-b --batch --batch-size)"{-b+,--batch=,--batch-size=}"[Execute the salt job in batch mode]:batch" \
"(-a --auth --eauth --extended-auth)"{-a+,--auth=,--eauth=,--extended--auth=}"[Specify an extended authentication system to use]:eauth" \
"(-T --make-token)"{-T,--make-token}"[Generate and save an authentication token for re-use]" \
"--return=[Set an alternative return method]:returner" \
"(-d --doc --documentation)"{-d,--doc,--documentation}"[Return the documentation for the specified module or for all modules]::function:_functions" \
"--args-separator=[Set the special argument used as a delimiter between command arguments of compound commands]:args separator" \
\
"(-l --log-level)"{-l+,--log-level=}"[Console logging log level]:level:($_loglevels[@])" \
"--log-file=[Log file path]:log file:_files" \
"--log-file-level=[Logfile logging log level]:level:($_loglevels[@])" \
\
"(-E --pcre)"{-E,--pcre}"[Target servers using pcre regular expressions]" \
"(-L --list)"{-L,--list}"[Target servers using a comma or space delimited list of servers]" \
"(-G --grain)"{-G,--grain}"[Target servers using a grain value]" \
"--grain-pcre[Target servers using a grain value matched by a pcre regular expression]" \
"(-N --nodegroup)"{-N,--nodegroup}"[Target servers using a predefined nodegroup]" \
"(-R --range)"{-R,--range}"[Target servers using range expression]" \
"(-C --compound)"{-C,--compound}"[Target servers using compound selectors]" \
"(-X --exsel)"{-X,--exsel}"[Target servers using the return code of a function]" \
"(-I --pillar)"{-I,--pillar}"[Target servers using a pillar value]" \
"(-S --ipcidr)"{-S,--ipcidr}"[Match servers based on subnet (CIDR or IPv4 address)]" \
\
"(--out --output)"{--out=,--output=}"[Print the output using the specified outputter]:outputter:(no_return grains yaml overstatestage json pprint nested raw highstate quiet key txt virt_query)" \
"(--out-indent --output-indent)"{--out-indent=,--output-indent=}"[Print the output indented by the provided value in spaces]:nr spaces" \
"(--out-file --output-file)"{--out-file=,--output-file=}"[Write the output to the specified file]:output:_files" \
"(--no-color --no-colour)"{--no-color,--no-colour}"[Disable all colored output]" \
"(--force-color --force-colour)"{--force-color,--force-colour}"[Force colored output]" \
\
'1:target:_minions' \
'2:function:_functions' \
'*::arguments'
}
case "$service" in
salt)
_salt "@"
;;
esac
# Local Variables:
# mode: Shell-Script
# sh-indentation: 2
# indent-tabs-mode: nil
# sh-basic-offset: 2
# End:
# vim: ft=zsh sw=2 ts=2 et

708
zsh.d/completions/_setup.py Normal file
View File

@ -0,0 +1,708 @@
#compdef setup.py
# ------------------------------------------------------------------------------
# Description
# -----------
#
# Completion script for setup.py (http://docs.python.org/distutils/).
#
# ------------------------------------------------------------------------------
# Authors
# -------
#
# * Hideo Hattori (https://github.com/hhatto)
#
# ------------------------------------------------------------------------------
_setup.py() {
typeset -A opt_args
local context state line
_arguments -s -S \
"--verbose[run verbosely (default)]" \
"-v[run verbosely (default)]" \
"--quiet[run quietly (turns verbosity off)]" \
"-q[run quietly (turns verbosity off)]" \
"--dry-run[don't actually do anything]" \
"-n[don't actually do anything]" \
"--help[show detailed help message]" \
"-h[show detailed help message]" \
"--no-user-cfg[ignore pydistutils.cfg in your home directory]" \
"--command-packages=[list of packages that provide distutils commands]" \
"--help-commands[list all available commands]" \
"--name[print package name]" \
"--version[print package version]" \
"-V[print package version]" \
"--fullname[print <package name>-<version>]" \
"--author[print the author's name]" \
"--author-email[print the author's email address]" \
"--maintainer[print the maintainer's name]" \
"--maintainer-email[print the maintainer's email address]" \
"--contact[print the maintainer's name if known, else the author's]" \
"--contact-email[print the maintainer's email address if known, else the author's]" \
"--url[print the URL for this package]" \
"--license[print the license of the package]" \
"--licence[alias for --license]" \
"--description[print the package description]" \
"--long-description[print the long package description]" \
"--platforms[print the list of platforms]" \
"--classifiers[print the list of classifiers]" \
"--keywords[print the list of keywords]" \
"--provides[print the list of packages/modules provided]" \
"--requires[print the list of packages/modules required]" \
"--obsoletes[print the list of packages/modules made obsolete]" \
"*::setup.py commands:_setuppy_command"
}
(( $+functions[_setuppy_command] )) ||
_setuppy_command() {
local cmd ret=1
(( $+setuppy_cmds )) || _setuppy_cmds=(
"build:build everything needed to install" \
"build_py:\"build\" pure Python modules (copy to build directory)" \
"build_ext:build C/C++ extensions (compile/link to build directory)" \
"build_clib:build C/C++ libraries used by Python extensions" \
"build_scripts:\"build\" scripts (copy and fixup #! line)" \
"clean:clean up temporary files from 'build' command" \
"install:install everything from build directory" \
"install_lib:install all Python modules (extensions and pure Python)" \
"install_headers:install C/C++ header files" \
"install_scripts:install scripts (Python or otherwise)" \
"install_data:install data files" \
"sdist:create a source distribution (tarball, zip file, etc.)" \
"register:register the distribution with the Python package index" \
"bdist:create a built (binary) distribution" \
"bdist_dumb:create a \"dumb\" built distribution" \
"bdist_rpm:create an RPM distribution" \
"bdist_wininst:create an executable installer for MS Windows" \
"upload:upload binary package to PyPI" \
"check:perform some checks on the package" \
"alias:define a shortcut to invoke one or more commands" \
"bdist_egg:create an \"egg\" distribution" \
"develop:install package in 'development mode'" \
"easy_install:Find/get/install Python packages" \
"egg_info:create a distribution's .egg-info directory" \
"rotate:delete older distributions, keeping N newest files" \
"saveopts:save supplied options to setup.cfg or other config file" \
"setopt:set an option in setup.cfg or another config file" \
"test:run unit tests after in-place build" \
"install_egg_info:Install an .egg-info directory for the package" \
"upload_docs:Upload documentation to PyPI" \
)
if (( CURRENT == 1 )); then
_describe -t commands 'setup.py subcommand' _setuppy_cmds || compadd "$@" - ${(s.:.)${(j.:.)_setuppy_syns}}
else
local curcontext="$curcontext"
cmd="${${_setuppy_cmds[(r)$words[1]:*]%%:*}:-${(k)_setuppy_syns[(r)(*:|)$words[1](:*|)]}}"
if (( $#cmd )); then
curcontext="${curcontext%:*:*}:setuppy-${cmd}:"
_call_function ret _setuppy_$cmd || _message 'no more arguments'
else
_message "unknown setup.py command: $words[1]"
fi
return ret
fi
}
(( $+functions[_setuppy_build] )) ||
_setuppy_build() {
_arguments -s \
"--build-base=[base directory for build library]" \
"-b[base directory for build library]" \
"--build-purelib=[build directory for platform-neutral distributions]" \
"--build-platlib=[build directory for platform-specific distributions]" \
"--build-lib=[build directory for all distribution (defaults to either build-purelib or build-platlib]" \
"--build-scripts=[build directory for scripts]" \
"--build-temp=[temporary build directory]" \
"-t[temporary build directory]" \
"--plat-name=[platform name to build for, if supported (default: linux-i686)]" \
"-p[platform name to build for, if supported (default: linux-i686)]" \
"--compiler=[specify the compiler type]" \
"-c[specify the compiler type]" \
"--debug[compile extensions and libraries with debugging information]" \
"-g[compile extensions and libraries with debugging information]" \
"--force[forcibly build everything (ignore file timestamps)]" \
"-f[forcibly build everything (ignore file timestamps)]" \
"--executable=[specify final destination interpreter path (build.py)]" \
"-e[specify final destination interpreter path (build.py)]" \
"*::setup.py commands:_setuppy"
}
(( $+functions[_setuppy_build_py] )) ||
_setuppy_build_py() {
_arguments -s \
"--build-lib=[directory to \"build\" (copy) to]" \
"-d[directory to \"build\" (copy) to]" \
"--compile[compile .py to .pyc]" \
"-c[compile .py to .pyc]" \
"--no-compile[don't compile .py files \[default\]]" \
"--optimize=[also compile with optimization: -O1 for \"python -O\", -O2 for \"python -OO\", and -O0 to disable \[default: -O0\]]" \
"-O[also compile with optimization: -O1 for \"python -O\", -O2 for \"python -OO\", and -O0 to disable \[default: -O0\]]" \
"--force[forcibly build everything (ignore file timestamps)]" \
"-f[forcibly build everything (ignore file timestamps)]" \
"*::setup.py commands:_setuppy"
}
(( $+functions[_setuppy_build_ext] )) ||
_setuppy_build_ext() {
_arguments -s \
"--build-lib=[directory for compiled extension modules]" \
"-b[directory for compiled extension modules]" \
"--build-temp=[directory for temporary files (build by-products)]" \
"-t[directory for temporary files (build by-products)]" \
"--plat-name=[platform name to cross-compile for, if supported (default: linux-i686)]" \
"-p[platform name to cross-compile for, if supported (default: linux-i686)]" \
"--inplace[ignore build-lib and put compiled extensions into the source directory alongside your pure Python modules]" \
"-i[ignore build-lib and put compiled extensions into the source directory alongside your pure Python modules]" \
"--include-dirs=[list of directories to search for header files (separated by ':')]" \
"-I[list of directories to search for header files (separated by ':')]" \
"--define=[C preprocessor macros to define]" \
"-D[C preprocessor macros to define]" \
"--undef=[C preprocessor macros to undefine]" \
"-U[C preprocessor macros to undefine]" \
"--libraries=[external C libraries to link with]" \
"-l[external C libraries to link with]" \
"--library-dirs=[directories to search for external C libraries (separated by ':')]" \
"-L[directories to search for external C libraries (separated by ':')]" \
"--rpath=[directories to search for shared C libraries at runtime]" \
"-R[directories to search for shared C libraries at runtime]" \
"--link-objects=[extra explicit link objects to include in the link]" \
"-O[extra explicit link objects to include in the link]" \
"--debug[compile/link with debugging information]" \
"-g[compile/link with debugging information]" \
"--force[forcibly build everything (ignore file timestamps)]" \
"-f[forcibly build everything (ignore file timestamps)]" \
"--compiler=[specify the compiler type]" \
"-c[specify the compiler type]" \
"--swig-cpp[make SWIG create C++ files (default is C)]" \
"--swig-opts=[list of SWIG command line options]" \
"--swig=[path to the SWIG executable]" \
"--user[add user include, library and rpath]" \
"*::setup.py commands:_setuppy"
}
(( $+functions[_setuppy_build_clib] )) ||
_setuppy_build_clib() {
_arguments -s \
"--build-clib=[directory to build C/C++ libraries to]" \
"-b[directory to build C/C++ libraries to]" \
"--build-temp=[directory to put temporary build by-products]" \
"-t[directory to put temporary build by-products]" \
"--debug[compile with debugging information]" \
"-g[compile with debugging information]" \
"--force[forcibly build everything (ignore file timestamps)]" \
"-f[forcibly build everything (ignore file timestamps)]" \
"--compiler=[specify the compiler type]" \
"-c[specify the compiler type]" \
"*::setup.py commands:_setuppy"
}
(( $+functions[_setuppy_build_scripts] )) ||
_setuppy_build_scripts() {
_arguments -s \
"--build-dir=[directory to \"build\" (copy) to]" \
"-d[directory to \"build\" (copy) to]" \
"--force[forcibly build everything (ignore file timestamps]" \
"-f[forcibly build everything (ignore file timestamps]" \
"--executable=[specify final destination interpreter path]" \
"-e[specify final destination interpreter path]" \
"*::setup.py commands:_setuppy"
}
(( $+functions[_setuppy_clean] )) ||
_setuppy_clean() {
_arguments -s \
"--build-base=[base build directory (default: 'build.build-base')]" \
"-b[base build directory (default: 'build.build-base')]" \
"--build-lib=[build directory for all modules (default: 'build.build-lib')]" \
"--build-temp=[temporary build directory (default: 'build.build-temp')]" \
"-t[temporary build directory (default: 'build.build-temp')]" \
"--build-scripts=[build directory for scripts (default: 'build.build-scripts')]" \
"--bdist-base=[temporary directory for built distributions]" \
"--all[remove all build output, not just temporary by-products]" \
"-a[remove all build output, not just temporary by-products]" \
"*::setup.py commands:_setuppy"
}
(( $+functions[_setuppy_install] )) ||
_setuppy_install() {
_arguments -s \
"--prefix=[installation prefix]" \
"--exec-prefix=[(Unix only) prefix for platform-specific files]" \
"--home=[(Unix only) home directory to install under]" \
"--user[install in user site-package '/home/hattori/.local/lib/python2.7/site-packages']" \
"--install-base=[base installation directory (instead of --prefix or --home)]" \
"--install-platbase=[base installation directory for platform-specific files (instead of --exec-prefix or --home)]" \
"--root=[install everything relative to this alternate root directory]" \
"--install-purelib=[installation directory for pure Python module distributions]" \
"--install-platlib=[installation directory for non-pure module distributions]" \
"--install-lib=[installation directory for all module distributions (overrides --install-purelib and --install-platlib)]" \
"--install-headers=[installation directory for C/C++ headers]" \
"--install-scripts=[installation directory for Python scripts]" \
"--install-data=[installation directory for data files]" \
"--compile[compile .py to .pyc \[default\]]" \
"-c[compile .py to .pyc \[default\]]" \
"--no-compile[don't compile .py files]" \
"--optimize=[also compile with optimization: -O1 for \"python -O\", -O2 for \"python -OO\", and -O0 to disable \[default: -O0\]]" \
"-O[also compile with optimization: -O1 for \"python -O\", -O2 for \"python -OO\", and -O0 to disable \[default: -O0\]]" \
"--force[force installation (overwrite any existing files)]" \
"-f[force installation (overwrite any existing files)]" \
"--skip-build[skip rebuilding everything (for testing/debugging)]" \
"--record=[filename in which to record list of installed files]" \
"--install-layout=[installation layout to choose (known values: deb, unix)]" \
"--old-and-unmanageable[Try not to use this!]" \
"--single-version-externally-managed[used by system package builders to create 'flat' eggs]" \
"*::setup.py commands:_setuppy"
}
(( $+functions[_setuppy_install_lib] )) ||
_setuppy_install_lib() {
_arguments -s \
"--install-dir=[directory to install to]" \
"-d[directory to install to]" \
"--build-dir=[build directory (where to install from)]" \
"-b[build directory (where to install from)]" \
"--force[force installation (overwrite existing files)]" \
"-f[force installation (overwrite existing files)]" \
"--compile[compile .py to .pyc \[default\]]" \
"-c[compile .py to .pyc \[default\]]" \
"--no-compile[don't compile .py files]" \
"--optimize=[also compile with optimization: -O1 for \"python -O\", -O2 for \"python -OO\", and -O0 to disable \[default: -O0\]]" \
"-O[also compile with optimization: -O1 for \"python -O\", -O2 for \"python -OO\", and -O0 to disable \[default: -O0\]]" \
"--skip-build[skip the build steps]" \
"*::setup.py commands:_setuppy"
}
(( $+functions[_setuppy_install_headers] )) ||
_setuppy_install_headers() {
_arguments -s \
"--install-dir=[directory to install header files to]" \
"-d[directory to install header files to]" \
"--force[force installation (overwrite existing files)]" \
"-f[force installation (overwrite existing files)]" \
"*::setup.py commands:_setuppy"
}
(( $+functions[_setuppy_install_scripts] )) ||
_setuppy_install_scripts() {
_arguments -s \
"--install-dir=[directory to install scripts to]" \
"-d[directory to install scripts to]" \
"--build-dir=[build directory (where to install from)]" \
"-b[build directory (where to install from)]" \
"--force[force installation (overwrite existing files)]" \
"-f[force installation (overwrite existing files)]" \
"--skip-build[skip the build steps]" \
"*::setup.py commands:_setuppy"
}
(( $+functions[_setuppy_install_data] )) ||
_setuppy_install_data() {
_arguments -s \
"--install-dir=[base directory for installing data files (default: installation base dir)]" \
"-d[base directory for installing data files (default: installation base dir)]" \
"--root=[install everything relative to this alternate root directory]" \
"--force[force installation (overwrite existing files)]" \
"-f[force installation (overwrite existing files)]" \
"*::setup.py commands:_setuppy"
}
(( $+functions[_setuppy_sdist] )) ||
_setuppy_sdist() {
_arguments -s \
"--formats=[formats for source distribution (comma-separated list)]" \
"--keep-temp[keep the distribution tree around after creating archive file(s)]" \
"-k[keep the distribution tree around after creating archive file(s)]" \
"--dist-dir=[directory to put the source distribution archive(s) in \[default: dist\]]" \
"-d[directory to put the source distribution archive(s) in \[default: dist\]]" \
"*::setup.py commands:_setuppy"
}
(( $+functions[_setuppy_register] )) ||
_setuppy_register() {
_arguments -s \
"--repository=[url of repository \[default: http://pypi.python.org/pypi\]]" \
"-r[url of repository \[default: http://pypi.python.org/pypi\]]" \
"--show-response[display full response text from server]" \
"--list-classifiers[list the valid Trove classifiers]" \
"--strict[Will stop the registering if the meta-data are not fully compliant]" \
"*::setup.py commands:_setuppy"
}
(( $+functions[_setuppy_bdist] )) ||
_setuppy_bdist() {
_arguments -s \
"--bdist-base=[temporary directory for creating built distributions]" \
"-b[temporary directory for creating built distributions]" \
"--plat-name=[platform name to embed in generated filenames (default: linux-i686)]" \
"-p[platform name to embed in generated filenames (default: linux-i686)]" \
"--formats=[formats for distribution (comma-separated list)]" \
"--dist-dir=[directory to put final built distributions in \[default: dist\]]" \
"-d[directory to put final built distributions in \[default: dist\]]" \
"--skip-build[skip rebuilding everything (for testing/debugging)]" \
"--owner=[Owner name used when creating a tar file \[default: current user\]]" \
"-u[Owner name used when creating a tar file \[default: current user\]]" \
"--group=[Group name used when creating a tar file \[default: current group\]]" \
"-g[Group name used when creating a tar file \[default: current group\]]" \
"*::setup.py commands:_setuppy"
}
(( $+functions[_setuppy_bdist_dumb] )) ||
_setuppy_bdist_dumb() {
_arguments -s \
"--bdist-dir=[temporary directory for creating the distribution]" \
"-d[temporary directory for creating the distribution]" \
"--plat-name=[platform name to embed in generated filenames (default: linux-i686)]" \
"-p[platform name to embed in generated filenames (default: linux-i686)]" \
"--format=[archive format to create (tar, ztar, gztar, zip)]" \
"-f[archive format to create (tar, ztar, gztar, zip)]" \
"--keep-temp[keep the pseudo-installation tree around after creating the distribution archive]" \
"-k[keep the pseudo-installation tree around after creating the distribution archive]" \
"--dist-dir=[directory to put final built distributions in]" \
"-d[directory to put final built distributions in]" \
"--skip-build[skip rebuilding everything (for testing/debugging)]" \
"--relative[build the archive using relative paths(default: false)]" \
"--owner=[Owner name used when creating a tar file \[default: current user\]]" \
"-u[Owner name used when creating a tar file \[default: current user\]]" \
"--group=[Group name used when creating a tar file \[default: current group\]]" \
"-g[Group name used when creating a tar file \[default: current group\]]" \
"*::setup.py commands:_setuppy"
}
(( $+functions[_setuppy_bdist_rpm] )) ||
_setuppy_bdist_rpm() {
_arguments -s \
"--bdist-base=[base directory for creating built distributions]" \
"--rpm-base=[base directory for creating RPMs (defaults to \"rpm\" under --bdist-base; must be specified for RPM 2)]" \
"--dist-dir=[directory to put final RPM files in (and .spec files if --spec-only)]" \
"-d[directory to put final RPM files in (and .spec files if --spec-only)]" \
"--python=[path to Python interpreter to hard-code in the .spec file (default: \"python\")]" \
"--fix-python[hard-code the exact path to the current Python interpreter in the .spec file]" \
"--spec-only[only regenerate spec file]" \
"--source-only[only generate source RPM]" \
"--binary-only[only generate binary RPM]" \
"--use-bzip2[use bzip2 instead of gzip to create source distribution]" \
"--distribution-name=[name of the (Linux) distribution to which this RPM applies (*not* the name of the module distribution!)]" \
"--group=[package classification \[default: \"Development/Libraries\"\]]" \
"--release=[RPM release number]" \
"--serial=[RPM serial number]" \
"--vendor=[RPM \"vendor\" (eg. \"Joe Blow <joe@example.com>\") \[default: maintainer or author from setup script\]]" \
"--packager=[RPM packager (eg. \"Jane Doe <jane@example.net>\")\[default: vendor\]]" \
"--doc-files=[list of documentation files (space or comma-separated)]" \
"--changelog=[RPM changelog]" \
"--icon=[name of icon file]" \
"--provides=[capabilities provided by this package]" \
"--requires=[capabilities required by this package]" \
"--conflicts=[capabilities which conflict with this package]" \
"--build-requires=[capabilities required to build this package]" \
"--obsoletes=[capabilities made obsolete by this package]" \
"--no-autoreq[do not automatically calculate dependencies]" \
"--keep-temp[don't clean up RPM build directory]" \
"-k[don't clean up RPM build directory]" \
"--no-keep-temp[clean up RPM build directory \[default\]]" \
"--use-rpm-opt-flags[compile with RPM_OPT_FLAGS when building from source RPM]" \
"--no-rpm-opt-flags[do not pass any RPM CFLAGS to compiler]" \
"--rpm3-mode[RPM 3 compatibility mode (default)]" \
"--rpm2-mode[RPM 2 compatibility mode]" \
"--prep-script=[Specify a script for the PREP phase of RPM building]" \
"--build-script=[Specify a script for the BUILD phase of RPM building]" \
"--pre-install=[Specify a script for the pre-INSTALL phase of RPM building]" \
"--install-script=[Specify a script for the INSTALL phase of RPM building]" \
"--post-install=[Specify a script for the post-INSTALL phase of RPM building]" \
"--pre-uninstall=[Specify a script for the pre-UNINSTALL phase of RPM building]" \
"--post-uninstall=[Specify a script for the post-UNINSTALL phase of RPM building]" \
"--clean-script=[Specify a script for the CLEAN phase of RPM building]" \
"--verify-script=[Specify a script for the VERIFY phase of the RPM build]" \
"--force-arch=[Force an architecture onto the RPM build process]" \
"--quiet[Run the INSTALL phase of RPM building in quiet mode]" \
"-q[Run the INSTALL phase of RPM building in quiet mode]" \
"*::setup.py commands:_setuppy"
}
(( $+functions[_setuppy_bdist_wininst] )) ||
_setuppy_bdist_wininst() {
_arguments -s \
"--bdist-dir=[temporary directory for creating the distribution]" \
"--plat-name=[platform name to embed in generated filenames (default: linux-i686)]" \
"-p[platform name to embed in generated filenames (default: linux-i686)]" \
"--keep-temp[keep the pseudo-installation tree around after creating the distribution archive]" \
"-k[keep the pseudo-installation tree around after creating the distribution archive]" \
"--target-version=[require a specific python version on the target system]" \
"--no-target-compile[do not compile .py to .pyc on the target system]" \
"-c[do not compile .py to .pyc on the target system]" \
"--no-target-optimize[do not compile .py to .pyo (optimized)on the target system]" \
"-o[do not compile .py to .pyo (optimized)on the target system]" \
"--dist-dir=[directory to put final built distributions in]" \
"-d[directory to put final built distributions in]" \
"--bitmap=[bitmap to use for the installer instead of python-powered logo]" \
"-b[bitmap to use for the installer instead of python-powered logo]" \
"--title=[title to display on the installer background instead of default]" \
"-t[title to display on the installer background instead of default]" \
"--skip-build[skip rebuilding everything (for testing/debugging)]" \
"--install-script=[basename of installation script to be run afterinstallation or before deinstallation]" \
"--pre-install-script=[Fully qualified filename of a script to be run before any files are installed. This script need not be in the distribution]" \
"--user-access-control=[specify Vista's UAC handling - 'none'/default=no handling, 'auto'=use UAC if target Python installed for all users, 'force'=always use UAC]" \
"*::setup.py commands:_setuppy"
}
(( $+functions[_setuppy_upload] )) ||
_setuppy_upload() {
_arguments -s \
"--repository=[url of repository \[default: http://pypi.python.org/pypi\]]" \
"-r[url of repository \[default: http://pypi.python.org/pypi\]]" \
"--show-response[display full response text from server]" \
"--sign[sign files to upload using gpg]" \
"-s[sign files to upload using gpg]" \
"--identity=[GPG identity used to sign files]" \
"-i[GPG identity used to sign files]" \
"*::setup.py commands:_setuppy"
}
(( $+functions[_setuppy_check] )) ||
_setuppy_check() {
_arguments -s \
"--metadata[Verify meta-data]" \
"-m[Verify meta-data]" \
"--restructuredtext[Checks if long string meta-data syntax are reStructuredText-compliant]" \
"-r[Checks if long string meta-data syntax are reStructuredText-compliant]" \
"--strict[Will exit with an error if a check fails]" \
"-s[Will exit with an error if a check fails]" \
"*::setup.py commands:_setuppy"
}
(( $+functions[_setuppy_alias] )) ||
_setuppy_alias() {
_arguments -s \
"--remove[remove (unset) the alias]" \
"-r[remove (unset) the alias]" \
"--global-config[save options to the site-wide distutils.cfg file]" \
"-g[save options to the site-wide distutils.cfg file]" \
"--user-config[save options to the current user's pydistutils.cfg file]" \
"-u[save options to the current user's pydistutils.cfg file]" \
"--filename=[configuration file to use (default=setup.cfg)]" \
"-f[configuration file to use (default=setup.cfg)]" \
"*::setup.py commands:_setuppy"
}
(( $+functions[_setuppy_bdist_egg] )) ||
_setuppy_bdist_egg() {
_arguments -s \
"--bdist-dir=[temporary directory for creating the distribution]" \
"-b[temporary directory for creating the distribution]" \
"--plat-name=[platform name to embed in generated filenames (default: linux-i686)]" \
"-p[platform name to embed in generated filenames (default: linux-i686)]" \
"--exclude-source-files[remove all .py files from the generated egg]" \
"--keep-temp[keep the pseudo-installation tree around after creating the distribution archive]" \
"-k[keep the pseudo-installation tree around after creating the distribution archive]" \
"--dist-dir=[directory to put final built distributions in]" \
"-d[directory to put final built distributions in]" \
"--skip-build[skip rebuilding everything (for testing/debugging)]" \
"*::setup.py commands:_setuppy"
}
(( $+functions[_setuppy_develop] )) ||
_setuppy_develop() {
_arguments -s \
"--prefix=[installation prefix]" \
"--zip-ok[install package as a zipfile]" \
"-z[install package as a zipfile]" \
"--multi-version[make apps have to require() a version]" \
"-m[make apps have to require() a version]" \
"--upgrade[force upgrade (searches PyPI for latest versions)]" \
"-U[force upgrade (searches PyPI for latest versions)]" \
"--install-dir=[install package to DIR]" \
"-d[install package to DIR]" \
"--script-dir=[install scripts to DIR]" \
"-s[install scripts to DIR]" \
"--exclude-scripts[Don't install scripts]" \
"-x[Don't install scripts]" \
"--always-copy[Copy all needed packages to install dir]" \
"-a[Copy all needed packages to install dir]" \
"--index-url=[base URL of Python Package Index]" \
"-i[base URL of Python Package Index]" \
"--find-links=[additional URL(s) to search for packages]" \
"-f[additional URL(s) to search for packages]" \
"--delete-conflicting[no longer needed; don't use this]" \
"-D[no longer needed; don't use this]" \
"--ignore-conflicts-at-my-risk[no longer needed; don't use this]" \
"--build-directory=[download/extract/build in DIR; keep the results]" \
"-b[download/extract/build in DIR; keep the results]" \
"--optimize=[also compile with optimization: -O1 for \"python -O\", -O2 for \"python -OO\", and -O0 to disable \[default: -O0\]]" \
"-O[also compile with optimization: -O1 for \"python -O\", -O2 for \"python -OO\", and -O0 to disable \[default: -O0\]]" \
"--record=[filename in which to record list of installed files]" \
"--always-unzip[don't install as a zipfile, no matter what]" \
"-Z[don't install as a zipfile, no matter what]" \
"--site-dirs=[list of directories where .pth files work]" \
"-S[list of directories where .pth files work]" \
"--editable[Install specified packages in editable form]" \
"-e[Install specified packages in editable form]" \
"--no-deps[don't install dependencies]" \
"-N[don't install dependencies]" \
"--allow-hosts=[pattern(s) that hostnames must match]" \
"-H[pattern(s) that hostnames must match]" \
"--local-snapshots-ok[allow building eggs from local checkouts]" \
"-l[allow building eggs from local checkouts]" \
"--version[print version information and exit]" \
"--install-layout=[installation layout to choose (known values: deb)]" \
"--force-installation-into-system-dir[force installation into /usr]" \
"-0[force installation into /usr]" \
"--no-find-links[Don't load find-links defined in packages being installed]" \
"--user[install in user site-package '/home/hattori/.local/lib/python2.7/site-packages']" \
"--uninstall[Uninstall this source package]" \
"-u[Uninstall this source package]" \
"--egg-path=[Set the path to be used in the .egg-link file]" \
"*::setup.py commands:_setuppy"
}
(( $+functions[_setuppy_easy_install] )) ||
_setuppy_easy_install() {
_arguments -s \
"--prefix=[installation prefix]" \
"--zip-ok[install package as a zipfile]" \
"-z[install package as a zipfile]" \
"--multi-version[make apps have to require() a version]" \
"-m[make apps have to require() a version]" \
"--upgrade[force upgrade (searches PyPI for latest versions)]" \
"-U[force upgrade (searches PyPI for latest versions)]" \
"--install-dir=[install package to DIR]" \
"-d[install package to DIR]" \
"--script-dir=[install scripts to DIR]" \
"-s[install scripts to DIR]" \
"--exclude-scripts[Don't install scripts]" \
"-x[Don't install scripts]" \
"--always-copy[Copy all needed packages to install dir]" \
"-a[Copy all needed packages to install dir]" \
"--index-url=[base URL of Python Package Index]" \
"-i[base URL of Python Package Index]" \
"--find-links=[additional URL(s) to search for packages]" \
"-f[additional URL(s) to search for packages]" \
"--delete-conflicting[no longer needed; don't use this]" \
"-D[no longer needed; don't use this]" \
"--ignore-conflicts-at-my-risk[no longer needed; don't use this]" \
"--build-directory=[download/extract/build in DIR; keep the results]" \
"-b[download/extract/build in DIR; keep the results]" \
"--optimize=[also compile with optimization: -O1 for \"python -O\", -O2 for \"python -OO\", and -O0 to disable \[default: -O0\]]" \
"-O[also compile with optimization: -O1 for \"python -O\", -O2 for \"python -OO\", and -O0 to disable \[default: -O0\]]" \
"--record=[filename in which to record list of installed files]" \
"--always-unzip[don't install as a zipfile, no matter what]" \
"-Z[don't install as a zipfile, no matter what]" \
"--site-dirs=[list of directories where .pth files work]" \
"-S[list of directories where .pth files work]" \
"--editable[Install specified packages in editable form]" \
"-e[Install specified packages in editable form]" \
"--no-deps[don't install dependencies]" \
"-N[don't install dependencies]" \
"--allow-hosts=[pattern(s) that hostnames must match]" \
"-H[pattern(s) that hostnames must match]" \
"--local-snapshots-ok[allow building eggs from local checkouts]" \
"-l[allow building eggs from local checkouts]" \
"--version[print version information and exit]" \
"--install-layout=[installation layout to choose (known values: deb)]" \
"--force-installation-into-system-dir[force installation into /usr]" \
"-0[force installation into /usr]" \
"--no-find-links[Don't load find-links defined in packages being installed]" \
"--user[install in user site-package '/home/hattori/.local/lib/python2.7/site-packages']" \
"*::setup.py commands:_setuppy"
}
(( $+functions[_setuppy_egg_info] )) ||
_setuppy_egg_info() {
_arguments -s \
"--egg-base=[directory containing .egg-info directories (default: top of the source tree)]" \
"-e[directory containing .egg-info directories (default: top of the source tree)]" \
"--tag-svn-revision[Add subversion revision ID to version number]" \
"-r[Add subversion revision ID to version number]" \
"--tag-date[Add date stamp (e.g. 20050528) to version number]" \
"-d[Add date stamp (e.g. 20050528) to version number]" \
"--tag-build=[Specify explicit tag to add to version number]" \
"-b[Specify explicit tag to add to version number]" \
"--no-svn-revision[Don't add subversion revision ID \[default\]]" \
"-R[Don't add subversion revision ID \[default\]]" \
"--no-date[Don't include date stamp \[default\]]" \
"-D[Don't include date stamp \[default\]]" \
"*::setup.py commands:_setuppy"
}
(( $+functions[_setuppy_rotate] )) ||
_setuppy_rotate() {
_arguments -s \
"--match=[patterns to match (required)]" \
"-m[patterns to match (required)]" \
"--dist-dir=[directory where the distributions are]" \
"-d[directory where the distributions are]" \
"--keep=[number of matching distributions to keep]" \
"-k[number of matching distributions to keep]" \
"*::setup.py commands:_setuppy"
}
(( $+functions[_setuppy_saveopts] )) ||
_setuppy_saveopts() {
_arguments -s \
"--global-config[save options to the site-wide distutils.cfg file]" \
"-g[save options to the site-wide distutils.cfg file]" \
"--user-config[save options to the current user's pydistutils.cfg file]" \
"-u[save options to the current user's pydistutils.cfg file]" \
"--filename=[configuration file to use (default=setup.cfg)]" \
"-f[configuration file to use (default=setup.cfg)]" \
"*::setup.py commands:_setuppy"
}
(( $+functions[_setuppy_setopt] )) ||
_setuppy_setopt() {
_arguments -s \
"--command=[command to set an option for]" \
"-c[command to set an option for]" \
"--option=[option to set]" \
"-o[option to set]" \
"--set-value=[value of the option]" \
"-s[value of the option]" \
"--remove[remove (unset) the value]" \
"-r[remove (unset) the value]" \
"--global-config[save options to the site-wide distutils.cfg file]" \
"-g[save options to the site-wide distutils.cfg file]" \
"--user-config[save options to the current user's pydistutils.cfg file]" \
"-u[save options to the current user's pydistutils.cfg file]" \
"--filename=[configuration file to use (default=setup.cfg)]" \
"-f[configuration file to use (default=setup.cfg)]" \
"*::setup.py commands:_setuppy"
}
(( $+functions[_setuppy_test] )) ||
_setuppy_test() {
_arguments -s \
"--test-module=[Run 'test_suite' in specified module]" \
"-m[Run 'test_suite' in specified module]" \
"--test-suite=[Test suite to run (e.g. 'some_module.test_suite')]" \
"-s[Test suite to run (e.g. 'some_module.test_suite')]" \
"*::setup.py commands:_setuppy"
}
(( $+functions[_setuppy_install_egg_info] )) ||
_setuppy_install_egg_info() {
_arguments -s \
"--install-dir=[directory to install to]" \
"-d[directory to install to]" \
"*::setup.py commands:_setuppy"
}
(( $+functions[_setuppy_upload_docs] )) ||
_setuppy_upload_docs() {
_arguments -s \
"--repository=[url of repository \[default: http://pypi.python.org/pypi\]]" \
"-r[url of repository \[default: http://pypi.python.org/pypi\]]" \
"--show-response[display full response text from server]" \
"--upload-dir=[directory to upload]" \
"*::setup.py commands:_setuppy"
}
_setup.py "$@"
# Local Variables:
# mode: Shell-Script
# sh-indentation: 2
# indent-tabs-mode: nil
# sh-basic-offset: 2
# End:
# vim: ft=zsh sw=2 ts=2 et

View File

@ -0,0 +1,55 @@
#compdef ssh-copy-id
# ------------------------------------------------------------------------------
# Copyright (c) 2011 Github zsh-users - http://github.com/zsh-users
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the zsh-users nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL ZSH-USERS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# ------------------------------------------------------------------------------
# Description
# -----------
#
# Completion script for ssh-copy-id.
#
# ------------------------------------------------------------------------------
# Authors
# -------
#
# * Julien Nicoulaud <julien.nicoulaud@gmail.com>
#
# ------------------------------------------------------------------------------
# FIXME This completes "user@host" and not "[user@]host" ("user@" is optional),
# should be merged in _ssh.
_arguments -A "-*" \
'-i+[use identity file]:SSH identity file:_files' \
'1: :_user_at_host'
# Local Variables:
# mode: Shell-Script
# sh-indentation: 2
# indent-tabs-mode: nil
# sh-basic-offset: 2
# End:
# vim: ft=zsh sw=2 ts=2 et

View File

@ -0,0 +1,19 @@
function prompt_minimal_setup {
# Setup PROMPT
if `fancyTerm`; then
# We are on xterminal
W="%n@%m:%."
I="%m:%."
L="%B%. %#%b "
PS1="%{]2;$W%}%{]1;$I%}$L"
unset W I L
else
# We are not on xterminal
PS1="%B%. %#%b "
fi
}
prompt_minimal_setup
# vim: set ts=4 sw=4 tw=0 ft=zsh :

View File

@ -0,0 +1,18 @@
function prompt_niceOld_setup {
if `fancyTerm`; then
W="::: %n at %m in %. :::"
I="%m::%."
L="%B%K{blue}%F{white}@%m::%2~ %f%k
%F{yellow}%#%f%b "
PS1="%{]2;$W%}%{]1;$I%}$L"
unset W I L
else
# We are not on xterminal
PS1="%B%K{blue}%F{white}[%l] %n@%m:%~ %f%k%F{yellow}%#%f%b "
fi
}
prompt_niceOld_setup
# vim: set ts=4 sw=4 tw=0 ft=zsh :

View File

@ -0,0 +1,20 @@
function prompt_nice_setup {
if `fancyTerm`; then
title="::: %n at %m in %. :::"
icon="%m::%."
prompt_='$FX[bold]$FX[italic]$BG[062]@%m::%2~$FX[reset]
$FX[bold]$(repo_char)$FG[220]%#$FX[reset] '
PS1="%{]2;$title%}%{]1;$icon%}$prompt_"
unset title icon prompt_
else
# We are not on xterminal
PS1='%B%K{blue}%F{white}[%l] $(repo_char)%n@%m:%~ %f%k%F{yellow}%#%f%b '
fi
}
prompt_nice_setup
# vim: set ts=4 sw=4 tw=0 ft=zsh :

View File

@ -0,0 +1,19 @@
function prompt_plain_setup {
# Setup PROMPT
if `fancyTerm`; then
# We are on xterminal
W="%n@%m:%."
I="%m:%."
L="%B[%l] %~ %#%b "
PS1="%{]2;$W%}%{]1;$I%}$L"
unset W I L
else
# We are not on xterminal
PS1="%B[%l] %n@%m:%~ %#%b "
fi
}
prompt_plain_setup
# vim: set ts=4 sw=4 tw=0 ft=zsh :

View File

@ -0,0 +1,19 @@
function prompt_server_setup {
# Setup PROMPT
if `fancyTerm`; then
# We are on xterminal
W="%n@%m:%."
I="%m:%."
L="%B@%m %~ %#%b "
PS1="%{]2;$W%}%{]1;$I%}$L"
unset W I L
else
# We are not on xterminal
PS1="%B%n@%m:%~ %#%b "
fi
}
prompt_server_setup
# vim: set ts=4 sw=4 tw=0 ft=zsh :

131
zsh.d/zshfunctions/bak Normal file
View File

@ -0,0 +1,131 @@
hflag=no # help
nflag=no # nodelete - do not delete files
rflag=no # recursion
pflag=no # pyc - consider .pyc file
vflag=no # list files (performs delete anyway)
aflag=no # all - flags r + p + m
mflag=no # vim - consider .swp, .swo, swn
dflag=no # specify directory
#
directory=""
startdir=$PWD
TMP=/tmp/bak`date +%s`
#
esc_bold='\033[1m' # http://en.wikipedia.org/wiki/ANSI_escape_code#CSI_Codes
esc_reset='\033[0m'
esc_red='\033[91m'
esc_green='\033[92m'
#
####################################################################################
# GETOPT
#
set -- $(getopt hnmrpva "$@")
while [ $# -gt 0 ]
do
case "$1" in
-h) hflag=yes;;
-n) nflag=yes;;
-r) rflag=yes;;
-p) pflag=yes;;
-m) mflag=yes;;
-v) vflag=yes;;
-a) pflag=yes; mflag=yes; rflag=yes;;
--) shift; break;;
-*) echo "$0: error - unrecognized option $1" 1>&2; return;;
*) break;;
esac
shift
done
####################################################################################
# HELP FLAG
# print help and exit
if [ $hflag = yes ]; then
echo
echo -e "${esc_bold}Usage:${esc_reset} bak [-hnrpva] [DIRECTORY]"
echo -e " Deletes backup files ( *~ )"
echo -e " If no DIRECTORY deletes in current directory"
echo
echo -e "${esc_bold}Options:${esc_reset}"
echo -e " ${esc_green}-h${esc_reset} Display this help"
echo -e " ${esc_green}-n${esc_reset} Dry run (${esc_green}no delete will occur${esc_reset})"
echo -e " ${esc_green}-r${esc_reset} Recursive"
echo -e " ${esc_green}-p${esc_reset} Deletes also .pyc"
echo -e " ${esc_green}-m${esc_reset} Deletes also VIM files (${esc_red}backup & swap${esc_reset})"
echo -e " ${esc_green}-v${esc_reset} Verbose (lists files)"
echo -e " ${esc_green}-a${esc_reset} Alias for -rpm"
echo
return
fi
####################################################################################
# PREPARE
# Directory
directory=${1:-$PWD}
# check if given directory is a directory
if [ ! -d $directory ] ; then
echo "'$directory' is not a directory"
return
fi
# Recursion
depth='-maxdepth 1'
andits=''
if [ $rflag = yes ]; then
depth="" #recursive
andits=' and its subdirectories'
fi
####################################################################################
# EXEC
cd $directory
#list files in TMP file
find . -name "*~" -type f ${=depth} -exec echo "\"{}\"" \; > $TMP 2> /dev/null
if [ $pflag = yes ]; then
find . -name \*.pyc -type f ${=depth} -exec echo "\"{}\"" \; >> $TMP 2> /dev/null
fi
if [ $mflag = yes ]; then
find . \( -name \*.swp -or -name \*.swo -or -name \*.swn \) ${=depth} -exec echo "\"{}\"" \; >> $TMP 2> /dev/null
fi
FILES=`wc -l $TMP | cut -d/ -f1 | sed 's/[ ]//g' `
if [ ${FILES} -ge 1 ] ; then
if [ $vflag = yes ]; then
# list files
echo "Deleted files:"
cat -n $TMP | sed 's/"//g'
echo
fi
if [ ${FILES} = 1 ]; then
label_file="file"
else
label_file="files"
fi
if [ $nflag = no ]; then
cat $TMP | xargs rm -f #delete
echo -e " ${esc_red}$FILES bak ${label_file}${esc_reset} deleted in ${esc_green}$directory${esc_reset}$andits"
else
echo -e " ${esc_green}$FILES bak ${label_file}${esc_reset} ${esc_red}listed${esc_reset} in ${esc_green}$directory${esc_reset}$andits"
fi
else
echo -e " ${esc_green}No bak files${esc_reset} listed in ${esc_green}$directory${esc_reset}$andits"
fi
#remove TMP file
rm -f $TMP
# return to startdir
cd $startdir
unset startdir
unset directory
# vim: set ts=4 sw=4 tw=0 ft=zsh :

BIN
zsh.d/zshfunctions/bak.zwc Normal file

Binary file not shown.

5
zsh.d/zshfunctions/cdb Normal file
View File

@ -0,0 +1,5 @@
if [ -d $1 ]; then
cd $1
else
cd `dirname $1`
fi

BIN
zsh.d/zshfunctions/cdb.zwc Normal file

Binary file not shown.

1
zsh.d/zshfunctions/dust Normal file
View File

@ -0,0 +1 @@
hdu -s *

BIN
zsh.d/zshfunctions/dust.zwc Normal file

Binary file not shown.

View File

@ -0,0 +1,13 @@
fancyterms=('xterm' 'rxvt' 'screen')
for t in $fancyterms; do
if [ "${TERM#${t}}" != "$TERM" ]; then
unset fancyterms
return 0
fi
done
unset fancyterms
return 1
# vim: set ts=4 sw=4 tw=0 ft=zsh :

Binary file not shown.

17
zsh.d/zshfunctions/hdu Normal file
View File

@ -0,0 +1,17 @@
du -kc $* | sort -nr | awk '{
# Prepare human readable
if($1>=1024*1024) { size=$1/1024/1024; unit="G" }
else if($1>=1024) { size=$1/1024; unit="M" }
else { size=$1; unit="K" };
format="%10.2f%s";
hsize=sprintf(format,size,unit);
# Remove $1 (size), then removes " " at the start of $0
$1=""; thepath=$0; sub(/^ /,"",thepath);
# Print size and path (directories are bolded)
if ( system("[ -d \""thepath"\" ]") )
printf "%-8s %s\n",hsize,thepath;
else
printf "%-8s \033[1m%s\033[0m/\n",hsize,thepath;
}'

BIN
zsh.d/zshfunctions/hdu.zwc Normal file

Binary file not shown.

1
zsh.d/zshfunctions/hist Normal file
View File

@ -0,0 +1 @@
grep -i $* $HISTFILE

BIN
zsh.d/zshfunctions/hist.zwc Normal file

Binary file not shown.

View File

@ -0,0 +1,7 @@
function repo_char {
git branch > /dev/null 2> /dev/null && echo '±:' && return
svn info > /dev/null 2> /dev/null && echo '\u13a6:' && return
# git branch > /dev/null 2> /dev/null && echo 'git:' && return
# svn info > /dev/null 2> /dev/null && echo 'svn:' && return
# echo '\u25cb'
}

Binary file not shown.