merge conflict
This commit is contained in:
commit
d99afd33cb
11
.gitignore
vendored
11
.gitignore
vendored
@ -1,9 +1,8 @@
|
||||
locals.zsh
|
||||
log/.zsh_history
|
||||
projects.zsh
|
||||
custom
|
||||
# custom files
|
||||
custom/
|
||||
!custom/plugins/example
|
||||
!custom/example.zsh
|
||||
*.swp
|
||||
!custom/example.zshcache
|
||||
|
||||
# temp files directories
|
||||
cache/
|
||||
log/
|
||||
|
@ -2,9 +2,15 @@
|
||||
<img src="https://s3.amazonaws.com/ohmyzsh/oh-my-zsh-logo.png" alt="Oh My Zsh">
|
||||
</p>
|
||||
|
||||
Oh My Zsh is an open source, community-driven framework for managing your [zsh](http://www.zsh.org/) configuration. That sounds boring. Let's try this again.
|
||||
Oh My Zsh is an open source, community-driven framework for managing your [zsh](http://www.zsh.org/) configuration.
|
||||
|
||||
__Oh My Zsh is a way of life!__ Once installed, your terminal prompt will become the talk of the town _or your money back!_ Each time you interact with your command prompt, you'll be able to take advantage of the hundreds of bundled plugins and pretty themes. Strangers will come up to you in cafés and ask you, _"that is amazing. are you some sort of genius?"_ Finally, you'll begin to get the sort of attention that you always felt that you deserved. ...or maybe you'll just use the time that you saved to start flossing more often.
|
||||
That sounds boring. Let's try this again.
|
||||
|
||||
__Oh My Zsh is a way of life!__
|
||||
|
||||
Once installed, your terminal shell will become the talk of the town _or your money back!_ With each keystroke in your command prompt, you'll take advantage of the hundreds of powerful plugins and beautiful themes. Strangers will come up to you in cafés and ask you, _"that is amazing! are you some sort of genius?"_
|
||||
|
||||
Finally, you'll begin to get the sort of attention that you have always felt you deserved. ...or maybe you'll use the time that you're saving to start flossing more often.
|
||||
|
||||
To learn more, visit [ohmyz.sh](http://ohmyz.sh) and follow [@ohmyzsh](https://twitter.com/ohmyzsh) on Twitter.
|
||||
|
||||
@ -12,9 +18,9 @@ To learn more, visit [ohmyz.sh](http://ohmyz.sh) and follow [@ohmyzsh](https://t
|
||||
|
||||
### Prerequisites
|
||||
|
||||
__Disclaimer:__ _Oh My Zsh works best on Mac OS X and Linux._
|
||||
__Disclaimer:__ _Oh My Zsh works best on macOS and Linux._
|
||||
|
||||
* Unix-based operating system (Mac OS X or Linux)
|
||||
* Unix-based operating system (macOS or Linux)
|
||||
* [Zsh](http://www.zsh.org) should be installed (v4.3.9 or more recent). If not pre-installed (`zsh --version` to confirm), check the following instruction here: [Installing ZSH](https://github.com/robbyrussell/oh-my-zsh/wiki/Installing-ZSH)
|
||||
* `curl` or `wget` should be installed
|
||||
* `git` should be installed
|
||||
@ -26,13 +32,13 @@ Oh My Zsh is installed by running one of the following commands in your terminal
|
||||
#### via curl
|
||||
|
||||
```shell
|
||||
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
|
||||
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
|
||||
```
|
||||
|
||||
#### via wget
|
||||
|
||||
```shell
|
||||
sh -c "$(wget https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"
|
||||
sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"
|
||||
```
|
||||
|
||||
## Using Oh My Zsh
|
||||
@ -43,7 +49,7 @@ Oh My Zsh comes with a shit load of plugins to take advantage of. You can take a
|
||||
|
||||
#### Enabling Plugins
|
||||
|
||||
If you spot a plugin (or several) that you would like to use with Oh My Zsh, you will need to edit the `~/.zshrc` file. Once you open it with your favorite editor, you'll see a spot to list all the plugins that you'd like Oh My Zsh to load in initialization.
|
||||
If you spot a plugin (or several) that you would like to use with Oh My Zsh, you will need to edit the `~/.zshrc` file. Once you open it with your favorite editor, you'll see a spot to list all the plugins that you'd like Oh My Zsh to load on initialization.
|
||||
|
||||
For example, this line might begin to look like...
|
||||
|
||||
@ -61,7 +67,7 @@ We'll admit it. Early in the Oh My Zsh world, we may have gotten a bit too theme
|
||||
|
||||
#### Selecting a Theme
|
||||
|
||||
_Robby's theme is the default one. It's not the fanciest one. It's not the simplest one. It's just right (for him)._
|
||||
_Robby's theme is the default one. It's not the fanciest one. It's not the simplest one. It's just the right one (for him)._
|
||||
|
||||
Once you find a theme that you want to use, you will need to edit the `~/.zshrc` file. You'll see an environment variable (all caps) in there that looks like:
|
||||
|
||||
@ -75,7 +81,7 @@ To use a different theme, simply change the value to match the name of your desi
|
||||
ZSH_THEME="agnoster" # (this is one of the fancy ones)
|
||||
```
|
||||
|
||||
Open up a new terminal window and your prompt should look something like...
|
||||
Open up a new terminal window and your prompt should look something like this:
|
||||
|
||||
![Agnoster theme](https://cloud.githubusercontent.com/assets/2618447/6316862/70f58fb6-ba03-11e4-82c9-c083bf9a6574.png)
|
||||
|
||||
@ -104,7 +110,7 @@ The default location is `~/.oh-my-zsh` (hidden in your home directory)
|
||||
If you'd like to change the install directory with the `ZSH` environment variable, either by running `export ZSH=/your/path` before installing, or by setting it before the end of the install pipeline like this:
|
||||
|
||||
```shell
|
||||
export ZSH="$HOME/.dotfiles/oh-my-zsh"; sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
|
||||
export ZSH="$HOME/.dotfiles/oh-my-zsh"; sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
|
||||
```
|
||||
|
||||
#### Manual Installation
|
||||
@ -123,7 +129,7 @@ cp ~/.zshrc ~/.zshrc.orig
|
||||
|
||||
##### 3. Create a new zsh configuration file
|
||||
|
||||
You can create a new zsh config file by copying the template that we included for you.
|
||||
You can create a new zsh config file by copying the template that we have included for you.
|
||||
|
||||
```shell
|
||||
cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc
|
||||
@ -202,7 +208,10 @@ Thank you so much!
|
||||
|
||||
## Follow Us
|
||||
|
||||
We have an [@ohmyzsh](https://twitter.com/ohmyzsh) Twitter account. You should follow it.
|
||||
We're on the social media.
|
||||
|
||||
* [@ohmyzsh](https://twitter.com/ohmyzsh) on Twitter. You should follow it.
|
||||
* [Oh My Zsh](https://www.facebook.com/Oh-My-Zsh-296616263819290/) on Facebook.
|
||||
|
||||
## Merchandise
|
||||
|
||||
@ -210,4 +219,10 @@ We have [stickers](http://shop.planetargon.com/products/ohmyzsh-stickers-set-of-
|
||||
|
||||
## License
|
||||
|
||||
Oh My Zsh is released under the [MIT license](MIT-LICENSE.txt).
|
||||
Oh My Zsh is released under the [MIT license](LICENSE.txt).
|
||||
|
||||
## About Planet Argon
|
||||
|
||||
![Planet Argon](http://pa-github-assets.s3.amazonaws.com/PARGON_logo_digital_COL-small.jpg)
|
||||
|
||||
Oh My Zsh was started by the team at [Planet Argon](https://www.planetargon.com/?utm_source=github), a [Ruby on Rails development agency](https://www.planetargon.com/skills/ruby-on-rails-development?utm_source=github).
|
4
cache/.easter-egg
vendored
4
cache/.easter-egg
vendored
@ -1,4 +0,0 @@
|
||||
This file is only here so that Git will keep a cache directory as .gitignore is ignoring all the files within it.
|
||||
|
||||
Feel free to add love notes for people here.
|
||||
|
0
cache/.gitkeep
vendored
Normal file
0
cache/.gitkeep
vendored
Normal file
@ -1,5 +1,10 @@
|
||||
# Add yourself some shortcuts to projects you often work on
|
||||
# Example:
|
||||
# You can put files here to add functionality separated per file, which
|
||||
# will be ignored by git.
|
||||
# Files on the custom/ directory will be automatically loaded by the init
|
||||
# script, in alphabetical order.
|
||||
|
||||
# For example: add yourself some shortcuts to projects you often work on.
|
||||
#
|
||||
# brainstormr=/Users/robbyrussell/Projects/development/planetargon/brainstormr
|
||||
# brainstormr=~/Projects/development/planetargon/brainstormr
|
||||
# cd $brainstormr
|
||||
#
|
@ -31,13 +31,13 @@ function clipcopy() {
|
||||
cat $file > /dev/clipboard
|
||||
fi
|
||||
else
|
||||
if which xclip &>/dev/null; then
|
||||
if (( $+commands[xclip] )); then
|
||||
if [[ -z $file ]]; then
|
||||
xclip -in -selection clipboard
|
||||
else
|
||||
xclip -in -selection clipboard $file
|
||||
fi
|
||||
elif which xsel &>/dev/null; then
|
||||
elif (( $+commands[xsel] )); then
|
||||
if [[ -z $file ]]; then
|
||||
xsel --clipboard --input
|
||||
else
|
||||
@ -74,9 +74,9 @@ function clippaste() {
|
||||
elif [[ $OSTYPE == cygwin* ]]; then
|
||||
cat /dev/clipboard
|
||||
else
|
||||
if which xclip &>/dev/null; then
|
||||
if (( $+commands[xclip] )); then
|
||||
xclip -out -selection clipboard
|
||||
elif which xsel &>/dev/null; then
|
||||
elif (( $+commands[xsel] )); then
|
||||
xsel --clipboard --output
|
||||
else
|
||||
print "clipcopy: Platform $OSTYPE not supported or xclip/xsel not installed" >&2
|
||||
|
@ -1,4 +1,7 @@
|
||||
# fixme - the load process here seems a bit bizarre
|
||||
zmodload -i zsh/complist
|
||||
|
||||
WORDCHARS=''
|
||||
|
||||
unsetopt menu_complete # do not autoselect the first completion entry
|
||||
unsetopt flowcontrol
|
||||
@ -6,32 +9,26 @@ setopt auto_menu # show completion menu on succesive tab press
|
||||
setopt complete_in_word
|
||||
setopt always_to_end
|
||||
|
||||
WORDCHARS=''
|
||||
|
||||
zmodload -i zsh/complist
|
||||
|
||||
## case-insensitive (all),partial-word and then substring completion
|
||||
if [ "x$CASE_SENSITIVE" = "xtrue" ]; then
|
||||
zstyle ':completion:*' matcher-list 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
|
||||
unset CASE_SENSITIVE
|
||||
else
|
||||
if [ "x$HYPHEN_INSENSITIVE" = "xtrue" ]; then
|
||||
zstyle ':completion:*' matcher-list 'm:{a-zA-Z-_}={A-Za-z_-}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
|
||||
unset HYPHEN_INSENSITIVE
|
||||
else
|
||||
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
|
||||
fi
|
||||
fi
|
||||
|
||||
zstyle ':completion:*' list-colors ''
|
||||
|
||||
# should this be in keybindings?
|
||||
bindkey -M menuselect '^o' accept-and-infer-next-history
|
||||
|
||||
zstyle ':completion:*:*:*:*:*' menu select
|
||||
|
||||
# case insensitive (all), partial-word and substring completion
|
||||
if [[ "$CASE_SENSITIVE" = true ]]; then
|
||||
zstyle ':completion:*' matcher-list 'r:|=*' 'l:|=* r:|=*'
|
||||
else
|
||||
if [[ "$HYPHEN_INSENSITIVE" = true ]]; then
|
||||
zstyle ':completion:*' matcher-list 'm:{a-zA-Z-_}={A-Za-z_-}' 'r:|=*' 'l:|=* r:|=*'
|
||||
else
|
||||
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|=*' 'l:|=* r:|=*'
|
||||
fi
|
||||
fi
|
||||
unset CASE_SENSITIVE HYPHEN_INSENSITIVE
|
||||
|
||||
zstyle ':completion:*' list-colors ''
|
||||
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01'
|
||||
if [ "$OSTYPE[0,7]" = "solaris" ]
|
||||
then
|
||||
|
||||
if [[ "$OSTYPE" = solaris* ]]; then
|
||||
zstyle ':completion:*:*:*:*:processes' command "ps -u $USER -o pid,user,comm"
|
||||
else
|
||||
zstyle ':completion:*:*:*:*:processes' command "ps -u $USER -o pid,user,comm -w -w"
|
||||
|
@ -3,11 +3,11 @@ function zsh_stats() {
|
||||
}
|
||||
|
||||
function uninstall_oh_my_zsh() {
|
||||
env ZSH=$ZSH /bin/sh $ZSH/tools/uninstall.sh
|
||||
env ZSH=$ZSH sh $ZSH/tools/uninstall.sh
|
||||
}
|
||||
|
||||
function upgrade_oh_my_zsh() {
|
||||
env ZSH=$ZSH /bin/sh $ZSH/tools/upgrade.sh
|
||||
env ZSH=$ZSH sh $ZSH/tools/upgrade.sh
|
||||
}
|
||||
|
||||
function take() {
|
||||
|
37
lib/git.zsh
37
lib/git.zsh
@ -76,10 +76,21 @@ function git_current_branch() {
|
||||
|
||||
# Gets the number of commits ahead from remote
|
||||
function git_commits_ahead() {
|
||||
if $(echo "$(command git log @{upstream}..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then
|
||||
local COMMITS
|
||||
COMMITS=$(command git log @{upstream}..HEAD | grep '^commit' | wc -l | tr -d ' ')
|
||||
echo "$ZSH_THEME_GIT_COMMITS_AHEAD_PREFIX$COMMITS$ZSH_THEME_GIT_COMMITS_AHEAD_SUFFIX"
|
||||
if command git rev-parse --git-dir &>/dev/null; then
|
||||
local commits="$(git rev-list --count @{upstream}..HEAD)"
|
||||
if [[ "$commits" != 0 ]]; then
|
||||
echo "$ZSH_THEME_GIT_COMMITS_AHEAD_PREFIX$commits$ZSH_THEME_GIT_COMMITS_AHEAD_SUFFIX"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Gets the number of commits behind remote
|
||||
function git_commits_behind() {
|
||||
if command git rev-parse --git-dir &>/dev/null; then
|
||||
local commits="$(git rev-list --count HEAD..@{upstream})"
|
||||
if [[ "$commits" != 0 ]]; then
|
||||
echo "$ZSH_THEME_GIT_COMMITS_BEHIND_PREFIX$commits$ZSH_THEME_GIT_COMMITS_BEHIND_SUFFIX"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
@ -154,13 +165,13 @@ function git_prompt_status() {
|
||||
if $(echo "$INDEX" | grep '^UU ' &> /dev/null); then
|
||||
STATUS="$ZSH_THEME_GIT_PROMPT_UNMERGED$STATUS"
|
||||
fi
|
||||
if $(echo "$INDEX" | grep '^## .*ahead' &> /dev/null); then
|
||||
if $(echo "$INDEX" | grep '^## [^ ]\+ .*ahead' &> /dev/null); then
|
||||
STATUS="$ZSH_THEME_GIT_PROMPT_AHEAD$STATUS"
|
||||
fi
|
||||
if $(echo "$INDEX" | grep '^## .*behind' &> /dev/null); then
|
||||
if $(echo "$INDEX" | grep '^## [^ ]\+ .*behind' &> /dev/null); then
|
||||
STATUS="$ZSH_THEME_GIT_PROMPT_BEHIND$STATUS"
|
||||
fi
|
||||
if $(echo "$INDEX" | grep '^## .*diverged' &> /dev/null); then
|
||||
if $(echo "$INDEX" | grep '^## [^ ]\+ .*diverged' &> /dev/null); then
|
||||
STATUS="$ZSH_THEME_GIT_PROMPT_DIVERGED$STATUS"
|
||||
fi
|
||||
echo $STATUS
|
||||
@ -188,6 +199,18 @@ function git_compare_version() {
|
||||
echo 0
|
||||
}
|
||||
|
||||
# Outputs the name of the current user
|
||||
# Usage example: $(git_current_user_name)
|
||||
function git_current_user_name() {
|
||||
command git config user.name 2>/dev/null
|
||||
}
|
||||
|
||||
# Outputs the email of the current user
|
||||
# Usage example: $(git_current_user_email)
|
||||
function git_current_user_email() {
|
||||
command git config user.email 2>/dev/null
|
||||
}
|
||||
|
||||
# This is unlikely to change so make it all statically assigned
|
||||
POST_1_7_2_GIT=$(git_compare_version "1.7.2")
|
||||
# Clean up the namespace slightly by removing the checker function
|
||||
|
@ -1,6 +1,6 @@
|
||||
# get the node.js version
|
||||
function nvm_prompt_info() {
|
||||
[ -f "$HOME/.nvm/nvm.sh" ] || return
|
||||
[[ -f "$NVM_DIR/nvm.sh" ]] || return
|
||||
local nvm_prompt
|
||||
nvm_prompt=$(node -v 2>/dev/null)
|
||||
[[ "${nvm_prompt}x" == "x" ]] && return
|
||||
|
@ -1,38 +1,42 @@
|
||||
# ls colors
|
||||
autoload -U colors && colors
|
||||
export LSCOLORS="Gxfxcxdxbxegedabagacad"
|
||||
|
||||
# Enable ls colors
|
||||
if [ "$DISABLE_LS_COLORS" != "true" ]
|
||||
then
|
||||
# Find the option for using colors in ls, depending on the version: Linux or BSD
|
||||
if [[ "$(uname -s)" == "NetBSD" ]]; then
|
||||
export LSCOLORS="Gxfxcxdxbxegedabagacad"
|
||||
|
||||
if [[ "$DISABLE_LS_COLORS" != "true" ]]; then
|
||||
# Find the option for using colors in ls, depending on the version
|
||||
if [[ "$OSTYPE" == netbsd* ]]; then
|
||||
# On NetBSD, test if "gls" (GNU ls) is installed (this one supports colors);
|
||||
# otherwise, leave ls as is, because NetBSD's ls doesn't support -G
|
||||
gls --color -d . &>/dev/null 2>&1 && alias ls='gls --color=tty'
|
||||
elif [[ "$(uname -s)" == "OpenBSD" ]]; then
|
||||
gls --color -d . &>/dev/null && alias ls='gls --color=tty'
|
||||
elif [[ "$OSTYPE" == openbsd* ]]; then
|
||||
# On OpenBSD, "gls" (ls from GNU coreutils) and "colorls" (ls from base,
|
||||
# with color and multibyte support) are available from ports. "colorls"
|
||||
# will be installed on purpose and can't be pulled in by installing
|
||||
# coreutils, so prefer it to "gls".
|
||||
gls --color -d . &>/dev/null 2>&1 && alias ls='gls --color=tty'
|
||||
colorls -G -d . &>/dev/null 2>&1 && alias ls='colorls -G'
|
||||
gls --color -d . &>/dev/null && alias ls='gls --color=tty'
|
||||
colorls -G -d . &>/dev/null && alias ls='colorls -G'
|
||||
elif [[ "$OSTYPE" == darwin* ]]; then
|
||||
gls --color -d . &>/dev/null && alias ls='gls --color=tty' || alias ls='ls -G'
|
||||
else
|
||||
ls --color -d . &>/dev/null 2>&1 && alias ls='ls --color=tty' || alias ls='ls -G'
|
||||
# For GNU ls, we use the default ls color theme. They can later be overwritten by themes.
|
||||
if [[ -z "$LS_COLORS" ]]; then
|
||||
(( $+commands[dircolors] )) && eval "$(dircolors -b)"
|
||||
fi
|
||||
|
||||
ls --color -d . &>/dev/null && alias ls='ls --color=tty' || alias ls='ls -G'
|
||||
|
||||
# Take advantage of $LS_COLORS for completion as well.
|
||||
zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}"
|
||||
fi
|
||||
fi
|
||||
|
||||
#setopt no_beep
|
||||
setopt auto_cd
|
||||
setopt multios
|
||||
setopt cdablevars
|
||||
setopt prompt_subst
|
||||
|
||||
if [[ x$WINDOW != x ]]
|
||||
then
|
||||
SCREEN_NO="%B$WINDOW%b "
|
||||
else
|
||||
SCREEN_NO=""
|
||||
fi
|
||||
[[ -n "$WINDOW" ]] && SCREEN_NO="%B$WINDOW%b " || SCREEN_NO=""
|
||||
|
||||
# Apply theming defaults
|
||||
PS1="%n@%m:%~%# "
|
||||
@ -42,6 +46,3 @@ ZSH_THEME_GIT_PROMPT_PREFIX="git:(" # Prefix at the very beginning of th
|
||||
ZSH_THEME_GIT_PROMPT_SUFFIX=")" # At the very end of the prompt
|
||||
ZSH_THEME_GIT_PROMPT_DIRTY="*" # Text to display if the branch is dirty
|
||||
ZSH_THEME_GIT_PROMPT_CLEAN="" # Text to display if the branch is clean
|
||||
|
||||
# Setup the prompt with pretty colors
|
||||
setopt prompt_subst
|
||||
|
@ -1,4 +0,0 @@
|
||||
This file is only here so that Git will keep a log directory as .gitignore is ignoring all the log files within it.
|
||||
|
||||
feel free to add love notes for people here.
|
||||
|
0
log/.gitkeep
Normal file
0
log/.gitkeep
Normal file
@ -22,7 +22,7 @@ fi
|
||||
# Set ZSH_CACHE_DIR to the path where cache files should be created
|
||||
# or else we will use the default cache/
|
||||
if [[ -z "$ZSH_CACHE_DIR" ]]; then
|
||||
ZSH_CACHE_DIR="$ZSH/cache/"
|
||||
ZSH_CACHE_DIR="$ZSH/cache"
|
||||
fi
|
||||
|
||||
|
||||
@ -53,7 +53,7 @@ done
|
||||
|
||||
# Figure out the SHORT hostname
|
||||
if [[ "$OSTYPE" = darwin* ]]; then
|
||||
# OS X's $HOST changes with dhcp, etc. Use ComputerName if possible.
|
||||
# macOS's $HOST changes with dhcp, etc. Use ComputerName if possible.
|
||||
SHORT_HOST=$(scutil --get ComputerName 2>/dev/null) || SHORT_HOST=${HOST/.*/}
|
||||
else
|
||||
SHORT_HOST=${HOST/.*/}
|
||||
|
5
plugins/arcanist/README.md
Normal file
5
plugins/arcanist/README.md
Normal file
@ -0,0 +1,5 @@
|
||||
## arcanist
|
||||
|
||||
**Maintainer:** [@emzar](https://github.com/emzar)
|
||||
|
||||
This plugin adds many useful aliases.
|
21
plugins/arcanist/arcanist.plugin.zsh
Normal file
21
plugins/arcanist/arcanist.plugin.zsh
Normal file
@ -0,0 +1,21 @@
|
||||
#
|
||||
# Aliases
|
||||
# (sorted alphabetically)
|
||||
#
|
||||
|
||||
alias ara='arc amend'
|
||||
alias arb='arc branch'
|
||||
alias arco='arc cover'
|
||||
alias arci='arc commit'
|
||||
|
||||
alias ard='arc diff'
|
||||
alias ardnu='arc diff --nounit'
|
||||
alias ardnupc='arc diff --nounit --plan-changes'
|
||||
alias ardpc='arc diff --plan-changes'
|
||||
|
||||
alias are='arc export'
|
||||
alias arh='arc help'
|
||||
alias arl='arc land'
|
||||
alias arli='arc lint'
|
||||
alias arls='arc list'
|
||||
alias arpa='arc patch'
|
@ -1,64 +1,95 @@
|
||||
## ARCHLINUX PLUGIN
|
||||
# Archlinux plugin
|
||||
|
||||
## Features
|
||||
|
||||
#### YAOURT
|
||||
|
||||
| Alias | Command | Description |
|
||||
|---------|------------------------------------|---------------------------------------------------------------------|
|
||||
| yaconf | yaourt -C | Fix all configuration files with vimdiff |
|
||||
| yain | yaourt -S | Install packages from the repositories |
|
||||
| yains | yaourt -U | Install a package from a local file |
|
||||
| yainsd | yaourt -S --asdeps | Install packages as dependencies of another package |
|
||||
| yaloc | yaourt -Qi | Display information about a package in the local database |
|
||||
| yalocs | yaourt -Qs | Search for packages in the local database |
|
||||
| yalst | yaourt -Qe | List installed packages including from AUR (tagged as "local") |
|
||||
| yamir | yaourt -Syy | Force refresh of all package lists after updating mirrorlist |
|
||||
| yaorph | yaourt -Qtd | Remove orphans using yaourt |
|
||||
| yare | yaourt -R | Remove packages, keeping its settings and dependencies |
|
||||
| yarem | yaourt -Rns | Remove packages, including its settings and unneeded dependencies |
|
||||
| yarep | yaourt -Si | Display information about a package in the repositories |
|
||||
| yareps | yaourt -Ss | Search for packages in the repositories |
|
||||
| yaupd | yaourt -Sy && sudo abs && sudo aur | Update and refresh local package, ABS and AUR databases |
|
||||
| yaupd | yaourt -Sy && sudo abs | Update and refresh the local package and ABS databases |
|
||||
| yaupd | yaourt -Sy && sudo aur | Update and refresh the local package and AUR databases |
|
||||
| yaupd | yaourt -Sy | Update and refresh the local package database |
|
||||
| yaupg | yaourt -Syua | Sync with repositories before upgrading all packages (from AUR too) |
|
||||
| yasu | yaourt -Syua --no-confirm | Same as `yaupg`, but without confirmation |
|
||||
| upgrade | yaourt -Syu | Sync with repositories before upgrading packages |
|
||||
|
||||
### PACAUR
|
||||
|
||||
| Alias | Command | Description |
|
||||
|---------|------------------------------------|---------------------------------------------------------------------|
|
||||
| pain | pacaur -S | Install packages from the repositories |
|
||||
| pains | pacaur -U | Install a package from a local file |
|
||||
| painsd | pacaur -S --asdeps | Install packages as dependencies of another package |
|
||||
| paloc | pacaur -Qi | Display information about a package in the local database |
|
||||
| palocs | pacaur -Qs | Search for packages in the local database |
|
||||
| palst | pacaur -Qe | List installed packages including from AUR (tagged as "local") |
|
||||
| pamir | pacaur -Syy | Force refresh of all package lists after updating mirrorlist |
|
||||
| paorph | pacaur -Qtd | Remove orphans using pacaur |
|
||||
| pare | pacaur -R | Remove packages, keeping its settings and dependencies |
|
||||
| parem | pacaur -Rns | Remove packages, including its settings and unneeded dependencies |
|
||||
| parep | pacaur -Si | Display information about a package in the repositories |
|
||||
| pareps | pacaur -Ss | Search for packages in the repositories |
|
||||
| paupd | pacaur -Sy && sudo abs && sudo aur | Update and refresh local package, ABS and AUR databases |
|
||||
| paupd | pacaur -Sy && sudo abs | Update and refresh the local package and ABS databases |
|
||||
| paupd | pacaur -Sy && sudo aur | Update and refresh the local package and AUR databases |
|
||||
| paupd | pacaur -Sy | Update and refresh the local package database |
|
||||
| paupg | pacaur -Syua | Sync with repositories before upgrading all packages (from AUR too) |
|
||||
| pasu | pacaur -Syua --no-confirm | Same as `paupg`, but without confirmation |
|
||||
| upgrade | pacaur -Syu | Sync with repositories before upgrading packages |
|
||||
|
||||
#### PACMAN
|
||||
|
||||
| Alias | Command | Description |
|
||||
|--------------|-----------------------------------------|--------------------------------------------------------------|
|
||||
| pacin | sudo pacman -S | Install packages from the repositories |
|
||||
| pacins | sudo pacman -U | Install a package from a local file |
|
||||
| pacinsd | sudo pacman -S --asdeps | Install packages as dependencies of another package |
|
||||
| pacloc | pacman -Qi | Display information about a package in the local database |
|
||||
| paclocs | pacman -Qs | Search for packages in the local database |
|
||||
| paclsorphans | sudo pacman -Qdt | List all orphaned packages |
|
||||
| pacmir | sudo pacman -Syy | Force refresh of all package lists after updating mirrorlist |
|
||||
| pacre | sudo pacman -R | Remove packages, keeping its settings and dependencies |
|
||||
| pacrem | sudo pacman -Rns | Remove packages, including its settings and dependencies |
|
||||
| pacrep | pacman -Si | Display information about a package in the repositories |
|
||||
| pacreps | pacman -Ss | Search for packages in the repositories |
|
||||
| pacrmorphans | sudo pacman -Rs $(pacman -Qtdq) | Delete all orphaned packages |
|
||||
| pacupd | sudo pacman -Sy && sudo abs && sudo aur | Update and refresh the local package, ABS and AUR databases |
|
||||
| pacupd | sudo pacman -Sy && sudo abs | Update and refresh the local package and ABS databases |
|
||||
| pacupd | sudo pacman -Sy && sudo aur | Update and refresh the local package and AUR databases |
|
||||
| pacupd | sudo pacman -Sy | Update and refresh the local package database |
|
||||
| pacupg | sudo pacman -Syu | Sync with repositories before upgrading packages |
|
||||
| upgrade | sudo pacman -Syu | Sync with repositories before upgrading packages |
|
||||
|
||||
| Function | Description |
|
||||
|----------------|------------------------------------------------------|
|
||||
| pacdisowned | List all disowned files in your system |
|
||||
| paclist | List all installed packages with a short description |
|
||||
| pacmanallkeys | Get all keys for developers and trusted users |
|
||||
| pacmansignkeys | Locally trust all keys passed as parameters |
|
||||
|
||||
---
|
||||
|
||||
### FEATURES
|
||||
## Contributors
|
||||
|
||||
| Alias | Function | Description |
|
||||
|:------------:|-----------------------------------------|:--------------------------------------------------------------------------------------------------------------------|
|
||||
| pacin | sudo pacman -S | Install specific package(s) from the repositories |
|
||||
| pacins | sudo pacman -U | Install specific package not from the repositories but from a file |
|
||||
| pacinsd | sudo pacman -S --asdeps | Install given package(s) as dependencies of another package |
|
||||
| pacloc | pacman -Qi | Display information about a given package in the local database |
|
||||
| paclocs | pacman -Qs | Search for package(s) in the local database |
|
||||
| paclsorphans | sudo pacman -Qdt' | List all orphaned packages |
|
||||
| pacmir | sudo pacman -Syy | Force refresh of all package lists after updating /etc/pacman.d/mirrorlist |
|
||||
| pacre | sudo pacman -R | Remove the specified package(s), retaining its configuration(s) and required dependencies |
|
||||
| pacrem | sudo pacman -Rns | Remove the specified package(s), its configuration(s) and unneeded dependencies |
|
||||
| pacrep | pacman -Si | Display information about a given package in the repositories |
|
||||
| pacreps | pacman -Ss | Search for package(s) in the repositories |
|
||||
| pacrmorphans | sudo pacman -Rs $(pacman -Qtdq)' | Delete all orphaned packages |
|
||||
| pacupd | sudo pacman -Sy && sudo abs && sudo aur | Update and refresh the local package, ABS and AUR databases against repositories |
|
||||
| pacupd | sudo pacman -Sy && sudo abs | Update and refresh the local package and ABS databases against repositories |
|
||||
| pacupd | sudo pacman -Sy && sudo aur | Update and refresh the local package and AUR databases against repositories |
|
||||
| pacupd | sudo pacman -Sy | Update and refresh the local package database against repositories |
|
||||
| pacupg | sudo pacman -Syu | Synchronize with repositories before upgrading packages that are out of date on the local system. |
|
||||
| yaconf | yaourt -C | Fix all configuration files with vimdiff |
|
||||
| yain | yaourt -S | Install specific package(s) from the repositories |
|
||||
| yains | yaourt -U | Install specific package not from the repositories but from a file |
|
||||
| yainsd | yaourt -S --asdeps | Install given package(s) as dependencies of another package |
|
||||
| yaloc | yaourt -Qi | Display information about a given package in the local database |
|
||||
| yalocs | yaourt -Qs | Search for package(s) in the local database |
|
||||
| yalst | yaourt -Qe | List installed packages, even those installed from AUR (they're tagged as "local") |
|
||||
| yamir | yaourt -Syy | Force refresh of all package lists after updating /etc/pacman.d/mirrorlist |
|
||||
| yaorph | yaourt -Qtd | Remove orphans using yaourt |
|
||||
| yare | yaourt -R | Remove the specified package(s), retaining its configuration(s) and required dependencies |
|
||||
| yarem | yaourt -Rns | Remove the specified package(s), its configuration(s) and unneeded dependencies |
|
||||
| yarep | yaourt -Si | Display information about a given package in the repositories |
|
||||
| yareps | yaourt -Ss | Search for package(s) in the repositories |
|
||||
| yasu | yaourt --sucre | Same as yaupg, but without confirmation |
|
||||
| yaupd | yaourt -Sy && sudo abs && sudo aur | Update and refresh the local package, ABS and AUR databases against repositories |
|
||||
| yaupd | yaourt -Sy && sudo abs | Update and refresh the local package and ABS databases against repositories |
|
||||
| yaupd | yaourt -Sy && sudo aur | Update and refresh the local package and AUR databases against repositories |
|
||||
| yaupd | yaourt -Sy | Update and refresh the local package database against repositories |
|
||||
| yaupg | yaourt -Syua | Synchronize with repositories before upgrading packages (AUR packages too) that are out of date on the local system |
|
||||
|
||||
| Function | Description |
|
||||
|----------------|:------------------------------------------------------------------------------------------------------------------|
|
||||
| pacdisowned | List all disowned files in your system |
|
||||
| paclist | List all installed packages with a short description - [Source](https://bbs.archlinux.org/viewtopic.php?id=93683) |
|
||||
| pacmanallkeys | Get all keys for developers and trusted users |
|
||||
| pacmansignkeys | |
|
||||
|
||||
---
|
||||
|
||||
### CONTRIBUTORS
|
||||
- Benjamin Boudreau - dreurmail@gmail.com
|
||||
- Celso Miranda - contacto@celsomiranda.net
|
||||
- KhasMek - Boushh@gmail.com
|
||||
- Martin Putniorz - mputniorz@gmail.com
|
||||
- MatthR3D - matthr3d@gmail.com
|
||||
- ornicar - thibault.duplessis@gmail.com
|
||||
|
||||
---
|
||||
- Benjamin Boudreau - dreurmail@gmail.com
|
||||
- Celso Miranda - contacto@celsomiranda.net
|
||||
- KhasMek - Boushh@gmail.com
|
||||
- Martin Putniorz - mputniorz@gmail.com
|
||||
- MatthR3D - matthr3d@gmail.com
|
||||
- ornicar - thibault.duplessis@gmail.com
|
||||
- Juraj Fiala - doctorjellyface@riseup.net
|
||||
- Majora320 (Moses Miller) - Majora320@gmail.com
|
||||
|
@ -1,75 +1,108 @@
|
||||
# Archlinux zsh aliases and functions
|
||||
# Usage is also described at https://github.com/robbyrussell/oh-my-zsh/wiki/Plugins
|
||||
|
||||
# Look for yaourt, and add some useful functions if we have it.
|
||||
if (( $+commands[yaourt] )); then
|
||||
upgrade () {
|
||||
alias yaconf='yaourt -C'
|
||||
alias yaupg='yaourt -Syua'
|
||||
alias yasu='yaourt -Syua --noconfirm'
|
||||
alias yain='yaourt -S'
|
||||
alias yains='yaourt -U'
|
||||
alias yare='yaourt -R'
|
||||
alias yarem='yaourt -Rns'
|
||||
alias yarep='yaourt -Si'
|
||||
alias yareps='yaourt -Ss'
|
||||
alias yaloc='yaourt -Qi'
|
||||
alias yalocs='yaourt -Qs'
|
||||
alias yalst='yaourt -Qe'
|
||||
alias yaorph='yaourt -Qtd'
|
||||
alias yainsd='yaourt -S --asdeps'
|
||||
alias yamir='yaourt -Syy'
|
||||
|
||||
|
||||
if (( $+commands[abs] && $+commands[aur] )); then
|
||||
alias yaupd='yaourt -Sy && sudo abs && sudo aur'
|
||||
elif (( $+commands[abs] )); then
|
||||
alias yaupd='yaourt -Sy && sudo abs'
|
||||
elif (( $+commands[aur] )); then
|
||||
alias yaupd='yaourt -Sy && sudo aur'
|
||||
else
|
||||
alias yaupd='yaourt -Sy'
|
||||
fi
|
||||
fi
|
||||
|
||||
if (( $+commands[pacaur] )); then
|
||||
alias paupg='pacaur -Syua'
|
||||
alias pasu='pacaur -Syua --noconfirm'
|
||||
alias pain='pacaur -S'
|
||||
alias pains='pacaur -U'
|
||||
alias pare='pacaur -R'
|
||||
alias parem='pacaur -Rns'
|
||||
alias parep='pacaur -Si'
|
||||
alias pareps='pacaur -Ss'
|
||||
alias paloc='pacaur -Qi'
|
||||
alias palocs='pacaur -Qs'
|
||||
alias palst='pacaur -Qe'
|
||||
alias paorph='pacaur -Qtd'
|
||||
alias painsd='pacaur -S --asdeps'
|
||||
alias pamir='pacaur -Syy'
|
||||
|
||||
if (( $+commands[abs] && $+commands[aur] )); then
|
||||
alias paupd='pacaur -Sy && sudo abs && sudo aur'
|
||||
elif (( $+commands[abs] )); then
|
||||
alias paupd='pacaur -Sy && sudo abs'
|
||||
elif (( $+commands[aur] )); then
|
||||
alias paupd='pacaur -Sy && sudo aur'
|
||||
else
|
||||
alias paupd='pacaur -Sy'
|
||||
fi
|
||||
fi
|
||||
|
||||
if (( $+commands[pacaur] )); then
|
||||
upgrade() {
|
||||
pacaur -Syu
|
||||
}
|
||||
elif (( $+commands[yaourt] )); then
|
||||
upgrade() {
|
||||
yaourt -Syu
|
||||
}
|
||||
alias yaconf='yaourt -C' # Fix all configuration files with vimdiff
|
||||
# Pacman - https://wiki.archlinux.org/index.php/Pacman_Tips
|
||||
alias yaupg='yaourt -Syua' # Synchronize with repositories before upgrading packages (AUR packages too) that are out of date on the local system.
|
||||
alias yasu='yaourt --sucre' # Same as yaupg, but without confirmation
|
||||
alias yain='yaourt -S' # Install specific package(s) from the repositories
|
||||
alias yains='yaourt -U' # Install specific package not from the repositories but from a file
|
||||
alias yare='yaourt -R' # Remove the specified package(s), retaining its configuration(s) and required dependencies
|
||||
alias yarem='yaourt -Rns' # Remove the specified package(s), its configuration(s) and unneeded dependencies
|
||||
alias yarep='yaourt -Si' # Display information about a given package in the repositories
|
||||
alias yareps='yaourt -Ss' # Search for package(s) in the repositories
|
||||
alias yaloc='yaourt -Qi' # Display information about a given package in the local database
|
||||
alias yalocs='yaourt -Qs' # Search for package(s) in the local database
|
||||
alias yalst='yaourt -Qe' # List installed packages, even those installed from AUR (they're tagged as "local")
|
||||
alias yaorph='yaourt -Qtd' # Remove orphans using yaourt
|
||||
# Additional yaourt alias examples
|
||||
if (( $+commands[abs] && $+commands[aur] )); then
|
||||
alias yaupd='yaourt -Sy && sudo abs && sudo aur' # Update and refresh the local package, ABS and AUR databases against repositories
|
||||
elif (( $+commands[abs] )); then
|
||||
alias yaupd='yaourt -Sy && sudo abs' # Update and refresh the local package and ABS databases against repositories
|
||||
elif (( $+commands[aur] )); then
|
||||
alias yaupd='yaourt -Sy && sudo aur' # Update and refresh the local package and AUR databases against repositories
|
||||
else
|
||||
alias yaupd='yaourt -Sy' # Update and refresh the local package database against repositories
|
||||
fi
|
||||
alias yainsd='yaourt -S --asdeps' # Install given package(s) as dependencies of another package
|
||||
alias yamir='yaourt -Syy' # Force refresh of all package lists after updating /etc/pacman.d/mirrorlist
|
||||
else
|
||||
upgrade() {
|
||||
sudo pacman -Syu
|
||||
}
|
||||
upgrade() {
|
||||
sudo pacman -Syu
|
||||
}
|
||||
fi
|
||||
|
||||
# Pacman - https://wiki.archlinux.org/index.php/Pacman_Tips
|
||||
alias pacupg='sudo pacman -Syu' # Synchronize with repositories before upgrading packages that are out of date on the local system.
|
||||
alias pacin='sudo pacman -S' # Install specific package(s) from the repositories
|
||||
alias pacins='sudo pacman -U' # Install specific package not from the repositories but from a file
|
||||
alias pacre='sudo pacman -R' # Remove the specified package(s), retaining its configuration(s) and required dependencies
|
||||
alias pacrem='sudo pacman -Rns' # Remove the specified package(s), its configuration(s) and unneeded dependencies
|
||||
alias pacrep='pacman -Si' # Display information about a given package in the repositories
|
||||
alias pacreps='pacman -Ss' # Search for package(s) in the repositories
|
||||
alias pacloc='pacman -Qi' # Display information about a given package in the local database
|
||||
alias paclocs='pacman -Qs' # Search for package(s) in the local database
|
||||
# Additional pacman alias examples
|
||||
if (( $+commands[abs] && $+commands[aur] )); then
|
||||
alias pacupd='sudo pacman -Sy && sudo abs && sudo aur' # Update and refresh the local package, ABS and AUR databases against repositories
|
||||
elif (( $+commands[abs] )); then
|
||||
alias pacupd='sudo pacman -Sy && sudo abs' # Update and refresh the local package and ABS databases against repositories
|
||||
elif (( $+commands[aur] )); then
|
||||
alias pacupd='sudo pacman -Sy && sudo aur' # Update and refresh the local package and AUR databases against repositories
|
||||
else
|
||||
alias pacupd='sudo pacman -Sy' # Update and refresh the local package database against repositories
|
||||
fi
|
||||
alias pacinsd='sudo pacman -S --asdeps' # Install given package(s) as dependencies of another package
|
||||
alias pacmir='sudo pacman -Syy' # Force refresh of all package lists after updating /etc/pacman.d/mirrorlist
|
||||
|
||||
# https://bbs.archlinux.org/viewtopic.php?id=93683
|
||||
paclist() {
|
||||
LC_ALL=C pacman -Qei $(pacman -Qu|cut -d" " -f 1)|awk ' BEGIN {FS=":"}/^Name/{printf("\033[1;36m%s\033[1;37m", $2)}/^Description/{print $2}'
|
||||
}
|
||||
|
||||
alias pacupg='sudo pacman -Syu'
|
||||
alias pacin='sudo pacman -S'
|
||||
alias pacins='sudo pacman -U'
|
||||
alias pacre='sudo pacman -R'
|
||||
alias pacrem='sudo pacman -Rns'
|
||||
alias pacrep='pacman -Si'
|
||||
alias pacreps='pacman -Ss'
|
||||
alias pacloc='pacman -Qi'
|
||||
alias paclocs='pacman -Qs'
|
||||
alias pacinsd='sudo pacman -S --asdeps'
|
||||
alias pacmir='sudo pacman -Syy'
|
||||
alias paclsorphans='sudo pacman -Qdt'
|
||||
alias pacrmorphans='sudo pacman -Rs $(pacman -Qtdq)'
|
||||
|
||||
|
||||
if (( $+commands[abs] && $+commands[aur] )); then
|
||||
alias pacupd='sudo pacman -Sy && sudo abs && sudo aur'
|
||||
elif (( $+commands[abs] )); then
|
||||
alias pacupd='sudo pacman -Sy && sudo abs'
|
||||
elif (( $+commands[aur] )); then
|
||||
alias pacupd='sudo pacman -Sy && sudo aur'
|
||||
else
|
||||
alias pacupd='sudo pacman -Sy'
|
||||
fi
|
||||
|
||||
paclist() {
|
||||
# Source: https://bbs.archlinux.org/viewtopic.php?id=93683
|
||||
LC_ALL=C pacman -Qei $(pacman -Qu | cut -d " " -f 1) | \
|
||||
awk 'BEGIN {FS=":"} /^Name/{printf("\033[1;36m%s\033[1;37m", $2)} /^Description/{print $2}'
|
||||
}
|
||||
|
||||
pacdisowned() {
|
||||
emulate -L zsh
|
||||
|
||||
tmp=${TMPDIR-/tmp}/pacman-disowned-$UID-$$
|
||||
db=$tmp/db
|
||||
fs=$tmp/fs
|
||||
@ -79,21 +112,21 @@ pacdisowned() {
|
||||
|
||||
pacman -Qlq | sort -u > "$db"
|
||||
|
||||
find /bin /etc /lib /sbin /usr \
|
||||
! -name lost+found \
|
||||
\( -type d -printf '%p/\n' -o -print \) | sort > "$fs"
|
||||
find /bin /etc /lib /sbin /usr ! -name lost+found \
|
||||
\( -type d -printf '%p/\n' -o -print \) | sort > "$fs"
|
||||
|
||||
comm -23 "$fs" "$db"
|
||||
}
|
||||
|
||||
pacmanallkeys() {
|
||||
# Get all keys for developers and trusted users
|
||||
curl https://www.archlinux.org/{developers,trustedusers}/ |
|
||||
awk -F\" '(/pgp.mit.edu/) {sub(/.*search=0x/,"");print $1}' |
|
||||
xargs sudo pacman-key --recv-keys
|
||||
emulate -L zsh
|
||||
curl -s https://www.archlinux.org/people/{developers,trustedusers}/ | \
|
||||
awk -F\" '(/pgp.mit.edu/) { sub(/.*search=0x/,""); print $1}' | \
|
||||
xargs sudo pacman-key --recv-keys
|
||||
}
|
||||
|
||||
pacmansignkeys() {
|
||||
emulate -L zsh
|
||||
for key in $*; do
|
||||
sudo pacman-key --recv-keys $key
|
||||
sudo pacman-key --lsign-key $key
|
||||
|
27
plugins/asdf/README.md
Normal file
27
plugins/asdf/README.md
Normal file
@ -0,0 +1,27 @@
|
||||
## asdf
|
||||
|
||||
**Maintainer:** [@RobLoach](https://github.com/RobLoach)
|
||||
|
||||
Adds integration with [asdf](https://github.com/asdf-vm/asdf), the extendable version manager, with support for Ruby, Node.js, Elixir, Erlang and more.
|
||||
|
||||
### Installation
|
||||
|
||||
1. Enable the plugin by adding it to your `plugins` definition in `~/.zshrc`.
|
||||
|
||||
```
|
||||
plugins=(asdf)
|
||||
```
|
||||
|
||||
2. [Install asdf](https://github.com/asdf-vm/asdf#setup) by running the following:
|
||||
```
|
||||
git clone https://github.com/asdf-vm/asdf.git ~/.asdf
|
||||
```
|
||||
|
||||
### Usage
|
||||
|
||||
See the [asdf usage documentation](https://github.com/asdf-vm/asdf#usage) for information on how to use asdf:
|
||||
|
||||
```
|
||||
asdf plugin-add nodejs git@github.com:asdf-vm/asdf-nodejs.git
|
||||
asdf install nodejs 5.9.1
|
||||
```
|
7
plugins/asdf/asdf.plugin.zsh
Normal file
7
plugins/asdf/asdf.plugin.zsh
Normal file
@ -0,0 +1,7 @@
|
||||
# Find where asdf should be installed.
|
||||
ASDF_DIR="${ASDF_DIR:-$HOME/.asdf}"
|
||||
|
||||
# Load asdf, if found.
|
||||
if [ -f $ASDF_DIR/asdf.sh ]; then
|
||||
. $ASDF_DIR/asdf.sh
|
||||
fi
|
@ -1,7 +1,7 @@
|
||||
# Activates autoenv or reports its failure
|
||||
() {
|
||||
if ! type autoenv_init >/dev/null; then
|
||||
for d (~/.autoenv /usr/local/opt/autoenv); do
|
||||
for d (~/.autoenv /usr/local/opt/autoenv /usr/local/bin); do
|
||||
if [[ -e $d/activate.sh ]]; then
|
||||
autoenv_dir=$d
|
||||
break
|
||||
|
@ -64,15 +64,15 @@ if [[ "$OSTYPE" = darwin* ]] ; then
|
||||
[[ $(ioreg -rc "AppleSmartBattery"| grep '^.*"IsCharging"\ =\ ' | sed -e 's/^.*"IsCharging"\ =\ //') == "Yes" ]]
|
||||
}
|
||||
|
||||
elif [[ $(uname) == "Linux" ]] ; then
|
||||
elif [[ "$OSTYPE" = linux* ]] ; then
|
||||
|
||||
function battery_is_charging() {
|
||||
! [[ $(acpi 2&>/dev/null | grep -c '^Battery.*Discharging') -gt 0 ]]
|
||||
! [[ $(acpi 2>/dev/null | grep -c '^Battery.*Discharging') -gt 0 ]]
|
||||
}
|
||||
|
||||
function battery_pct() {
|
||||
if (( $+commands[acpi] )) ; then
|
||||
echo "$(acpi | cut -f2 -d ',' | tr -cd '[:digit:]')"
|
||||
echo "$(acpi 2>/dev/null | cut -f2 -d ',' | tr -cd '[:digit:]')"
|
||||
fi
|
||||
}
|
||||
|
||||
@ -85,14 +85,14 @@ elif [[ $(uname) == "Linux" ]] ; then
|
||||
}
|
||||
|
||||
function battery_time_remaining() {
|
||||
if [[ $(acpi 2&>/dev/null | grep -c '^Battery.*Discharging') -gt 0 ]] ; then
|
||||
echo $(acpi | cut -f3 -d ',')
|
||||
if [[ $(acpi 2>/dev/null | grep -c '^Battery.*Discharging') -gt 0 ]] ; then
|
||||
echo $(acpi 2>/dev/null | cut -f3 -d ',')
|
||||
fi
|
||||
}
|
||||
|
||||
function battery_pct_prompt() {
|
||||
b=$(battery_pct_remaining)
|
||||
if [[ $(acpi 2&>/dev/null | grep -c '^Battery.*Discharging') -gt 0 ]] ; then
|
||||
if [[ $(acpi 2>/dev/null | grep -c '^Battery.*Discharging') -gt 0 ]] ; then
|
||||
if [ $b -gt 50 ] ; then
|
||||
color='green'
|
||||
elif [ $b -gt 20 ] ; then
|
||||
|
@ -72,6 +72,7 @@ _bower ()
|
||||
compadd "$@" $(echo $bower_package_list)
|
||||
;;
|
||||
*)
|
||||
_arguments \
|
||||
$_no_color \
|
||||
;;
|
||||
esac
|
||||
|
@ -17,7 +17,12 @@ function branch_prompt_info() {
|
||||
# Mercurial repository
|
||||
if [[ -d "${current_dir}/.hg" ]]
|
||||
then
|
||||
echo '☿' $(<"$current_dir/.hg/branch")
|
||||
if [[ -f "$current_dir/.hg/branch" ]]
|
||||
then
|
||||
echo '☿' $(<"$current_dir/.hg/branch")
|
||||
else
|
||||
echo '☿ default'
|
||||
fi
|
||||
return;
|
||||
fi
|
||||
# Defines path as parent directory and keeps looking for :)
|
||||
|
@ -1,84 +0,0 @@
|
||||
# Autocompletion for homebrew-cask.
|
||||
#
|
||||
# This script intercepts calls to the brew plugin and adds autocompletion
|
||||
# for the cask subcommand.
|
||||
#
|
||||
# Author: https://github.com/pstadler
|
||||
|
||||
compdef _brew-cask brew
|
||||
|
||||
_brew-cask()
|
||||
{
|
||||
local curcontext="$curcontext" state line
|
||||
typeset -A opt_args
|
||||
|
||||
_arguments -C \
|
||||
':command:->command' \
|
||||
':subcmd:->subcmd' \
|
||||
'*::options:->options'
|
||||
|
||||
case $state in
|
||||
(command)
|
||||
__call_original_brew
|
||||
cask_commands=(
|
||||
'cask:manage casks'
|
||||
)
|
||||
_describe -t commands 'brew cask command' cask_commands ;;
|
||||
|
||||
(subcmd)
|
||||
case "$line[1]" in
|
||||
cask)
|
||||
if (( CURRENT == 3 )); then
|
||||
local -a subcommands
|
||||
subcommands=(
|
||||
"alfred:used to modify Alfred's scope to include the Caskroom"
|
||||
'audit:verifies installability of casks'
|
||||
'checklinks:checks for bad cask links'
|
||||
'cleanup:cleans up cached downloads'
|
||||
'create:creates a cask of the given name and opens it in an editor'
|
||||
'doctor:checks for configuration issues'
|
||||
'edit:edits the cask of the given name'
|
||||
'fetch:downloads Cask resources to local cache'
|
||||
'home:opens the homepage of the cask of the given name'
|
||||
'info:displays information about the cask of the given name'
|
||||
'install:installs the cask of the given name'
|
||||
'list:with no args, lists installed casks; given installed casks, lists installed files'
|
||||
'search:searches all known casks'
|
||||
'uninstall:uninstalls the cask of the given name'
|
||||
"update:a synonym for 'brew update'"
|
||||
)
|
||||
_describe -t commands "brew cask subcommand" subcommands
|
||||
fi ;;
|
||||
|
||||
*)
|
||||
__call_original_brew ;;
|
||||
esac ;;
|
||||
|
||||
(options)
|
||||
local -a casks installed_casks
|
||||
local expl
|
||||
case "$line[2]" in
|
||||
list|uninstall)
|
||||
__brew_installed_casks
|
||||
_wanted installed_casks expl 'installed casks' compadd -a installed_casks ;;
|
||||
audit|edit|home|info|install)
|
||||
__brew_all_casks
|
||||
_wanted casks expl 'all casks' compadd -a casks ;;
|
||||
esac ;;
|
||||
esac
|
||||
}
|
||||
|
||||
__brew_all_casks() {
|
||||
casks=(`brew cask search`)
|
||||
}
|
||||
|
||||
__brew_installed_casks() {
|
||||
installed_casks=(`brew cask list`)
|
||||
}
|
||||
|
||||
__call_original_brew()
|
||||
{
|
||||
local ret=1
|
||||
_call_function ret _brew
|
||||
compdef _brew-cask brew
|
||||
}
|
@ -1,145 +0,0 @@
|
||||
#compdef brew
|
||||
#autoload
|
||||
|
||||
# imported from https://github.com/Homebrew/homebrew/blob/29f73d2212c2b202fe25f69dcbf440d8391fa4c9/Library/Contributions/brew_zsh_completion.zsh
|
||||
|
||||
# Brew ZSH completion function
|
||||
# Drop this somewhere in your $fpath (like /usr/share/zsh/site-functions)
|
||||
# and rename it _brew
|
||||
#
|
||||
# altered from _fink
|
||||
|
||||
_brew_all_formulae() {
|
||||
formulae=(`brew search`)
|
||||
}
|
||||
|
||||
_brew_installed_formulae() {
|
||||
installed_formulae=(`brew list`)
|
||||
}
|
||||
|
||||
_brew_installed_taps() {
|
||||
installed_taps=(`brew tap`)
|
||||
}
|
||||
|
||||
_brew_official_taps() {
|
||||
official_taps=(`brew tap --list-official`)
|
||||
}
|
||||
|
||||
_brew_pinned_taps() {
|
||||
pinned_taps=(`brew tap --list-pinned`)
|
||||
}
|
||||
|
||||
_brew_outdated_formulae() {
|
||||
outdated_formulae=(`brew outdated`)
|
||||
}
|
||||
|
||||
local -a _1st_arguments
|
||||
_1st_arguments=(
|
||||
'audit:check formulae for Homebrew coding style'
|
||||
'cat:display formula file for a formula'
|
||||
'cleanup:uninstall unused and old versions of packages'
|
||||
'commands:show a list of commands'
|
||||
'config:show homebrew and system configuration'
|
||||
'create:create a new formula'
|
||||
'deps:list dependencies and dependants of a formula'
|
||||
'desc:display a description of a formula'
|
||||
'doctor:audits your installation for common issues'
|
||||
'edit:edit a formula'
|
||||
'fetch:download formula resources to the cache'
|
||||
'gist-logs:generate a gist of the full build logs'
|
||||
'home:visit the homepage of a formula or the brew project'
|
||||
'info:information about a formula'
|
||||
'install:install a formula'
|
||||
'reinstall:install a formula anew; re-using its current options'
|
||||
'leaves:show installed formulae that are not dependencies of another installed formula'
|
||||
'link:link a formula'
|
||||
'linkapps:symlink .app bundles provided by formulae into /Applications'
|
||||
'list:list files in a formula or not-installed formulae'
|
||||
'log:git commit log for a formula'
|
||||
'missing:check all installed formuale for missing dependencies.'
|
||||
'migrate:migrate renamed formula to new name'
|
||||
'outdated:list formulae for which a newer version is available'
|
||||
'pin:pin specified formulae'
|
||||
'postinstall:perform post_install for a given formula'
|
||||
'prune:remove dead links'
|
||||
'remove:remove a formula'
|
||||
'search:search for a formula (/regex/ or string)'
|
||||
'switch:switch between different versions of a formula'
|
||||
'tap:tap a new formula repository from GitHub, or list existing taps'
|
||||
'tap-info:information about a tap'
|
||||
'tap-pin:pin a tap'
|
||||
'tap-unpin:unpin a tap'
|
||||
'test-bot:test a formula and build a bottle'
|
||||
'uninstall:uninstall a formula'
|
||||
'unlink:unlink a formula'
|
||||
'unlinkapps:remove symlinked .app bundles provided by formulae from /Applications'
|
||||
'unpin:unpin specified formulae'
|
||||
'untap:remove a tapped repository'
|
||||
'update:fetch latest version of Homebrew and all formulae'
|
||||
'upgrade:upgrade outdated formulae'
|
||||
'uses:show formulae which depend on a formula'
|
||||
`brew commands --quiet --include-aliases`
|
||||
)
|
||||
|
||||
local expl
|
||||
local -a formulae installed_formulae installed_taps official_taps outdated_formulae
|
||||
|
||||
_arguments \
|
||||
'(-v)-v[verbose]' \
|
||||
'(--cellar)--cellar[brew cellar]' \
|
||||
'(--env)--env[brew environment]' \
|
||||
'(--repository)--repository[brew repository]' \
|
||||
'(--version)--version[version information]' \
|
||||
'(--prefix)--prefix[where brew lives on this system]' \
|
||||
'(--cache)--cache[brew cache]' \
|
||||
'*:: :->subcmds' && return 0
|
||||
|
||||
if (( CURRENT == 1 )); then
|
||||
_describe -t commands "brew subcommand" _1st_arguments
|
||||
return
|
||||
fi
|
||||
|
||||
case "$words[1]" in
|
||||
install|reinstall|audit|home|homepage|log|info|abv|uses|cat|deps|desc|edit|options|switch)
|
||||
_brew_all_formulae
|
||||
_wanted formulae expl 'all formulae' compadd -a formulae ;;
|
||||
linkapps|unlinkapps)
|
||||
_arguments \
|
||||
'(--local)--local[operate on ~/Applications instead of /Applications]' \
|
||||
'1: :->forms' && return 0
|
||||
|
||||
if [[ "$state" == forms ]]; then
|
||||
_brew_installed_formulae
|
||||
_wanted installed_formulae expl 'installed formulae' compadd -a installed_formulae
|
||||
fi ;;
|
||||
list|ls)
|
||||
_arguments \
|
||||
'(--unbrewed)--unbrewed[files in brew --prefix not controlled by brew]' \
|
||||
'(--pinned)--pinned[list all versions of pinned formulae]' \
|
||||
'(--versions)--versions[list all installed versions of a formula]' \
|
||||
'1: :->forms' && return 0
|
||||
|
||||
if [[ "$state" == forms ]]; then
|
||||
_brew_installed_formulae
|
||||
_wanted installed_formulae expl 'installed formulae' compadd -a installed_formulae
|
||||
fi ;;
|
||||
remove|rm|uninstall|unlink|cleanup|link|ln|pin|unpin)
|
||||
_brew_installed_formulae
|
||||
_wanted installed_formulae expl 'installed formulae' compadd -a installed_formulae ;;
|
||||
search|-S)
|
||||
_arguments \
|
||||
'(--macports)--macports[search the macports repository]' \
|
||||
'(--fink)--fink[search the fink repository]' ;;
|
||||
untap|tap-info|tap-pin)
|
||||
_brew_installed_taps
|
||||
_wanted installed_taps expl 'installed taps' compadd -a installed_taps ;;
|
||||
tap)
|
||||
_brew_official_taps
|
||||
_wanted official_taps expl 'official taps' compadd -a official_taps ;;
|
||||
tap-unpin)
|
||||
_brew_pinned_taps
|
||||
_wanted pinned_taps expl 'pinned taps' compadd -a pinned_taps ;;
|
||||
upgrade)
|
||||
_brew_outdated_formulae
|
||||
_wanted outdated_formulae expl 'outdated formulae' compadd -a outdated_formulae ;;
|
||||
esac
|
@ -6,6 +6,7 @@
|
||||
- `bl` aliased to `bundle list`
|
||||
- `bp` aliased to `bundle package`
|
||||
- `bo` aliased to `bundle open`
|
||||
- `bout` aliased to `bundle outdated`
|
||||
- `bu` aliased to `bundle update`
|
||||
- `bi` aliased to `bundle install --jobs=<cpu core count>` (only for bundler `>= 1.4.0`)
|
||||
- adds a wrapper for common gems:
|
||||
|
@ -58,7 +58,7 @@ bundle_install() {
|
||||
if [[ $bundler_version > '1.4.0' || $bundler_version = '1.4.0' ]]; then
|
||||
if [[ "$OSTYPE" = darwin* ]]
|
||||
then
|
||||
local cores_num="$(sysctl hw.ncpu | awk '{print $2}')"
|
||||
local cores_num="$(sysctl -n hw.ncpu)"
|
||||
else
|
||||
local cores_num="$(nproc)"
|
||||
fi
|
||||
|
@ -1,11 +1,31 @@
|
||||
# CakePHP 3 basic command completion
|
||||
_cakephp3_get_command_list () {
|
||||
cakephp3commands=($(bin/cake completion commands));printf "%s\n" "${cakephp3commands[@]}"
|
||||
bin/cake Completion commands
|
||||
}
|
||||
|
||||
_cakephp3_get_sub_command_list () {
|
||||
bin/cake Completion subcommands ${words[2]}
|
||||
}
|
||||
|
||||
_cakephp3_get_3rd_argument () {
|
||||
bin/cake ${words[2]} ${words[3]} | \grep '\-\ '| \awk '{print $2}'
|
||||
}
|
||||
|
||||
_cakephp3 () {
|
||||
if [ -f bin/cake ]; then
|
||||
compadd `_cakephp3_get_command_list`
|
||||
local -a has3rdargument
|
||||
has3rdargument=("all" "controller" "fixture" "model" "template")
|
||||
if [ -f bin/cake ]; then
|
||||
if (( CURRENT == 2 )); then
|
||||
compadd $(_cakephp3_get_command_list)
|
||||
fi
|
||||
if (( CURRENT == 3 )); then
|
||||
compadd $(_cakephp3_get_sub_command_list)
|
||||
fi
|
||||
if (( CURRENT == 4 )); then
|
||||
if [[ ${has3rdargument[(i)${words[3]}]} -le ${#has3rdargument} ]]; then
|
||||
compadd $(_cakephp3_get_3rd_argument)
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
@ -14,6 +34,5 @@ compdef _cakephp3 cake
|
||||
|
||||
#Alias
|
||||
alias c3='bin/cake'
|
||||
|
||||
alias c3cache='bin/cake orm_cache clear'
|
||||
alias c3migrate='bin/cake migrations migrate'
|
||||
|
11
plugins/cargo/README.md
Normal file
11
plugins/cargo/README.md
Normal file
@ -0,0 +1,11 @@
|
||||
# cargo
|
||||
|
||||
This plugin adds completion for the Rust build tool [`cargo`](https://github.com/rust-lang/cargo).
|
||||
|
||||
To use it, add `cargo` to the plugins array in your zshrc file:
|
||||
|
||||
```zsh
|
||||
plugins=(... cargo)
|
||||
```
|
||||
|
||||
Updated on October 4th, 2016.
|
497
plugins/cargo/_cargo
Normal file
497
plugins/cargo/_cargo
Normal file
@ -0,0 +1,497 @@
|
||||
#compdef cargo
|
||||
|
||||
typeset -A opt_args
|
||||
autoload -U regexp-replace
|
||||
|
||||
_cargo() {
|
||||
|
||||
_arguments \
|
||||
'(- 1 *)'{-h,--help}'[show help message]' \
|
||||
'(- 1 *)'--list'[list installed commands]' \
|
||||
'(- 1 *)'{-v,--verbose}'[use verbose output]' \
|
||||
'(- 1 *)'--color'[colorization option]' \
|
||||
'(- 1 *)'{-V,--version}'[show version information]' \
|
||||
'1: :_cargo_cmds' \
|
||||
'*:: :->args'
|
||||
|
||||
case $state in
|
||||
args)
|
||||
case $words[1] in
|
||||
bench)
|
||||
_arguments \
|
||||
'--features=[space separated feature list]' \
|
||||
'--all-features[enable all available features]' \
|
||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
||||
'(-j, --jobs)'{-j,--jobs}'[number of parallel jobs, defaults to # of CPUs]' \
|
||||
"${command_scope_spec[@]}" \
|
||||
'--manifest-path=[path to manifest]: :_files -/' \
|
||||
'--no-default-features[do not build the default features]' \
|
||||
'--no-run[compile but do not run]' \
|
||||
'(-p,--package)'{-p=,--package=}'[package to run benchmarks for]:packages:_get_package_names' \
|
||||
'--target=[target triple]' \
|
||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
||||
'--color=:colorization option:(auto always never)' \
|
||||
;;
|
||||
|
||||
build)
|
||||
_arguments \
|
||||
'--features=[space separated feature list]' \
|
||||
'--all-features[enable all available features]' \
|
||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
||||
'(-j, --jobs)'{-j,--jobs}'[number of parallel jobs, defaults to # of CPUs]' \
|
||||
"${command_scope_spec[@]}" \
|
||||
'--manifest-path=[path to manifest]: :_files -/' \
|
||||
'--no-default-features[do not build the default features]' \
|
||||
'(-p,--package)'{-p=,--package=}'[package to build]:packages:_get_package_names' \
|
||||
'--release=[build in release mode]' \
|
||||
'--target=[target triple]' \
|
||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
||||
'--color=:colorization option:(auto always never)' \
|
||||
;;
|
||||
|
||||
clean)
|
||||
_arguments \
|
||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
||||
'--manifest-path=[path to manifest]: :_files -/' \
|
||||
'(-p,--package)'{-p=,--package=}'[package to clean]:packages:_get_package_names' \
|
||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
||||
'--release[whether or not to clean release artifacts]' \
|
||||
'--target=[target triple(default:all)]' \
|
||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
||||
'--color=:colorization option:(auto always never)' \
|
||||
;;
|
||||
|
||||
doc)
|
||||
_arguments \
|
||||
'--features=[space separated feature list]' \
|
||||
'--all-features[enable all available features]' \
|
||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
||||
'(-j, --jobs)'{-j,--jobs}'[number of parallel jobs, defaults to # of CPUs]' \
|
||||
'--manifest-path=[path to manifest]: :_files -/' \
|
||||
'--no-deps[do not build docs for dependencies]' \
|
||||
'--no-default-features[do not build the default features]' \
|
||||
'--open[open docs in browser after the build]' \
|
||||
'(-p, --package)'{-p,--package}'=[package to document]' \
|
||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
||||
'--release[build artifacts in release mode, with optimizations]' \
|
||||
'--target=[build for the target triple]' \
|
||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
||||
'--color=:colorization option:(auto always never)' \
|
||||
;;
|
||||
|
||||
fetch)
|
||||
_arguments \
|
||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
||||
'--manifest-path=[path to manifest]: :_files -/' \
|
||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
||||
'--color=:colorization option:(auto always never)' \
|
||||
;;
|
||||
|
||||
generate-lockfile)
|
||||
_arguments \
|
||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
||||
'--manifest-path=[path to manifest]: :_files -/' \
|
||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
||||
'--color=:colorization option:(auto always never)' \
|
||||
;;
|
||||
|
||||
git-checkout)
|
||||
_arguments \
|
||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
||||
'q(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
||||
'--reference=[REF]' \
|
||||
'--url=[URL]' \
|
||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
||||
'--color=:colorization option:(auto always never)' \
|
||||
;;
|
||||
|
||||
help)
|
||||
_arguments \
|
||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
||||
'*: :_cargo_cmds' \
|
||||
;;
|
||||
|
||||
init)
|
||||
_arguments \
|
||||
'--bin[use binary template]' \
|
||||
'--vcs:initialize a new repo with a given VCS:(git hg none)' \
|
||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
||||
'--name=[set the resulting package name]' \
|
||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
||||
'--color=:colorization option:(auto always never)' \
|
||||
;;
|
||||
|
||||
install)
|
||||
_arguments \
|
||||
'--bin=[only install the specified binary]' \
|
||||
'--branch=[branch to use when installing from git]' \
|
||||
'--color=:colorization option:(auto always never)' \
|
||||
'--debug[build in debug mode instead of release mode]' \
|
||||
'--example[install the specified example instead of binaries]' \
|
||||
'--features=[space separated feature list]' \
|
||||
'--all-features[enable all available features]' \
|
||||
'--git=[URL from which to install the crate]' \
|
||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
||||
'(-j, --jobs)'{-j,--jobs}'[number of parallel jobs, defaults to # of CPUs]' \
|
||||
'--no-default-features[do not build the default features]' \
|
||||
'--path=[local filesystem path to crate to install]' \
|
||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
||||
'--rev=[specific commit to use when installing from git]' \
|
||||
'--root=[directory to install packages into]' \
|
||||
'--tag=[tag to use when installing from git]' \
|
||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
||||
'--vers=[version to install from crates.io]' \
|
||||
;;
|
||||
|
||||
locate-project)
|
||||
_arguments \
|
||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
||||
'--manifest-path=[path to manifest]: :_files -/' \
|
||||
;;
|
||||
|
||||
login)
|
||||
_arguments \
|
||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
||||
'--host=[Host to set the token for]' \
|
||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
||||
'--color=:colorization option:(auto always never)' \
|
||||
;;
|
||||
|
||||
metadata)
|
||||
_arguments \
|
||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
||||
"--no-deps[output information only about the root package and don't fetch dependencies]" \
|
||||
'--no-default-features[do not include the default feature]' \
|
||||
'--manifest-path=[path to manifest]: :_files -/' \
|
||||
'--features=[space separated feature list]' \
|
||||
'--all-features[enable all available features]' \
|
||||
'--format-version=[format version(default: 1)]' \
|
||||
'--color=:colorization option:(auto always never)' \
|
||||
;;
|
||||
|
||||
new)
|
||||
_arguments \
|
||||
'--bin[use binary template]' \
|
||||
'--vcs:initialize a new repo with a given VCS:(git hg none)' \
|
||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
||||
'--name=[set the resulting package name]' \
|
||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
||||
'--color=:colorization option:(auto always never)' \
|
||||
;;
|
||||
|
||||
owner)
|
||||
_arguments \
|
||||
'(-a, --add)'{-a,--add}'[add owner LOGIN]' \
|
||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
||||
'--index[registry index]' \
|
||||
'(-l, --list)'{-l,--list}'[list owners of a crate]' \
|
||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
||||
'(-r, --remove)'{-r,--remove}'[remove owner LOGIN]' \
|
||||
'--token[API token to use when authenticating]' \
|
||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
||||
'--color=:colorization option:(auto always never)' \
|
||||
;;
|
||||
|
||||
package)
|
||||
_arguments \
|
||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
||||
'(-l, --list)'{-l,--list}'[print files included in a package without making one]' \
|
||||
'--manifest-path=[path to manifest]: :_files -/' \
|
||||
'--no-metadata[ignore warnings about a lack of human-usable metadata]' \
|
||||
'--no-verify[do not build to verify contents]' \
|
||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
||||
'--color=:colorization option:(auto always never)' \
|
||||
;;
|
||||
|
||||
pkgid)
|
||||
_arguments \
|
||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
||||
'--manifest-path=[path to manifest]: :_files -/' \
|
||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
||||
'--color=:colorization option:(auto always never)' \
|
||||
;;
|
||||
|
||||
publish)
|
||||
_arguments \
|
||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
||||
'--host=[Host to set the token for]' \
|
||||
'--manifest-path=[path to manifest]: :_files -/' \
|
||||
'--no-verify[Do not verify tarball until before publish]' \
|
||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
||||
'--token[token to use when uploading]' \
|
||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
||||
'--color=:colorization option:(auto always never)' \
|
||||
;;
|
||||
|
||||
read-manifest)
|
||||
_arguments \
|
||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
||||
'--manifest-path=[path to manifest]: :_files -/' \
|
||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
||||
'--color=:colorization option:(auto always never)' \
|
||||
;;
|
||||
|
||||
run)
|
||||
_arguments \
|
||||
'--example=[name of the bin target]' \
|
||||
'--features=[space separated feature list]' \
|
||||
'--all-features[enable all available features]' \
|
||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
||||
'(-j, --jobs)'{-j,--jobs}'[number of parallel jobs, defaults to # of CPUs]' \
|
||||
'--manifest-path=[path to manifest]: :_files -/' \
|
||||
'--bin=[name of the bin target]' \
|
||||
'--no-default-features[do not build the default features]' \
|
||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
||||
'--release=[build in release mode]' \
|
||||
'--target=[target triple]' \
|
||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
||||
'--color=:colorization option:(auto always never)' \
|
||||
'*: :_normal' \
|
||||
;;
|
||||
|
||||
rustc)
|
||||
_arguments \
|
||||
'--color=:colorization option:(auto always never)' \
|
||||
'--features=[features to compile for the package]' \
|
||||
'--all-features[enable all available features]' \
|
||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
||||
'(-j, --jobs)'{-j,--jobs}'=[number of parallel jobs, defaults to # of CPUs]' \
|
||||
'--manifest-path=[path to the manifest to fetch dependencies for]' \
|
||||
'--no-default-features[do not compile default features for the package]' \
|
||||
'(-p, --package)'{-p,--package}'=[profile to compile for]' \
|
||||
'--profile=[profile to build the selected target for]' \
|
||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
||||
'--release[build artifacts in release mode, with optimizations]' \
|
||||
'--target=[target triple which compiles will be for]' \
|
||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
||||
"${command_scope_spec[@]}" \
|
||||
;;
|
||||
|
||||
rustdoc)
|
||||
_arguments \
|
||||
'--color=:colorization option:(auto always never)' \
|
||||
'--features=[space-separated list of features to also build]' \
|
||||
'--all-features[enable all available features]' \
|
||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
||||
'(-j, --jobs)'{-j,--jobs}'=[number of parallel jobs, defaults to # of CPUs]' \
|
||||
'--manifest-path=[path to the manifest to document]' \
|
||||
'--no-default-features[do not build the `default` feature]' \
|
||||
'--open[open the docs in a browser after the operation]' \
|
||||
'(-p, --package)'{-p,--package}'=[package to document]' \
|
||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
||||
'--release[build artifacts in release mode, with optimizations]' \
|
||||
'--target=[build for the target triple]' \
|
||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
||||
"${command_scope_spec[@]}" \
|
||||
;;
|
||||
|
||||
search)
|
||||
_arguments \
|
||||
'--color=:colorization option:(auto always never)' \
|
||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
||||
'--host=[host of a registry to search in]' \
|
||||
'--limit=[limit the number of results]' \
|
||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
||||
;;
|
||||
|
||||
test)
|
||||
_arguments \
|
||||
'--features=[space separated feature list]' \
|
||||
'--all-features[enable all available features]' \
|
||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
||||
'(-j, --jobs)'{-j,--jobs}'[number of parallel jobs, defaults to # of CPUs]' \
|
||||
'--manifest-path=[path to manifest]: :_files -/' \
|
||||
'--test=[test name]: :_test_names' \
|
||||
'--no-default-features[do not build the default features]' \
|
||||
'--no-fail-fast[run all tests regardless of failure]' \
|
||||
'--no-run[compile but do not run]' \
|
||||
'(-p,--package)'{-p=,--package=}'[package to run tests for]:packages:_get_package_names' \
|
||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
||||
'--release[build artifacts in release mode, with optimizations]' \
|
||||
'--target=[target triple]' \
|
||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
||||
'--color=:colorization option:(auto always never)' \
|
||||
'1: :_test_names' \
|
||||
;;
|
||||
|
||||
uninstall)
|
||||
_arguments \
|
||||
'--bin=[only uninstall the binary NAME]' \
|
||||
'--color=:colorization option:(auto always never)' \
|
||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
||||
'(-q, --quiet)'{-q,--quiet}'[less output printed to stdout]' \
|
||||
'--root=[directory to uninstall packages from]' \
|
||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
||||
;;
|
||||
|
||||
update)
|
||||
_arguments \
|
||||
'--aggressive=[force dependency update]' \
|
||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
||||
'--manifest-path=[path to manifest]: :_files -/' \
|
||||
'(-p,--package)'{-p=,--package=}'[package to update]:packages:__get_package_names' \
|
||||
'--precise=[update single dependency to PRECISE]: :' \
|
||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
||||
'--color=:colorization option:(auto always never)' \
|
||||
;;
|
||||
|
||||
verify-project)
|
||||
_arguments \
|
||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
||||
'--manifest-path=[path to manifest]: :_files -/' \
|
||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
||||
'--color=:colorization option:(auto always never)' \
|
||||
;;
|
||||
|
||||
version)
|
||||
_arguments \
|
||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
||||
'--color=:colorization option:(auto always never)' \
|
||||
;;
|
||||
|
||||
yank)
|
||||
_arguments \
|
||||
'(-h, --help)'{-h,--help}'[show help message]' \
|
||||
'--index[registry index]' \
|
||||
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
|
||||
'--token[API token to use when authenticating]' \
|
||||
'--undo[undo a yank, putting a version back into the index]' \
|
||||
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
|
||||
'--color=:colorization option:(auto always never)' \
|
||||
'--vers[yank version]' \
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
_cargo_cmds(){
|
||||
local -a commands;commands=(
|
||||
'bench:execute all benchmarks of a local package'
|
||||
'build:compile the current project'
|
||||
'clean:remove generated artifacts'
|
||||
'doc:build package documentation'
|
||||
'fetch:fetch package dependencies'
|
||||
'generate-lockfile:create lockfile'
|
||||
'git-checkout:git checkout'
|
||||
'help:get help for commands'
|
||||
'init:create new project in current directory'
|
||||
'install:install a Rust binary'
|
||||
'locate-project:print "Cargo.toml" location'
|
||||
'login:login to remote server'
|
||||
'metadata:the metadata for a project in json'
|
||||
'new:create a new project'
|
||||
'owner:manage the owners of a crate on the registry'
|
||||
'package:assemble local package into a distributable tarball'
|
||||
'pkgid:print a fully qualified package specification'
|
||||
'publish:upload package to the registry'
|
||||
'read-manifest:print manifest in JSON format'
|
||||
'run:run the main binary of the local package'
|
||||
'rustc:compile a package and all of its dependencies'
|
||||
'rustdoc:build documentation for a package'
|
||||
'search:search packages on crates.io'
|
||||
'test:execute all unit and tests of a local package'
|
||||
'uninstall:remove a Rust binary'
|
||||
'update:update dependencies'
|
||||
'verify-project:check Cargo.toml'
|
||||
'version:show version information'
|
||||
'yank:remove pushed file from index'
|
||||
)
|
||||
_describe 'command' commands
|
||||
|
||||
}
|
||||
|
||||
|
||||
#FIXME: Disabled until fixed
|
||||
#gets package names from the manifest file
|
||||
_get_package_names()
|
||||
{
|
||||
}
|
||||
|
||||
#TODO:see if it makes sense to have 'locate-project' to have non-json output.
|
||||
#strips package name from json stuff
|
||||
_locate_manifest(){
|
||||
local manifest=`cargo locate-project 2>/dev/null`
|
||||
regexp-replace manifest '\{"root":"|"\}' ''
|
||||
echo $manifest
|
||||
}
|
||||
|
||||
# Extracts the values of "name" from the array given in $1 and shows them as
|
||||
# command line options for completion
|
||||
_get_names_from_array()
|
||||
{
|
||||
local -a filelist;
|
||||
local manifest=$(_locate_manifest)
|
||||
if [[ -z $manifest ]]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
local last_line
|
||||
local -a names;
|
||||
local in_block=false
|
||||
local block_name=$1
|
||||
names=()
|
||||
while read line
|
||||
do
|
||||
if [[ $last_line == "[[$block_name]]" ]]; then
|
||||
in_block=true
|
||||
else
|
||||
if [[ $last_line =~ '.*\[\[.*' ]]; then
|
||||
in_block=false
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ $in_block == true ]]; then
|
||||
if [[ $line =~ '.*name.*=' ]]; then
|
||||
regexp-replace line '^.*name *= *|"' ""
|
||||
names+=$line
|
||||
fi
|
||||
fi
|
||||
|
||||
last_line=$line
|
||||
done < $manifest
|
||||
_describe $block_name names
|
||||
|
||||
}
|
||||
|
||||
#Gets the test names from the manifest file
|
||||
_test_names()
|
||||
{
|
||||
_get_names_from_array "test"
|
||||
}
|
||||
|
||||
#Gets the bench names from the manifest file
|
||||
_benchmark_names()
|
||||
{
|
||||
_get_names_from_array "bench"
|
||||
}
|
||||
|
||||
# These flags are mutally exclusive specifiers for the scope of a command; as
|
||||
# they are used in multiple places without change, they are expanded into the
|
||||
# appropriate command's `_arguments` where appropriate.
|
||||
set command_scope_spec
|
||||
command_scope_spec=(
|
||||
'(--bin --example --test --lib)--bench=[benchmark name]: :_benchmark_names'
|
||||
'(--bench --bin --test --lib)--example=[example name]'
|
||||
'(--bench --example --test --lib)--bin=[binary name]'
|
||||
'(--bench --bin --example --test)--lib=[library name]'
|
||||
'(--bench --bin --example --lib)--test=[test name]'
|
||||
)
|
||||
|
||||
|
||||
_cargo
|
11
plugins/cask/README.md
Normal file
11
plugins/cask/README.md
Normal file
@ -0,0 +1,11 @@
|
||||
# cask plugin
|
||||
|
||||
Loads `cask` completion from non-standard locations, such as if installed
|
||||
via Homebrew or others. To enable it, add `cask` to your plugins array:
|
||||
|
||||
```zsh
|
||||
plugins=(... cask)
|
||||
```
|
||||
|
||||
Make sure you have the `cask` directory in your `$PATH` before loading
|
||||
Oh My Zsh, otherwise you'll get the "command not found" error.
|
@ -1,5 +1,26 @@
|
||||
if which cask &> /dev/null; then
|
||||
source $(dirname $(which cask))/../etc/cask_completion.zsh
|
||||
else
|
||||
print "zsh cask plugin: cask not found"
|
||||
fi
|
||||
() {
|
||||
emulate -L zsh
|
||||
|
||||
if ! (( $+commands[cask] )); then
|
||||
print "zsh cask plugin: cask command not found" >&2
|
||||
return
|
||||
fi
|
||||
|
||||
cask_base=${commands[cask]:h:h}
|
||||
|
||||
# Plain cask installation location (for Cask 0.7.2 and earlier)
|
||||
comp_files=($cask_base/etc/cask_completion.zsh)
|
||||
|
||||
# Mac Homebrew installs the completion in a different location
|
||||
if (( $+commands[brew] )); then
|
||||
comp_files+=($(brew --prefix)/share/zsh/site-functions/cask_completion.zsh)
|
||||
fi
|
||||
|
||||
# Load first found file
|
||||
for f in $comp_files; do
|
||||
if [[ -f "$f" ]]; then
|
||||
source "$f"
|
||||
break
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
## Coffeescript Plugin
|
||||
|
||||
This plugin provides aliases for quickly compiling and previewing your
|
||||
cofeescript code.
|
||||
coffeescript code.
|
||||
|
||||
When writing Coffeescript it's very common to want to preview the output of a
|
||||
certain snippet of code, either because you want to test the output or because
|
||||
|
@ -63,7 +63,7 @@ if is-at-least 4.2.0; then
|
||||
_image_fts=(jpg jpeg png gif mng tiff tif xpm)
|
||||
for ft in $_image_fts ; do alias -s $ft=$XIVIEWER; done
|
||||
|
||||
_media_fts=(ape avi flv mkv mov mp3 mpeg mpg ogg ogm rm wav webm)
|
||||
_media_fts=(ape avi flv m4a mkv mov mp3 mpeg mpg ogg ogm rm wav webm)
|
||||
for ft in $_media_fts ; do alias -s $ft=mplayer ; done
|
||||
|
||||
#read documents
|
||||
|
11
plugins/copybuffer/README.md
Normal file
11
plugins/copybuffer/README.md
Normal file
@ -0,0 +1,11 @@
|
||||
# `copybuffer` plugin
|
||||
|
||||
This plugin binds the ctrl-o keyboard shortcut to a command that copies the text
|
||||
that is currently typed in the command line ($BUFFER) to the system clipboard.
|
||||
|
||||
This is useful if you type a command - and before you hit enter to execute it - want
|
||||
to copy it maybe so you can paste it into a script, gist or whatnot.
|
||||
|
||||
```zsh
|
||||
plugins=(... copybuffer)
|
||||
```
|
14
plugins/copybuffer/copybuffer.plugin.zsh
Normal file
14
plugins/copybuffer/copybuffer.plugin.zsh
Normal file
@ -0,0 +1,14 @@
|
||||
# copy the active line from the command line buffer
|
||||
# onto the system clipboard (requires clipcopy plugin)
|
||||
|
||||
copybuffer () {
|
||||
if which clipcopy &>/dev/null; then
|
||||
echo $BUFFER | clipcopy
|
||||
else
|
||||
echo "clipcopy function not found. Please make sure you have Oh My Zsh installed correctly."
|
||||
fi
|
||||
}
|
||||
|
||||
zle -N copybuffer
|
||||
|
||||
bindkey "^O" copybuffer
|
32
plugins/cp/README.md
Normal file
32
plugins/cp/README.md
Normal file
@ -0,0 +1,32 @@
|
||||
# cp plugin
|
||||
|
||||
This plugin defines a `cpv` function that uses `rsync` so that you
|
||||
get the features and security of this command.
|
||||
|
||||
To enable, add `cp` to your `plugins` array in your zshrc file:
|
||||
|
||||
```zsh
|
||||
plugins=(... cp)
|
||||
```
|
||||
|
||||
## Description
|
||||
|
||||
The enabled options for rsync are:
|
||||
|
||||
- `-p`: preserves permissions.
|
||||
|
||||
- `-o`: preserves owner.
|
||||
|
||||
* `-g`: preserves group.
|
||||
|
||||
* `-b`: make a backup of the original file instead of overwriting it, if it exists.
|
||||
|
||||
* `-r`: recurse directories.
|
||||
|
||||
* `-hhh`: outputs numbers in human-readable format, in units of 1024 (K, M, G, T).
|
||||
|
||||
* `--backup-dir=/tmp/rsync`: move backup copies to "/tmp/rsync".
|
||||
|
||||
* `-e /dev/null`: only work on local files (disable remote shells).
|
||||
|
||||
* `--progress`: display progress.
|
@ -1,14 +1,4 @@
|
||||
#Show progress while file is copying
|
||||
|
||||
# Rsync options are:
|
||||
# -p - preserve permissions
|
||||
# -o - preserve owner
|
||||
# -g - preserve group
|
||||
# -h - output in human-readable format
|
||||
# --progress - display progress
|
||||
# -b - instead of just overwriting an existing file, save the original
|
||||
# --backup-dir=/tmp/rsync - move backup copies to "/tmp/rsync"
|
||||
# -e /dev/null - only work on local files
|
||||
# -- - everything after this is an argument, even if it looks like an option
|
||||
|
||||
alias cpv="rsync -poghb --backup-dir=/tmp/rsync -e /dev/null --progress --"
|
||||
cpv() {
|
||||
rsync -pogbr -hhh --backup-dir=/tmp/rsync -e /dev/null --progress "$@"
|
||||
}
|
||||
compdef _files cpv
|
||||
|
@ -8,11 +8,21 @@
|
||||
# pushd +N: start counting from left of `dirs' output
|
||||
# pushd -N: start counting from right of `dirs' output
|
||||
|
||||
switch-to-dir () {
|
||||
while ! builtin pushd -q $1 &>/dev/null; do
|
||||
# We found a missing directory: pop it out of the dir stack
|
||||
builtin popd -q $1
|
||||
|
||||
# Stop trying if there are no more directories in the dir stack
|
||||
[[ ${#dirstack} -eq 0 ]] && break
|
||||
done
|
||||
}
|
||||
|
||||
insert-cycledleft () {
|
||||
emulate -L zsh
|
||||
setopt nopushdminus
|
||||
|
||||
builtin pushd -q +1 &>/dev/null || true
|
||||
switch-to-dir +1
|
||||
zle reset-prompt
|
||||
}
|
||||
zle -N insert-cycledleft
|
||||
@ -21,7 +31,7 @@ insert-cycledright () {
|
||||
emulate -L zsh
|
||||
setopt nopushdminus
|
||||
|
||||
builtin pushd -q -0 &>/dev/null || true
|
||||
switch-to-dir -0
|
||||
zle reset-prompt
|
||||
}
|
||||
zle -N insert-cycledright
|
||||
|
@ -1,5 +1,4 @@
|
||||
# Docker-compose plugin for oh my zsh
|
||||
|
||||
A copy of the completion script from the [docker-compose](1) git repo.
|
||||
A copy of the completion script from the [docker-compose](https://github.com/docker/compose/blob/master/contrib/completion/zsh/_docker-compose) git repo.
|
||||
|
||||
[1]:[https://github.com/docker/compose/blob/master/contrib/completion/zsh/_docker-compose]
|
||||
|
@ -7,7 +7,7 @@
|
||||
# -------------------------------------------------------------------------
|
||||
# Version
|
||||
# -------
|
||||
# 0.1.0
|
||||
# 1.5.0
|
||||
# -------------------------------------------------------------------------
|
||||
# Authors
|
||||
# -------
|
||||
@ -19,58 +19,69 @@
|
||||
# * @felixr docker zsh completion script : https://github.com/felixr/docker-zsh-completion
|
||||
# -------------------------------------------------------------------------
|
||||
|
||||
# For compatibility reasons, Compose and therefore its completion supports several
|
||||
# stack compositon files as listed here, in descending priority.
|
||||
# Support for these filenames might be dropped in some future version.
|
||||
__docker-compose_compose_file() {
|
||||
local file
|
||||
for file in docker-compose.y{,a}ml fig.y{,a}ml ; do
|
||||
[ -e $file ] && {
|
||||
echo $file
|
||||
return
|
||||
}
|
||||
done
|
||||
echo docker-compose.yml
|
||||
__docker-compose_q() {
|
||||
docker-compose 2>/dev/null $compose_options "$@"
|
||||
}
|
||||
|
||||
# Extracts all service names from docker-compose.yml.
|
||||
___docker-compose_all_services_in_compose_file() {
|
||||
# All services defined in docker-compose.yml
|
||||
__docker-compose_all_services_in_compose_file() {
|
||||
local already_selected
|
||||
local -a services
|
||||
already_selected=$(echo ${words[@]} | tr " " "|")
|
||||
awk -F: '/^[a-zA-Z0-9]/{print $1}' "${compose_file:-$(__docker-compose_compose_file)}" 2>/dev/null | grep -Ev "$already_selected"
|
||||
already_selected=$(echo $words | tr " " "|")
|
||||
__docker-compose_q config --services \
|
||||
| grep -Ev "^(${already_selected})$"
|
||||
}
|
||||
|
||||
# All services, even those without an existing container
|
||||
__docker-compose_services_all() {
|
||||
services=$(___docker-compose_all_services_in_compose_file)
|
||||
_alternative "args:services:($services)"
|
||||
[[ $PREFIX = -* ]] && return 1
|
||||
integer ret=1
|
||||
services=$(__docker-compose_all_services_in_compose_file)
|
||||
_alternative "args:services:($services)" && ret=0
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
# All services that have an entry with the given key in their docker-compose.yml section
|
||||
___docker-compose_services_with_key() {
|
||||
__docker-compose_services_with_key() {
|
||||
local already_selected
|
||||
local -a buildable
|
||||
already_selected=$(echo ${words[@]} | tr " " "|")
|
||||
already_selected=$(echo $words | tr " " "|")
|
||||
# flatten sections to one line, then filter lines containing the key and return section name.
|
||||
awk '/^[a-zA-Z0-9]/{printf "\n"};{printf $0;next;}' "${compose_file:-$(__docker-compose_compose_file)}" 2>/dev/null | awk -F: -v key=": +$1:" '$0 ~ key {print $1}' 2>/dev/null | grep -Ev "$already_selected"
|
||||
__docker-compose_q config \
|
||||
| sed -n -e '/^services:/,/^[^ ]/p' \
|
||||
| sed -n 's/^ //p' \
|
||||
| awk '/^[a-zA-Z0-9]/{printf "\n"};{printf $0;next;}' \
|
||||
| grep " \+$1:" \
|
||||
| cut -d: -f1 \
|
||||
| grep -Ev "^(${already_selected})$"
|
||||
}
|
||||
|
||||
# All services that are defined by a Dockerfile reference
|
||||
__docker-compose_services_from_build() {
|
||||
buildable=$(___docker-compose_services_with_key build)
|
||||
_alternative "args:buildable services:($buildable)"
|
||||
[[ $PREFIX = -* ]] && return 1
|
||||
integer ret=1
|
||||
buildable=$(__docker-compose_services_with_key build)
|
||||
_alternative "args:buildable services:($buildable)" && ret=0
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
# All services that are defined by an image
|
||||
__docker-compose_services_from_image() {
|
||||
pullable=$(___docker-compose_services_with_key image)
|
||||
_alternative "args:pullable services:($pullable)"
|
||||
[[ $PREFIX = -* ]] && return 1
|
||||
integer ret=1
|
||||
pullable=$(__docker-compose_services_with_key image)
|
||||
_alternative "args:pullable services:($pullable)" && ret=0
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
__docker-compose_get_services() {
|
||||
local kind expl
|
||||
declare -a running stopped lines args services
|
||||
[[ $PREFIX = -* ]] && return 1
|
||||
integer ret=1
|
||||
local kind
|
||||
declare -a running paused stopped lines args services
|
||||
|
||||
docker_status=$(docker ps > /dev/null 2>&1)
|
||||
if [ $? -ne 0 ]; then
|
||||
@ -80,64 +91,78 @@ __docker-compose_get_services() {
|
||||
|
||||
kind=$1
|
||||
shift
|
||||
[[ $kind = (stopped|all) ]] && args=($args -a)
|
||||
[[ $kind =~ (stopped|all) ]] && args=($args -a)
|
||||
|
||||
lines=(${(f)"$(_call_program commands docker ps ${args})"})
|
||||
services=(${(f)"$(_call_program commands docker-compose 2>/dev/null ${compose_file:+-f $compose_file} ${compose_project:+-p $compose_project} ps -q)"})
|
||||
lines=(${(f)"$(_call_program commands docker $docker_options ps $args)"})
|
||||
services=(${(f)"$(_call_program commands docker-compose 2>/dev/null $compose_options ps -q)"})
|
||||
|
||||
# Parse header line to find columns
|
||||
local i=1 j=1 k header=${lines[1]}
|
||||
declare -A begin end
|
||||
while (( $j < ${#header} - 1 )) {
|
||||
i=$(( $j + ${${header[$j,-1]}[(i)[^ ]]} - 1))
|
||||
j=$(( $i + ${${header[$i,-1]}[(i) ]} - 1))
|
||||
k=$(( $j + ${${header[$j,-1]}[(i)[^ ]]} - 2))
|
||||
begin[${header[$i,$(($j-1))]}]=$i
|
||||
end[${header[$i,$(($j-1))]}]=$k
|
||||
}
|
||||
while (( j < ${#header} - 1 )); do
|
||||
i=$(( j + ${${header[$j,-1]}[(i)[^ ]]} - 1 ))
|
||||
j=$(( i + ${${header[$i,-1]}[(i) ]} - 1 ))
|
||||
k=$(( j + ${${header[$j,-1]}[(i)[^ ]]} - 2 ))
|
||||
begin[${header[$i,$((j-1))]}]=$i
|
||||
end[${header[$i,$((j-1))]}]=$k
|
||||
done
|
||||
lines=(${lines[2,-1]})
|
||||
|
||||
# Container ID
|
||||
local line s name
|
||||
local -a names
|
||||
for line in $lines; do
|
||||
if [[ $services == *"${line[${begin[CONTAINER ID]},${end[CONTAINER ID]}]%% ##}"* ]]; then
|
||||
if [[ ${services[@]} == *"${line[${begin[CONTAINER ID]},${end[CONTAINER ID]}]%% ##}"* ]]; then
|
||||
names=(${(ps:,:)${${line[${begin[NAMES]},-1]}%% *}})
|
||||
for name in $names; do
|
||||
s="${${name%_*}#*_}:${(l:15:: :::)${${line[${begin[CREATED]},${end[CREATED]}]/ ago/}%% ##}}"
|
||||
s="$s, ${line[${begin[CONTAINER ID]},${end[CONTAINER ID]}]%% ##}"
|
||||
s="$s, ${${${line[$begin[IMAGE],$end[IMAGE]]}/:/\\:}%% ##}"
|
||||
s="$s, ${${${line[${begin[IMAGE]},${end[IMAGE]}]}/:/\\:}%% ##}"
|
||||
if [[ ${line[${begin[STATUS]},${end[STATUS]}]} = Exit* ]]; then
|
||||
stopped=($stopped $s)
|
||||
else
|
||||
if [[ ${line[${begin[STATUS]},${end[STATUS]}]} = *\(Paused\)* ]]; then
|
||||
paused=($paused $s)
|
||||
fi
|
||||
running=($running $s)
|
||||
fi
|
||||
done
|
||||
fi
|
||||
done
|
||||
|
||||
[[ $kind = (running|all) ]] && _describe -t services-running "running services" running
|
||||
[[ $kind = (stopped|all) ]] && _describe -t services-stopped "stopped services" stopped
|
||||
[[ $kind =~ (running|all) ]] && _describe -t services-running "running services" running "$@" && ret=0
|
||||
[[ $kind =~ (paused|all) ]] && _describe -t services-paused "paused services" paused "$@" && ret=0
|
||||
[[ $kind =~ (stopped|all) ]] && _describe -t services-stopped "stopped services" stopped "$@" && ret=0
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
__docker-compose_pausedservices() {
|
||||
[[ $PREFIX = -* ]] && return 1
|
||||
__docker-compose_get_services paused "$@"
|
||||
}
|
||||
|
||||
__docker-compose_stoppedservices() {
|
||||
[[ $PREFIX = -* ]] && return 1
|
||||
__docker-compose_get_services stopped "$@"
|
||||
}
|
||||
|
||||
__docker-compose_runningservices() {
|
||||
[[ $PREFIX = -* ]] && return 1
|
||||
__docker-compose_get_services running "$@"
|
||||
}
|
||||
|
||||
__docker-compose_services () {
|
||||
__docker-compose_services() {
|
||||
[[ $PREFIX = -* ]] && return 1
|
||||
__docker-compose_get_services all "$@"
|
||||
}
|
||||
|
||||
__docker-compose_caching_policy() {
|
||||
oldp=( "$1"(Nmh+1) ) # 1 hour
|
||||
oldp=( "$1"(Nmh+1) ) # 1 hour
|
||||
(( $#oldp ))
|
||||
}
|
||||
|
||||
__docker-compose_commands () {
|
||||
__docker-compose_commands() {
|
||||
local cache_policy
|
||||
|
||||
zstyle -s ":completion:${curcontext}:" cache-policy cache_policy
|
||||
@ -151,110 +176,204 @@ __docker-compose_commands () {
|
||||
local -a lines
|
||||
lines=(${(f)"$(_call_program commands docker-compose 2>&1)"})
|
||||
_docker_compose_subcommands=(${${${lines[$((${lines[(i)Commands:]} + 1)),${lines[(I) *]}]}## #}/ ##/:})
|
||||
_store_cache docker_compose_subcommands _docker_compose_subcommands
|
||||
(( $#_docker_compose_subcommands > 0 )) && _store_cache docker_compose_subcommands _docker_compose_subcommands
|
||||
fi
|
||||
_describe -t docker-compose-commands "docker-compose command" _docker_compose_subcommands
|
||||
}
|
||||
|
||||
__docker-compose_subcommand () {
|
||||
local -a _command_args
|
||||
__docker-compose_subcommand() {
|
||||
local opts_help opts_force_recreate opts_no_recreate opts_no_build opts_remove_orphans opts_timeout opts_no_color opts_no_deps
|
||||
|
||||
opts_help='(: -)--help[Print usage]'
|
||||
opts_force_recreate="(--no-recreate)--force-recreate[Recreate containers even if their configuration and image haven't changed. Incompatible with --no-recreate.]"
|
||||
opts_no_recreate="(--force-recreate)--no-recreate[If containers already exist, don't recreate them. Incompatible with --force-recreate.]"
|
||||
opts_no_build="(--build)--no-build[Don't build an image, even if it's missing.]"
|
||||
opts_remove_orphans="--remove-orphans[Remove containers for services not defined in the Compose file]"
|
||||
opts_timeout=('(-t --timeout)'{-t,--timeout}"[Specify a shutdown timeout in seconds. (default: 10)]:seconds: ")
|
||||
opts_no_color='--no-color[Produce monochrome output.]'
|
||||
opts_no_deps="--no-deps[Don't start linked services.]"
|
||||
|
||||
integer ret=1
|
||||
|
||||
case "$words[1]" in
|
||||
(build)
|
||||
_arguments \
|
||||
'--no-cache[Do not use cache when building the image]' \
|
||||
$opts_help \
|
||||
'--force-rm[Always remove intermediate containers.]' \
|
||||
'--no-cache[Do not use cache when building the image.]' \
|
||||
'--pull[Always attempt to pull a newer version of the image.]' \
|
||||
'*:services:__docker-compose_services_from_build' && ret=0
|
||||
;;
|
||||
(bundle)
|
||||
_arguments \
|
||||
$opts_help \
|
||||
'(--output -o)'{--output,-o}'[Path to write the bundle file to. Defaults to "<project name>.dab".]:file:_files' && ret=0
|
||||
;;
|
||||
(config)
|
||||
_arguments \
|
||||
$opts_help \
|
||||
'(--quiet -q)'{--quiet,-q}"[Only validate the configuration, don't print anything.]" \
|
||||
'--services[Print the service names, one per line.]' && ret=0
|
||||
;;
|
||||
(create)
|
||||
_arguments \
|
||||
$opts_help \
|
||||
$opts_force_recreate \
|
||||
$opts_no_recreate \
|
||||
$opts_no_build \
|
||||
"(--no-build)--build[Build images before creating containers.]" \
|
||||
'*:services:__docker-compose_services_all' && ret=0
|
||||
;;
|
||||
(down)
|
||||
_arguments \
|
||||
$opts_help \
|
||||
"--rmi[Remove images. Type must be one of: 'all': Remove all images used by any service. 'local': Remove only images that don't have a custom tag set by the \`image\` field.]:type:(all local)" \
|
||||
'(-v --volumes)'{-v,--volumes}"[Remove named volumes declared in the \`volumes\` section of the Compose file and anonymous volumes attached to containers.]" \
|
||||
$opts_remove_orphans && ret=0
|
||||
;;
|
||||
(events)
|
||||
_arguments \
|
||||
$opts_help \
|
||||
'--json[Output events as a stream of json objects]' \
|
||||
'*:services:__docker-compose_services_all' && ret=0
|
||||
;;
|
||||
(exec)
|
||||
_arguments \
|
||||
$opts_help \
|
||||
'-d[Detached mode: Run command in the background.]' \
|
||||
'--privileged[Give extended privileges to the process.]' \
|
||||
'--user=[Run the command as this user.]:username:_users' \
|
||||
'-T[Disable pseudo-tty allocation. By default `docker-compose exec` allocates a TTY.]' \
|
||||
'--index=[Index of the container if there are multiple instances of a service \[default: 1\]]:index: ' \
|
||||
'(-):running services:__docker-compose_runningservices' \
|
||||
'(-):command: _command_names -e' \
|
||||
'*::arguments: _normal' && ret=0
|
||||
;;
|
||||
(help)
|
||||
_arguments ':subcommand:__docker-compose_commands' && ret=0
|
||||
;;
|
||||
(kill)
|
||||
_arguments \
|
||||
$opts_help \
|
||||
'-s[SIGNAL to send to the container. Default signal is SIGKILL.]:signal:_signals' \
|
||||
'*:running services:__docker-compose_runningservices' && ret=0
|
||||
;;
|
||||
(logs)
|
||||
_arguments \
|
||||
'--no-color[Produce monochrome output.]' \
|
||||
$opts_help \
|
||||
'(-f --follow)'{-f,--follow}'[Follow log output]' \
|
||||
$opts_no_color \
|
||||
'--tail=[Number of lines to show from the end of the logs for each container.]:number of lines: ' \
|
||||
'(-t --timestamps)'{-t,--timestamps}'[Show timestamps]' \
|
||||
'*:services:__docker-compose_services_all' && ret=0
|
||||
;;
|
||||
(migrate-to-labels)
|
||||
(pause)
|
||||
_arguments \
|
||||
'(-):Recreate containers to add labels' && ret=0
|
||||
$opts_help \
|
||||
'*:running services:__docker-compose_runningservices' && ret=0
|
||||
;;
|
||||
(port)
|
||||
_arguments \
|
||||
'--protocol=-[tcp or udap (defaults to tcp)]:protocol:(tcp udp)' \
|
||||
'--index=-[index of the container if there are mutiple instances of a service (defaults to 1)]:index: ' \
|
||||
$opts_help \
|
||||
'--protocol=[tcp or udp \[default: tcp\]]:protocol:(tcp udp)' \
|
||||
'--index=[index of the container if there are multiple instances of a service \[default: 1\]]:index: ' \
|
||||
'1:running services:__docker-compose_runningservices' \
|
||||
'2:port:_ports' && ret=0
|
||||
;;
|
||||
(ps)
|
||||
_arguments \
|
||||
$opts_help \
|
||||
'-q[Only display IDs]' \
|
||||
'*:services:__docker-compose_services_all' && ret=0
|
||||
;;
|
||||
(pull)
|
||||
_arguments \
|
||||
'--allow-insecure-ssl[Allow insecure connections to the docker registry]' \
|
||||
$opts_help \
|
||||
'--ignore-pull-failures[Pull what it can and ignores images with pull failures.]' \
|
||||
'*:services:__docker-compose_services_from_image' && ret=0
|
||||
;;
|
||||
(push)
|
||||
_arguments \
|
||||
$opts_help \
|
||||
'--ignore-push-failures[Push what it can and ignores images with push failures.]' \
|
||||
'*:services:__docker-compose_services' && ret=0
|
||||
;;
|
||||
(rm)
|
||||
_arguments \
|
||||
$opts_help \
|
||||
'(-f --force)'{-f,--force}"[Don't ask to confirm removal]" \
|
||||
'-v[Remove volumes associated with containers]' \
|
||||
'-v[Remove any anonymous volumes attached to containers]' \
|
||||
'*:stopped services:__docker-compose_stoppedservices' && ret=0
|
||||
;;
|
||||
(run)
|
||||
_arguments \
|
||||
'--allow-insecure-ssl[Allow insecure connections to the docker registry]' \
|
||||
$opts_help \
|
||||
'-d[Detached mode: Run container in the background, print new container name.]' \
|
||||
'--entrypoint[Overwrite the entrypoint of the image.]:entry point: ' \
|
||||
'*-e[KEY=VAL Set an environment variable (can be used multiple times)]:environment variable KEY=VAL: ' \
|
||||
'(-u --user)'{-u,--user=-}'[Run as specified username or uid]:username or uid:_users' \
|
||||
"--no-deps[Don't start linked services.]" \
|
||||
'--entrypoint[Overwrite the entrypoint of the image.]:entry point: ' \
|
||||
'--name=[Assign a name to the container]:name: ' \
|
||||
$opts_no_deps \
|
||||
'(-p --publish)'{-p,--publish=}"[Publish a container's port(s) to the host]" \
|
||||
'--rm[Remove container after run. Ignored in detached mode.]' \
|
||||
"--service-ports[Run command with the service's ports enabled and mapped to the host.]" \
|
||||
'-T[Disable pseudo-tty allocation. By default `docker-compose run` allocates a TTY.]' \
|
||||
'(-u --user)'{-u,--user=}'[Run as specified username or uid]:username or uid:_users' \
|
||||
'(-w --workdir)'{-w,--workdir=}'[Working directory inside the container]:workdir: ' \
|
||||
'(-):services:__docker-compose_services' \
|
||||
'(-):command: _command_names -e' \
|
||||
'*::arguments: _normal' && ret=0
|
||||
;;
|
||||
(scale)
|
||||
_arguments '*:running services:__docker-compose_runningservices' && ret=0
|
||||
_arguments \
|
||||
$opts_help \
|
||||
$opts_timeout \
|
||||
'*:running services:__docker-compose_runningservices' && ret=0
|
||||
;;
|
||||
(start)
|
||||
_arguments '*:stopped services:__docker-compose_stoppedservices' && ret=0
|
||||
_arguments \
|
||||
$opts_help \
|
||||
'*:stopped services:__docker-compose_stoppedservices' && ret=0
|
||||
;;
|
||||
(stop|restart)
|
||||
_arguments \
|
||||
'(-t --timeout)'{-t,--timeout}"[Specify a shutdown timeout in seconds. (default: 10)]:seconds: " \
|
||||
$opts_help \
|
||||
$opts_timeout \
|
||||
'*:running services:__docker-compose_runningservices' && ret=0
|
||||
;;
|
||||
(unpause)
|
||||
_arguments \
|
||||
$opts_help \
|
||||
'*:paused services:__docker-compose_pausedservices' && ret=0
|
||||
;;
|
||||
(up)
|
||||
_arguments \
|
||||
'--allow-insecure-ssl[Allow insecure connections to the docker registry]' \
|
||||
'-d[Detached mode: Run containers in the background, print new container names.]' \
|
||||
'--no-color[Produce monochrome output.]' \
|
||||
"--no-deps[Don't start linked services.]" \
|
||||
"--no-recreate[If containers already exist, don't recreate them.]" \
|
||||
"--no-build[Don't build an image, even if it's missing]" \
|
||||
'(-t --timeout)'{-t,--timeout}"[Specify a shutdown timeout in seconds. (default: 10)]:seconds: " \
|
||||
"--x-smart-recreate[Only recreate containers whose configuration or image needs to be updated. (EXPERIMENTAL)]" \
|
||||
$opts_help \
|
||||
'(--abort-on-container-exit)-d[Detached mode: Run containers in the background, print new container names. Incompatible with --abort-on-container-exit.]' \
|
||||
$opts_no_color \
|
||||
$opts_no_deps \
|
||||
$opts_force_recreate \
|
||||
$opts_no_recreate \
|
||||
$opts_no_build \
|
||||
"(--no-build)--build[Build images before starting containers.]" \
|
||||
"(-d)--abort-on-container-exit[Stops all containers if any container was stopped. Incompatible with -d.]" \
|
||||
'(-t --timeout)'{-t,--timeout}"[Use this timeout in seconds for container shutdown when attached or when containers are already running. (default: 10)]:seconds: " \
|
||||
$opts_remove_orphans \
|
||||
'*:services:__docker-compose_services_all' && ret=0
|
||||
;;
|
||||
(version)
|
||||
_arguments \
|
||||
$opts_help \
|
||||
"--short[Shows only Compose's version number.]" && ret=0
|
||||
;;
|
||||
(*)
|
||||
_message 'Unknown sub command'
|
||||
_message 'Unknown sub command' && ret=1
|
||||
;;
|
||||
esac
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
_docker-compose () {
|
||||
_docker-compose() {
|
||||
# Support for subservices, which allows for `compdef _docker docker-shell=_docker_containers`.
|
||||
# Based on /usr/share/zsh/functions/Completion/Unix/_git without support for `ret`.
|
||||
if [[ $service != docker-compose ]]; then
|
||||
@ -262,34 +381,62 @@ _docker-compose () {
|
||||
return
|
||||
fi
|
||||
|
||||
local curcontext="$curcontext" state line ret=1
|
||||
local curcontext="$curcontext" state line
|
||||
integer ret=1
|
||||
typeset -A opt_args
|
||||
|
||||
_arguments -C \
|
||||
'(- :)'{-h,--help}'[Get help]' \
|
||||
'--verbose[Show more output]' \
|
||||
'(- :)'{-v,--version}'[Print version and exit]' \
|
||||
'(-f --file)'{-f,--file}'[Specify an alternate docker-compose file (default: docker-compose.yml)]:file:_files -g "*.yml"' \
|
||||
'(-p --project-name)'{-p,--project-name}'[Specify an alternate project name (default: directory name)]:project name:' \
|
||||
'--verbose[Show more output]' \
|
||||
'(- :)'{-v,--version}'[Print version and exit]' \
|
||||
'(-H --host)'{-H,--host}'[Daemon socket to connect to]:host:' \
|
||||
'--tls[Use TLS; implied by --tlsverify]' \
|
||||
'--tlscacert=[Trust certs signed only by this CA]:ca path:' \
|
||||
'--tlscert=[Path to TLS certificate file]:client cert path:' \
|
||||
'--tlskey=[Path to TLS key file]:tls key path:' \
|
||||
'--tlsverify[Use TLS and verify the remote]' \
|
||||
"--skip-hostname-check[Don't check the daemon's hostname against the name specified in the client certificate (for example if your docker host is an IP address)]" \
|
||||
'(-): :->command' \
|
||||
'(-)*:: :->option-or-argument' && ret=0
|
||||
|
||||
local counter=1
|
||||
#local compose_file compose_project
|
||||
while [ $counter -lt ${#words[@]} ]; do
|
||||
case "${words[$counter]}" in
|
||||
-f|--file)
|
||||
(( counter++ ))
|
||||
compose_file="${words[$counter]}"
|
||||
;;
|
||||
-p|--project-name)
|
||||
(( counter++ ))
|
||||
compose_project="${words[$counter]}"
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
(( counter++ ))
|
||||
local -a relevant_compose_flags relevant_docker_flags compose_options docker_options
|
||||
|
||||
relevant_compose_flags=(
|
||||
"--file" "-f"
|
||||
"--host" "-H"
|
||||
"--project-name" "-p"
|
||||
"--tls"
|
||||
"--tlscacert"
|
||||
"--tlscert"
|
||||
"--tlskey"
|
||||
"--tlsverify"
|
||||
"--skip-hostname-check"
|
||||
)
|
||||
|
||||
relevant_docker_flags=(
|
||||
"--host" "-H"
|
||||
"--tls"
|
||||
"--tlscacert"
|
||||
"--tlscert"
|
||||
"--tlskey"
|
||||
"--tlsverify"
|
||||
)
|
||||
|
||||
for k in "${(@k)opt_args}"; do
|
||||
if [[ -n "${relevant_docker_flags[(r)$k]}" ]]; then
|
||||
docker_options+=$k
|
||||
if [[ -n "$opt_args[$k]" ]]; then
|
||||
docker_options+=$opt_args[$k]
|
||||
fi
|
||||
fi
|
||||
if [[ -n "${relevant_compose_flags[(r)$k]}" ]]; then
|
||||
compose_options+=$k
|
||||
if [[ -n "$opt_args[$k]" ]]; then
|
||||
compose_options+=$opt_args[$k]
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
case $state in
|
||||
|
22
plugins/docker-compose/docker-compose.plugin.zsh
Normal file
22
plugins/docker-compose/docker-compose.plugin.zsh
Normal file
@ -0,0 +1,22 @@
|
||||
# Authors:
|
||||
# https://github.com/tristola
|
||||
#
|
||||
# Docker-compose related zsh aliases
|
||||
|
||||
# Aliases ###################################################################
|
||||
|
||||
# Use dco as alias for docker-compose, since dc on *nix is 'dc - an arbitrary precision calculator'
|
||||
# https://www.gnu.org/software/bc/manual/dc-1.05/html_mono/dc.html
|
||||
|
||||
alias dco='docker-compose'
|
||||
|
||||
alias dcb='docker-compose build'
|
||||
alias dce='docker-compose exec'
|
||||
alias dcps='docker-compose ps'
|
||||
alias dcrestart='docker-compose restart'
|
||||
alias dcrm='docker-compose rm'
|
||||
alias dcr='docker-compose run'
|
||||
alias dcstop='docker-compose stop'
|
||||
alias dcup='docker-compose up'
|
||||
alias dcl='docker-compose logs'
|
||||
alias dclf='docker-compose logs -f'
|
@ -1,19 +1,5 @@
|
||||
## Docker autocomplete plugin
|
||||
|
||||
- Adds autocomplete options for all docker commands.
|
||||
- Will also show containerIDs and Image names where applicable
|
||||
|
||||
####Shows help for all commands
|
||||
![General Help](http://i.imgur.com/tUBO9jh.png "Help for all commands")
|
||||
|
||||
|
||||
####Shows your downloaded images where applicable
|
||||
![Images](http://i.imgur.com/R8ZsWO1.png "Images")
|
||||
|
||||
|
||||
####Shows your running containers where applicable
|
||||
![Containers](http://i.imgur.com/WQtbheg.png "Containers")
|
||||
|
||||
|
||||
|
||||
Maintainer : Ahmed Azaan ([@aeonazaan](https://twitter.com/aeonazaan))
|
||||
A copy of the completion script from the
|
||||
[docker](https://github.com/docker/docker/tree/master/contrib/completion/zsh)
|
||||
git repo.
|
||||
|
File diff suppressed because it is too large
Load Diff
19
plugins/droplr/README.md
Normal file
19
plugins/droplr/README.md
Normal file
@ -0,0 +1,19 @@
|
||||
# droplr
|
||||
|
||||
Use [Droplr](https://droplr.com/) from the comand line to upload files and shorten
|
||||
links. It needs to have [Droplr.app](https://droplr.com/apps) installed and logged
|
||||
in. MacOS only.
|
||||
|
||||
To use it, add `droplr` to the `$plugins` variable in your zshrc file:
|
||||
|
||||
```zsh
|
||||
plugins=(... droplr)
|
||||
```
|
||||
|
||||
Author: [Fabio Fernandes](https://github.com/fabiofl)
|
||||
|
||||
## Examples
|
||||
|
||||
- Upload a file: `droplr ./path/to/file/`
|
||||
|
||||
- Shorten a link: `droplr http://example.com`
|
15
plugins/droplr/droplr.plugin.zsh
Normal file
15
plugins/droplr/droplr.plugin.zsh
Normal file
@ -0,0 +1,15 @@
|
||||
# Only compatible with MacOS
|
||||
[[ "$OSTYPE" == darwin* ]] || return
|
||||
|
||||
droplr() {
|
||||
if [[ $# -eq 0 ]]; then
|
||||
echo You need to specify a parameter. >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [[ "$1" =~ ^https?:// ]]; then
|
||||
osascript -e 'tell app "Droplr" to shorten "'"$1"'"'
|
||||
else
|
||||
open -ga /Applications/Droplr.app "$1"
|
||||
fi
|
||||
}
|
@ -10,7 +10,7 @@
|
||||
# - Configuration changes made at runtime are applied to all frames.
|
||||
|
||||
|
||||
if "$ZSH/tools/require_tool.sh" emacs 23 2>/dev/null ; then
|
||||
if "$ZSH/tools/require_tool.sh" emacs 24 2>/dev/null ; then
|
||||
export EMACS_PLUGIN_LAUNCHER="$ZSH/plugins/emacs/emacsclient.sh"
|
||||
|
||||
# set EDITOR if not already defined.
|
||||
@ -18,15 +18,14 @@ if "$ZSH/tools/require_tool.sh" emacs 23 2>/dev/null ; then
|
||||
|
||||
alias emacs="$EMACS_PLUGIN_LAUNCHER --no-wait"
|
||||
alias e=emacs
|
||||
# open terminal emacsclient
|
||||
alias te="$EMACS_PLUGIN_LAUNCHER -nw"
|
||||
|
||||
# same than M-x eval but from outside Emacs.
|
||||
alias eeval="$EMACS_PLUGIN_LAUNCHER --eval"
|
||||
# create a new X frame
|
||||
alias eframe='emacsclient --alternate-editor "" --create-frame'
|
||||
|
||||
# to code all night long
|
||||
alias emasc=emacs
|
||||
alias emcas=emacs
|
||||
|
||||
# Write to standard output the path to the file
|
||||
# opened in the current buffer.
|
||||
|
@ -1,12 +1,28 @@
|
||||
#!/bin/sh
|
||||
|
||||
# get list of available X windows.
|
||||
x=`emacsclient --alternate-editor '' --eval '(x-display-list)' 2>/dev/null`
|
||||
_emacsfun()
|
||||
{
|
||||
# get list of emacs frames.
|
||||
frameslist=`emacsclient --alternate-editor '' --eval '(frame-list)' 2>/dev/null | egrep -o '(frame)+'`
|
||||
|
||||
if [ -z "$x" ] || [ "$x" = "nil" ] ;then
|
||||
# Create one if there is no X window yet.
|
||||
emacsclient --alternate-editor "" --create-frame "$@"
|
||||
if [ "$(echo "$frameslist" | sed -n '$=')" -ge 2 ] ;then
|
||||
# prevent creating another X frame if there is at least one present.
|
||||
emacsclient --alternate-editor "" "$@"
|
||||
else
|
||||
# Create one if there is no X window yet.
|
||||
emacsclient --alternate-editor "" --create-frame "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
# adopted from https://github.com/davidshepherd7/emacs-read-stdin/blob/master/emacs-read-stdin.sh
|
||||
# If the second argument is - then write stdin to a tempfile and open the
|
||||
# tempfile. (first argument will be `--no-wait` passed in by the plugin.zsh)
|
||||
if [ "$#" -ge "2" -a "$2" = "-" ]
|
||||
then
|
||||
tempfile="$(mktemp emacs-stdin-$USER.XXXXXXX --tmpdir)"
|
||||
cat - > "$tempfile"
|
||||
_emacsfun --no-wait $tempfile
|
||||
else
|
||||
# prevent creating another X frame if there is at least one present.
|
||||
emacsclient --alternate-editor "" "$@"
|
||||
_emacsfun "$@"
|
||||
fi
|
||||
|
46
plugins/extract/README.md
Normal file
46
plugins/extract/README.md
Normal file
@ -0,0 +1,46 @@
|
||||
# extract plugin
|
||||
|
||||
This plugin defines a function called `extract` that extracts the archive file
|
||||
you pass it, and it supports a wide variety of archive filetypes.
|
||||
|
||||
This way you don't have to know what specific command extracts a file, you just
|
||||
do `extract <filename>` and the function takes care of the rest.
|
||||
|
||||
To use it, add `extract` to the plugins array in your zshrc file:
|
||||
|
||||
```zsh
|
||||
plugins=(... extract)
|
||||
```
|
||||
|
||||
## Supported file extensions
|
||||
|
||||
| Extension | Description |
|
||||
|:------------------|:-------------------------------------|
|
||||
| `7z` | 7zip file |
|
||||
| `Z` | Z archive (LZW) |
|
||||
| `apk` | Android app file |
|
||||
| `bz2` | Bzip2 file |
|
||||
| `deb` | Debian package |
|
||||
| `gz` | Gzip file |
|
||||
| `ipsw` | iOS firmware file |
|
||||
| `jar` | Java Archive |
|
||||
| `lzma` | LZMA archive |
|
||||
| `rar` | WinRAR archive |
|
||||
| `sublime-package` | Sublime Text package |
|
||||
| `tar` | Tarball |
|
||||
| `tar.bz2` | Tarball with bzip2 compression |
|
||||
| `tar.gz` | Tarball with gzip compression |
|
||||
| `tar.xz` | Tarball with lzma2 compression |
|
||||
| `tar.zma` | Tarball with lzma compression |
|
||||
| `tbz` | Tarball with bzip compression |
|
||||
| `tbz2` | Tarball with bzip2 compression |
|
||||
| `tgz` | Tarball with gzip compression |
|
||||
| `tlz` | Tarball with lzma compression |
|
||||
| `txz` | Tarball with lzma2 compression |
|
||||
| `war` | Web Application archive (Java-based) |
|
||||
| `xpi` | Mozilla XPI module file |
|
||||
| `xz` | LZMA2 archive |
|
||||
| `zip` | Zip archive |
|
||||
|
||||
See [list of archive formats](https://en.wikipedia.org/wiki/List_of_archive_formats) for
|
||||
more information regarding archive formats.
|
@ -3,6 +3,5 @@
|
||||
|
||||
_arguments \
|
||||
'(-r --remove)'{-r,--remove}'[Remove archive.]' \
|
||||
"*::archive file:_files -g '(#i)*.(tar|tgz|tbz|tbz2|txz|tlz|gz|bz2|xz|lzma|Z|zip|ipsw|rar|7z|deb)(-.)'" && return 0
|
||||
|
||||
|
||||
"*::archive file:_files -g '(#i)*.(7z|Z|apk|bz2|deb|gz|ipsw|jar|lzma|rar|sublime-package|tar|tar.bz2|tar.gz|tar.xz|tar.zma|tbz|tbz2|tgz|tlz|txz|war|xpi|xz|zip)(-.)'" \
|
||||
&& return 0
|
||||
|
@ -1,80 +1,71 @@
|
||||
# ------------------------------------------------------------------------------
|
||||
# FILE: extract.plugin.zsh
|
||||
# DESCRIPTION: oh-my-zsh plugin file.
|
||||
# AUTHOR: Sorin Ionescu (sorin.ionescu@gmail.com)
|
||||
# VERSION: 1.0.1
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
|
||||
function extract() {
|
||||
local remove_archive
|
||||
local success
|
||||
local file_name
|
||||
local extract_dir
|
||||
|
||||
if (( $# == 0 )); then
|
||||
echo "Usage: extract [-option] [file ...]"
|
||||
echo
|
||||
echo Options:
|
||||
echo " -r, --remove Remove archive."
|
||||
echo
|
||||
echo "Report bugs to <sorin.ionescu@gmail.com>."
|
||||
fi
|
||||
|
||||
remove_archive=1
|
||||
if [[ "$1" == "-r" ]] || [[ "$1" == "--remove" ]]; then
|
||||
remove_archive=0
|
||||
shift
|
||||
fi
|
||||
|
||||
while (( $# > 0 )); do
|
||||
if [[ ! -f "$1" ]]; then
|
||||
echo "extract: '$1' is not a valid file" 1>&2
|
||||
shift
|
||||
continue
|
||||
fi
|
||||
|
||||
success=0
|
||||
file_name="$( basename "$1" )"
|
||||
extract_dir="$( echo "$file_name" | sed "s/\.${1##*.}//g" )"
|
||||
case "$1" in
|
||||
(*.tar.gz|*.tgz) [ -z $commands[pigz] ] && tar zxvf "$1" || pigz -dc "$1" | tar xv ;;
|
||||
(*.tar.bz2|*.tbz|*.tbz2) tar xvjf "$1" ;;
|
||||
(*.tar.xz|*.txz) tar --xz --help &> /dev/null \
|
||||
&& tar --xz -xvf "$1" \
|
||||
|| xzcat "$1" | tar xvf - ;;
|
||||
(*.tar.zma|*.tlz) tar --lzma --help &> /dev/null \
|
||||
&& tar --lzma -xvf "$1" \
|
||||
|| lzcat "$1" | tar xvf - ;;
|
||||
(*.tar) tar xvf "$1" ;;
|
||||
(*.gz) [ -z $commands[pigz] ] && gunzip "$1" || pigz -d "$1" ;;
|
||||
(*.bz2) bunzip2 "$1" ;;
|
||||
(*.xz) unxz "$1" ;;
|
||||
(*.lzma) unlzma "$1" ;;
|
||||
(*.Z) uncompress "$1" ;;
|
||||
(*.zip|*.war|*.jar|*.sublime-package|*.ipsw|*.xpi|*.apk) unzip "$1" -d $extract_dir ;;
|
||||
(*.rar) unrar x -ad "$1" ;;
|
||||
(*.7z) 7za x "$1" ;;
|
||||
(*.deb)
|
||||
mkdir -p "$extract_dir/control"
|
||||
mkdir -p "$extract_dir/data"
|
||||
cd "$extract_dir"; ar vx "../${1}" > /dev/null
|
||||
cd control; tar xzvf ../control.tar.gz
|
||||
cd ../data; tar xzvf ../data.tar.gz
|
||||
cd ..; rm *.tar.gz debian-binary
|
||||
cd ..
|
||||
;;
|
||||
(*)
|
||||
echo "extract: '$1' cannot be extracted" 1>&2
|
||||
success=1
|
||||
;;
|
||||
esac
|
||||
|
||||
(( success = $success > 0 ? $success : $? ))
|
||||
(( $success == 0 )) && (( $remove_archive == 0 )) && rm "$1"
|
||||
shift
|
||||
done
|
||||
}
|
||||
|
||||
alias x=extract
|
||||
|
||||
extract() {
|
||||
local remove_archive
|
||||
local success
|
||||
local extract_dir
|
||||
|
||||
if (( $# == 0 )); then
|
||||
cat <<-'EOF' >&2
|
||||
Usage: extract [-option] [file ...]
|
||||
|
||||
Options:
|
||||
-r, --remove Remove archive.
|
||||
EOF
|
||||
fi
|
||||
|
||||
remove_archive=1
|
||||
if [[ "$1" == "-r" ]] || [[ "$1" == "--remove" ]]; then
|
||||
remove_archive=0
|
||||
shift
|
||||
fi
|
||||
|
||||
while (( $# > 0 )); do
|
||||
if [[ ! -f "$1" ]]; then
|
||||
echo "extract: '$1' is not a valid file" >&2
|
||||
shift
|
||||
continue
|
||||
fi
|
||||
|
||||
success=0
|
||||
extract_dir="${1:t:r}"
|
||||
case "$1" in
|
||||
(*.tar.gz|*.tgz) (( $+commands[pigz] )) && { pigz -dc "$1" | tar xv } || tar zxvf "$1" ;;
|
||||
(*.tar.bz2|*.tbz|*.tbz2) tar xvjf "$1" ;;
|
||||
(*.tar.xz|*.txz)
|
||||
tar --xz --help &> /dev/null \
|
||||
&& tar --xz -xvf "$1" \
|
||||
|| xzcat "$1" | tar xvf - ;;
|
||||
(*.tar.zma|*.tlz)
|
||||
tar --lzma --help &> /dev/null \
|
||||
&& tar --lzma -xvf "$1" \
|
||||
|| lzcat "$1" | tar xvf - ;;
|
||||
(*.tar) tar xvf "$1" ;;
|
||||
(*.gz) (( $+commands[pigz] )) && pigz -d "$1" || gunzip "$1" ;;
|
||||
(*.bz2) bunzip2 "$1" ;;
|
||||
(*.xz) unxz "$1" ;;
|
||||
(*.lzma) unlzma "$1" ;;
|
||||
(*.Z) uncompress "$1" ;;
|
||||
(*.zip|*.war|*.jar|*.sublime-package|*.ipsw|*.xpi|*.apk) unzip "$1" -d $extract_dir ;;
|
||||
(*.rar) unrar x -ad "$1" ;;
|
||||
(*.7z) 7za x "$1" ;;
|
||||
(*.deb)
|
||||
mkdir -p "$extract_dir/control"
|
||||
mkdir -p "$extract_dir/data"
|
||||
cd "$extract_dir"; ar vx "../${1}" > /dev/null
|
||||
cd control; tar xzvf ../control.tar.gz
|
||||
cd ../data; extract ../data.tar.*
|
||||
cd ..; rm *.tar.* debian-binary
|
||||
cd ..
|
||||
;;
|
||||
(*)
|
||||
echo "extract: '$1' cannot be extracted" >&2
|
||||
success=1
|
||||
;;
|
||||
esac
|
||||
|
||||
(( success = $success > 0 ? $success : $? ))
|
||||
(( $success == 0 )) && (( $remove_archive == 0 )) && rm "$1"
|
||||
shift
|
||||
done
|
||||
}
|
||||
|
@ -6,6 +6,6 @@ if [ $commands[fasd] ]; then # check if fasd is installed
|
||||
source "$fasd_cache"
|
||||
unset fasd_cache
|
||||
|
||||
alias v='f -e vim'
|
||||
alias v="f -e $EDITOR"
|
||||
alias o='a -e open_command'
|
||||
fi
|
||||
|
17
plugins/firewalld/firewalld.plugin.zsh
Normal file
17
plugins/firewalld/firewalld.plugin.zsh
Normal file
@ -0,0 +1,17 @@
|
||||
alias fw="sudo firewall-cmd"
|
||||
alias fwp="sudo firewall-cmd --permanent"
|
||||
alias fwr="sudo firewall-cmd --reload"
|
||||
alias fwrp="sudo firewall-cmd --runtime-to-permanent"
|
||||
|
||||
function fwl () {
|
||||
# converts output to zsh array ()
|
||||
# @f flag split on new line
|
||||
zones=("${(@f)$(sudo firewall-cmd --get-active-zones | grep -v interfaces)}")
|
||||
|
||||
for i in $zones; do
|
||||
sudo firewall-cmd --zone $i --list-all
|
||||
done
|
||||
|
||||
echo 'Direct Rules:'
|
||||
sudo firewall-cmd --direct --get-all-rules
|
||||
}
|
22
plugins/firewalld/readme.md
Normal file
22
plugins/firewalld/readme.md
Normal file
@ -0,0 +1,22 @@
|
||||
# FirewallD Plugin
|
||||
|
||||
This plugin adds some aliases and functions for FirewallD using the `firewalld-cmd` command. To use it, add firewalld to your plugins array.
|
||||
|
||||
```zsh
|
||||
plugins=(... firewalld)
|
||||
```
|
||||
|
||||
## Aliases
|
||||
|
||||
| Alias | Command | Description |
|
||||
| :---- | :----------------------------------------- | :--------------------------- |
|
||||
| fw | `sudo firewall-cmd` | Shorthand |
|
||||
| fwr | `sudo firewall-cmd --reload` | Reload current configuration |
|
||||
| fwp | `sudo firewall-cmd --permanent` | Create permanent rule |
|
||||
| fwrp | `sudo firewall-cmd --runtime-to-permanent` | Save current configuration |
|
||||
|
||||
## Functions
|
||||
|
||||
| Function | Description |
|
||||
| :------- | :--------------------------------------------------------- |
|
||||
| fwl | Lists configuration from all active zones and direct rules |
|
7
plugins/fossil/README.md
Normal file
7
plugins/fossil/README.md
Normal file
@ -0,0 +1,7 @@
|
||||
## Fossil Plugin
|
||||
|
||||
This plugin adds completion support and prompt for fossil repositories.
|
||||
The prompt will display the current branch and status been dirty or clean.
|
||||
|
||||
### CONTRIBUTOR
|
||||
- Jefferson González ([jgmdev](https://github.com/jgmdev))
|
89
plugins/fossil/fossil.plugin.zsh
Normal file
89
plugins/fossil/fossil.plugin.zsh
Normal file
@ -0,0 +1,89 @@
|
||||
_FOSSIL_PROMPT=""
|
||||
|
||||
# Prefix at the very beginning of the prompt, before the branch name
|
||||
ZSH_THEME_FOSSIL_PROMPT_PREFIX="%{$fg_bold[blue]%}fossil:(%{$fg_bold[red]%}"
|
||||
|
||||
# At the very end of the prompt
|
||||
ZSH_THEME_FOSSIL_PROMPT_SUFFIX="%{$fg_bold[blue]%})"
|
||||
|
||||
# Text to display if the branch is dirty
|
||||
ZSH_THEME_FOSSIL_PROMPT_DIRTY=" %{$fg_bold[red]%}✖"
|
||||
|
||||
# Text to display if the branch is clean
|
||||
ZSH_THEME_FOSSIL_PROMPT_CLEAN=" %{$fg_bold[green]%}✔"
|
||||
|
||||
function fossil_prompt_info () {
|
||||
local _OUTPUT=`fossil branch 2>&1`
|
||||
local _STATUS=`echo $_OUTPUT | grep "use --repo"`
|
||||
if [ "$_STATUS" = "" ]; then
|
||||
local _EDITED=`fossil changes`
|
||||
local _EDITED_SYM="$ZSH_THEME_FOSSIL_PROMPT_CLEAN"
|
||||
local _BRANCH=`echo $_OUTPUT | grep "* " | sed 's/* //g'`
|
||||
|
||||
if [ "$_EDITED" != "" ]; then
|
||||
_EDITED_SYM="$ZSH_THEME_FOSSIL_PROMPT_DIRTY"
|
||||
fi
|
||||
|
||||
echo "$ZSH_THEME_FOSSIL_PROMPT_PREFIX" \
|
||||
"$_BRANCH" \
|
||||
"$ZSH_THEME_FOSSIL_PROMPT_SUFFIX" \
|
||||
"$_EDITED_SYM"\
|
||||
"%{$reset_color%}"
|
||||
fi
|
||||
}
|
||||
|
||||
function _fossil_get_command_list () {
|
||||
fossil help -a | grep -v "Usage|Common|This is"
|
||||
}
|
||||
|
||||
function _fossil () {
|
||||
local context state state_descr line
|
||||
typeset -A opt_args
|
||||
|
||||
_arguments \
|
||||
'1: :->command'\
|
||||
'2: :->subcommand'
|
||||
|
||||
case $state in
|
||||
command)
|
||||
local _OUTPUT=`fossil branch 2>&1 | grep "use --repo"`
|
||||
if [ "$_OUTPUT" = "" ]; then
|
||||
compadd `_fossil_get_command_list`
|
||||
else
|
||||
compadd clone init import help version
|
||||
fi
|
||||
;;
|
||||
subcommand)
|
||||
if [ "$words[2]" = "help" ]; then
|
||||
compadd `_fossil_get_command_list`
|
||||
else
|
||||
compcall -D
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
function _fossil_prompt () {
|
||||
local current=`echo $PROMPT $RPROMPT | grep fossil`
|
||||
|
||||
if [ "$_FOSSIL_PROMPT" = "" -o "$current" = "" ]; then
|
||||
local _prompt=${PROMPT}
|
||||
local _rprompt=${RPROMPT}
|
||||
|
||||
local is_prompt=`echo $PROMPT | grep git`
|
||||
|
||||
if [ "$is_prompt" = "" ]; then
|
||||
export RPROMPT="$_rprompt"'$(fossil_prompt_info)'
|
||||
else
|
||||
export PROMPT="$_prompt"'$(fossil_prompt_info) '
|
||||
fi
|
||||
|
||||
_FOSSIL_PROMPT="1"
|
||||
fi
|
||||
}
|
||||
|
||||
compdef _fossil fossil
|
||||
|
||||
autoload -U add-zsh-hook
|
||||
|
||||
add-zsh-hook precmd _fossil_prompt
|
21
plugins/gb/README.md
Normal file
21
plugins/gb/README.md
Normal file
@ -0,0 +1,21 @@
|
||||
# `gb` plugin
|
||||
|
||||
> A project based build tool for the Go programming language.
|
||||
|
||||
See https://getgb.io for the full `gb` documentation
|
||||
|
||||
* * * *
|
||||
|
||||
- Adds completion support for all `gb` commands.
|
||||
- Also supports completion for the [`gb-vendor` plugin](https://godoc.org/github.com/constabulary/gb/cmd/gb-vendor).
|
||||
|
||||
To use it, add `gb` to your plugins array:
|
||||
```sh
|
||||
plugins=(... gb)
|
||||
```
|
||||
|
||||
## Caveats
|
||||
|
||||
The `git` plugin defines an alias `gb` that usually conflicts with the `gb` program.
|
||||
If you're having trouble with it, remove it by adding `unalias gb` at the end of your
|
||||
zshrc file.
|
111
plugins/gb/_gb
Normal file
111
plugins/gb/_gb
Normal file
@ -0,0 +1,111 @@
|
||||
#compdef gb
|
||||
#autoload
|
||||
|
||||
_gb () {
|
||||
local ret=1 state
|
||||
_arguments -C ':command:->command' '*::options:->options' && ret=0
|
||||
|
||||
case $state in
|
||||
(command)
|
||||
local -a subcommands
|
||||
subcommands=(
|
||||
"build:build a package"
|
||||
"doc:show documentation for a package or symbol"
|
||||
"env:print project environment variables"
|
||||
"generate:generate Go files by processing source"
|
||||
"help:displays the help"
|
||||
"info:info returns information about this project"
|
||||
"list:list the packages named by the importpaths"
|
||||
"test:test packages"
|
||||
"vendor:manage your vendored dependencies"
|
||||
)
|
||||
_describe -t subcommands 'gb subcommands' subcommands && ret=0
|
||||
;;
|
||||
(options)
|
||||
case $line[1] in
|
||||
(build)
|
||||
_arguments \
|
||||
-f'[ignore cached packages]' \
|
||||
-F'[do not cache packages]' \
|
||||
-q'[decreases verbosity]' \
|
||||
-P'[the number of build jobs to run in parallel]' \
|
||||
-R'[sets the base of the project root search path]' \
|
||||
-dotfile'[output a dot formatted file of the build steps]' \
|
||||
-ldflags'["flag list" arguments to pass to the linker]' \
|
||||
-gcflags'["arg list" arguments to pass to the compiler]' \
|
||||
-race'[enable data race detection]' \
|
||||
-tags'["tag list" additional build tags]'
|
||||
;;
|
||||
(list)
|
||||
_arguments \
|
||||
-f'[alternate format for the list, using the syntax of package template]' \
|
||||
-s'[read format template from STDIN]' \
|
||||
-json'[prints output in structured JSON format]'
|
||||
;;
|
||||
(test)
|
||||
_arguments \
|
||||
-v'[print output from test subprocess]' \
|
||||
-ldflags'["flag list" arguments to pass to the linker]' \
|
||||
-gcflags'["arg list" arguments to pass to the compiler]' \
|
||||
-race'[enable data race detection]' \
|
||||
-tags'["tag list" additional build tags]'
|
||||
;;
|
||||
(vendor)
|
||||
_gb-vendor
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
_gb-vendor () {
|
||||
local curcontext="$curcontext" state line
|
||||
_arguments -C ':command:->command' '*::options:->options'
|
||||
|
||||
case $state in
|
||||
(command)
|
||||
local -a subcommands
|
||||
subcommands=(
|
||||
'delete:deletes a local dependency'
|
||||
'fetch:fetch a remote dependency'
|
||||
'list:lists dependencies, one per line'
|
||||
'purge:remove all unreferenced dependencies'
|
||||
'restore:restore dependencies from the manifest'
|
||||
'update:update a local dependency'
|
||||
)
|
||||
_describe -t subcommands 'gb vendor subcommands' subcommands && ret=0
|
||||
;;
|
||||
(options)
|
||||
case $line[1] in
|
||||
(delete)
|
||||
_arguments \
|
||||
-all'[remove all dependencies]'
|
||||
;;
|
||||
(fetch)
|
||||
_arguments \
|
||||
-branch'[fetch from a particular branch]' \
|
||||
-no-recurse'[do not fetch recursively]' \
|
||||
-tag'[fetch the specified tag]' \
|
||||
-revision'[fetch the specific revision from the branch (if supplied)]' \
|
||||
-precaire'[allow the use of insecure protocols]' \
|
||||
;;
|
||||
(list)
|
||||
_arguments \
|
||||
-f'[controls the template used for printing each manifest entry]'
|
||||
;;
|
||||
(restore)
|
||||
_arguments \
|
||||
-precaire'[allow the use of insecure protocols]'
|
||||
;;
|
||||
(update)
|
||||
_arguments \
|
||||
-all'[update all dependencies in the manifest or supply a given dependency]' \
|
||||
-precaire'[allow the use of insecure protocols]'
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
_gb
|
12
plugins/geeknote/README.md
Normal file
12
plugins/geeknote/README.md
Normal file
@ -0,0 +1,12 @@
|
||||
## ZSH-Geeknote
|
||||
|
||||
[Geeknote](https://github.com/VitaliyRodnenko/geeknote) plugin for [oh-my-zsh framework](http://github.com/robbyrussell/oh-my-zsh).
|
||||
|
||||
Plugins provides:
|
||||
|
||||
- auto completion of commands and their options
|
||||
- alias `gn`
|
||||
|
||||
You can find information how to install Geeknote and it's available commands on the [project website](http://www.geeknote.me/).
|
||||
|
||||
Maintainer : Ján Koščo ([@s7anley](https://twitter.com/s7anley))
|
136
plugins/geeknote/_geeknote
Normal file
136
plugins/geeknote/_geeknote
Normal file
@ -0,0 +1,136 @@
|
||||
#compdef geeknote
|
||||
# --------------- ------------------------------------------------------------
|
||||
# Name : _geeknote
|
||||
# Synopsis : zsh completion for geeknote
|
||||
# Author : Ján Koščo <3k.stanley@gmail.com>
|
||||
# HomePage : http://www.geeknote.me
|
||||
# Version : 0.1
|
||||
# Tag : [ shell, zsh, completion, evernote ]
|
||||
# Copyright : © 2014 by Ján Koščo,
|
||||
# Released under current GPL license.
|
||||
# --------------- ------------------------------------------------------------
|
||||
|
||||
local -a _1st_arguments
|
||||
_1st_arguments=(
|
||||
'login'
|
||||
'logout'
|
||||
'settings'
|
||||
'create'
|
||||
'edit'
|
||||
'find'
|
||||
'show'
|
||||
'remove'
|
||||
'notebook-list'
|
||||
'notebook-create'
|
||||
'notebook-edit'
|
||||
'tag-list'
|
||||
'tag-create'
|
||||
'tag-edit'
|
||||
'tag-remove'
|
||||
'gnsync'
|
||||
'user'
|
||||
)
|
||||
|
||||
_arguments '*:: :->command'
|
||||
|
||||
if (( CURRENT == 1 )); then
|
||||
_describe -t commands "geeknote command" _1st_arguments
|
||||
return
|
||||
fi
|
||||
|
||||
local -a _command_args
|
||||
case "$words[1]" in
|
||||
user)
|
||||
_command_args=(
|
||||
'(--full)--full' \
|
||||
)
|
||||
;;
|
||||
logout)
|
||||
_command_args=(
|
||||
'(--force)--force' \
|
||||
)
|
||||
;;
|
||||
settings)
|
||||
_command_args=(
|
||||
'(--editor)--editor' \
|
||||
)
|
||||
;;
|
||||
create)
|
||||
_command_args=(
|
||||
'(-t|--title)'{-t,--title}'[note title]' \
|
||||
'(-c|--content)'{-c,--content}'[note content]' \
|
||||
'(-tg|--tags)'{-tg,--tags}'[one tag or the list of tags which will be added to the note]' \
|
||||
'(-nb|--notebook)'{-nb,--notebook}'[name of notebook where to save note]' \
|
||||
)
|
||||
;;
|
||||
edit)
|
||||
_command_args=(
|
||||
'(-n|--note)'{-n,--note}'[name or ID from the previous search of a note to edit]' \
|
||||
'(-t|--title)'{-t,--title}'[note title]' \
|
||||
'(-c|--content)'{-c,--content}'[note content]' \
|
||||
'(-tg|--tags)'{-tg,--tags}'[one tag or the list of tags which will be added to the note]' \
|
||||
'(-nb|--notebook)'{-nb,--notebook}'[name of notebook where to save note]' \
|
||||
)
|
||||
;;
|
||||
remove)
|
||||
_command_args=(
|
||||
'(-n|--note)'{-n,--note}'[name or ID from the previous search of a note to edit]' \
|
||||
'(--force)--force' \
|
||||
)
|
||||
;;
|
||||
show)
|
||||
_command_args=(
|
||||
'(-n|--note)'{-n,--note}'[name or ID from the previous search of a note to edit]' \
|
||||
)
|
||||
;;
|
||||
find)
|
||||
_command_args=(
|
||||
'(-s|--search)'{-s,--search}'[text to search]' \
|
||||
'(-tg|--tags)'{-tg,--tags}'[notes with which tag/tags to search]' \
|
||||
'(-nb|--notebook)'{-nb,--notebook}'[in which notebook search the note]' \
|
||||
'(-d|--date)'{-d,--date}'[date in format dd.mm.yyyy or date range dd.mm.yyyy-dd.mm.yyyy]' \
|
||||
'(-cn|--count)'{-cn,--count}'[how many notes show in the result list]' \
|
||||
'(-uo|--url-only)'{-uo,--url-only}'[add direct url of each note in results to Evernote web-version]' \
|
||||
'(-ee|--exact-entry)'{-ee,--exact-entry}'[search for exact entry of the request]' \
|
||||
'(-cs|--content-search)'{-cs,--content-search}'[search by content, not by title]' \
|
||||
)
|
||||
;;
|
||||
notebook-create)
|
||||
_command_args=(
|
||||
'(-t|--title)'{-t,--title}'[notebook title]' \
|
||||
)
|
||||
;;
|
||||
notebook-edit)
|
||||
_command_args=(
|
||||
'(-nb|--notebook)'{-nb,--notebook}'[name of notebook to rename]' \
|
||||
'(-t|--title)'{-t,--title}'[new notebook title]' \
|
||||
)
|
||||
;;
|
||||
notebook-remove)
|
||||
_command_args=(
|
||||
'(-nb|--notebook)'{-nb,--notebook}'[name of notebook to remove]' \
|
||||
'(--force)--force' \
|
||||
)
|
||||
;;
|
||||
tag-create)
|
||||
_command_args=(
|
||||
'(-t|--title)'{-t,--title}'[title of tag]' \
|
||||
)
|
||||
;;
|
||||
tag-edit)
|
||||
_command_args=(
|
||||
'(-tgn|--tagname)'{-tgn,--tagname}'[tag to edit]' \
|
||||
'(-t|--title)'{-t,--title}'[new tag name]' \
|
||||
)
|
||||
;;
|
||||
tag-remove)
|
||||
_command_args=(
|
||||
'(-tgn|--tagname)'{-tgn,--tagname}'[tag to remove]' \
|
||||
'(--force)--force' \
|
||||
)
|
||||
;;
|
||||
esac
|
||||
|
||||
_arguments \
|
||||
$_command_args \
|
||||
&& return 0
|
2
plugins/geeknote/geeknote.plugin.zsh
Normal file
2
plugins/geeknote/geeknote.plugin.zsh
Normal file
@ -0,0 +1,2 @@
|
||||
#Alias
|
||||
alias gn='geeknote'
|
31
plugins/git-flow/README.md
Normal file
31
plugins/git-flow/README.md
Normal file
@ -0,0 +1,31 @@
|
||||
# Git-Flow plugin
|
||||
|
||||
This plugin adds completion and aliases for the `git-flow` command. More information
|
||||
at https://github.com/nvie/gitflow.
|
||||
|
||||
Enable git-flow plugin in your zshrc file:
|
||||
```
|
||||
plugins=(... git-flow)
|
||||
```
|
||||
|
||||
## Aliases
|
||||
|
||||
More information about `git-flow` commands:
|
||||
https://github.com/nvie/gitflow/wiki/Command-Line-Arguments
|
||||
|
||||
| Alias | Command | Description |
|
||||
|---------|---------------------------|----------------------------------------|
|
||||
| `gfl` | `git flow` | Git-Flow command |
|
||||
| `gfli` | `git flow init` | Initialize git-flow repository |
|
||||
| `gcd` | `git checkout develop` | Check out develop branch |
|
||||
| `gch` | `git checkout hotfix` | Check out hotfix branch |
|
||||
| `gcr` | `git checkout release` | Check out release branch |
|
||||
| `gflf` | `git flow feature` | List existing feature branches |
|
||||
| `gflh` | `git flow hotfix` | List existing hotfix branches |
|
||||
| `gflr` | `git flow release` | List existing release branches |
|
||||
| `gflfs` | `git flow feature start` | Start a new feature: `gflfs <name>` |
|
||||
| `gflhs` | `git flow hotfix start` | Start a new hotfix: `gflhs <version>` |
|
||||
| `gflrs` | `git flow release start` | Start a new release: `gflrs <version>` |
|
||||
| `gflff` | `git flow feature finish` | Finish feature: `gflff <name>` |
|
||||
| `gflhf` | `git flow hotfix finish` | Finish hotfix: `gflhf <version>` |
|
||||
| `gflrf` | `git flow release finish` | Finish release: `gflrf <version>` |
|
@ -22,9 +22,19 @@
|
||||
|
||||
#Alias
|
||||
alias gfl='git flow'
|
||||
alias gfli='git flow init'
|
||||
alias gcd='git checkout develop'
|
||||
alias gch='git checkout hotfix'
|
||||
alias gcr='git checkout release'
|
||||
alias gflf='git flow feature'
|
||||
alias gflh='git flow hotfix'
|
||||
alias gflr='git flow release'
|
||||
alias gflfs='git flow feature start'
|
||||
alias gflhs='git flow hotfix start'
|
||||
alias gflrs='git flow release start'
|
||||
alias gflff='git flow feature finish'
|
||||
alias gflhf='git flow hotfix finish'
|
||||
alias gflrf='git flow release finish'
|
||||
|
||||
_git-flow ()
|
||||
{
|
||||
|
@ -46,7 +46,8 @@ alias gapa='git add --patch'
|
||||
|
||||
alias gb='git branch'
|
||||
alias gba='git branch -a'
|
||||
alias gbda='git branch --merged | command grep -vE "^(\*|\s*master\s*$)" | command xargs -n 1 git branch -d'
|
||||
alias gbd='git branch -d'
|
||||
alias gbda='git branch --no-color --merged | command grep -vE "^(\*|\s*(master|develop|dev)\s*$)" | command xargs -n 1 git branch -d'
|
||||
alias gbl='git blame -b -w'
|
||||
alias gbnm='git branch --no-merged'
|
||||
alias gbr='git branch --remote'
|
||||
@ -59,103 +60,124 @@ alias gbss='git bisect start'
|
||||
alias gc='git commit -v'
|
||||
alias gc!='git commit -v --amend'
|
||||
alias gc-="git checkout -"
|
||||
alias gcn!='git commit -v --no-edit --amend'
|
||||
alias gca='git commit -v -a'
|
||||
alias gca!='git commit -v -a --amend'
|
||||
alias gcan!='git commit -v -a -s --no-edit --amend'
|
||||
alias gcan!='git commit -v -a --no-edit --amend'
|
||||
alias gcans!='git commit -v -a -s --no-edit --amend'
|
||||
alias gcam='git commit -a -m'
|
||||
alias gcsm='git commit -s -m'
|
||||
alias gcb='git checkout -b'
|
||||
alias gcf='git config --list'
|
||||
alias gcl='git clone --recursive'
|
||||
alias gclean='git clean -fd'
|
||||
alias gpristine='git reset --hard && git clean -dfx'
|
||||
alias gcm='git checkout master'
|
||||
alias gcd='git checkout develop'
|
||||
alias gcmsg='git commit -m'
|
||||
alias gco='git checkout'
|
||||
alias gcount='git shortlog -sn'
|
||||
compdef gcount=git
|
||||
compdef _git gcount
|
||||
alias gcp='git cherry-pick'
|
||||
alias gcpa='git cherry-pick --abort'
|
||||
alias gcpc='git cherry-pick --continue'
|
||||
alias gcs='git commit -S'
|
||||
|
||||
alias gd='git diff'
|
||||
alias gdca='git diff --cached'
|
||||
alias gdct='git describe --tags `git rev-list --tags --max-count=1`'
|
||||
alias gdt='git diff-tree --no-commit-id --name-only -r'
|
||||
alias gdw='git diff --word-diff'
|
||||
|
||||
gdv() { git diff -w "$@" | view - }
|
||||
compdef _git gdv=git-diff
|
||||
alias gdw='git diff --word-diff'
|
||||
|
||||
alias gf='git fetch'
|
||||
alias gfa='git fetch --all --prune'
|
||||
function gfg() { git ls-files | grep $@ }
|
||||
compdef gfg=grep
|
||||
alias gfo='git fetch origin'
|
||||
|
||||
function gfg() { git ls-files | grep $@ }
|
||||
compdef _grep gfg
|
||||
|
||||
alias gg='git gui citool'
|
||||
alias gga='git gui citool --amend'
|
||||
|
||||
ggf() {
|
||||
[[ "$#" != 1 ]] && local b="$(git_current_branch)"
|
||||
git push --force origin "${b:=$1}"
|
||||
[[ "$#" != 1 ]] && local b="$(git_current_branch)"
|
||||
git push --force origin "${b:=$1}"
|
||||
}
|
||||
compdef _git ggf=git-checkout
|
||||
|
||||
ggl() {
|
||||
if [[ "$#" != 0 ]] && [[ "$#" != 1 ]]; then
|
||||
git pull origin "${*}"
|
||||
else
|
||||
[[ "$#" == 0 ]] && local b="$(git_current_branch)"
|
||||
git pull origin "${b:=$1}"
|
||||
fi
|
||||
if [[ "$#" != 0 ]] && [[ "$#" != 1 ]]; then
|
||||
git pull origin "${*}"
|
||||
else
|
||||
[[ "$#" == 0 ]] && local b="$(git_current_branch)"
|
||||
git pull origin "${b:=$1}"
|
||||
fi
|
||||
}
|
||||
compdef _git ggl=git-checkout
|
||||
alias ggpull='git pull origin $(git_current_branch)'
|
||||
compdef _git ggpull=git-checkout
|
||||
|
||||
ggp() {
|
||||
if [[ "$#" != 0 ]] && [[ "$#" != 1 ]]; then
|
||||
git push origin "${*}"
|
||||
else
|
||||
[[ "$#" == 0 ]] && local b="$(git_current_branch)"
|
||||
git push origin "${b:=$1}"
|
||||
fi
|
||||
if [[ "$#" != 0 ]] && [[ "$#" != 1 ]]; then
|
||||
git push origin "${*}"
|
||||
else
|
||||
[[ "$#" == 0 ]] && local b="$(git_current_branch)"
|
||||
git push origin "${b:=$1}"
|
||||
fi
|
||||
}
|
||||
compdef _git ggp=git-checkout
|
||||
alias ggpush='git push origin $(git_current_branch)'
|
||||
compdef _git ggpush=git-checkout
|
||||
|
||||
ggpnp() {
|
||||
if [[ "$#" == 0 ]]; then
|
||||
ggl && ggp
|
||||
else
|
||||
ggl "${*}" && ggp "${*}"
|
||||
fi
|
||||
if [[ "$#" == 0 ]]; then
|
||||
ggl && ggp
|
||||
else
|
||||
ggl "${*}" && ggp "${*}"
|
||||
fi
|
||||
}
|
||||
compdef _git ggpnp=git-checkout
|
||||
alias ggsup='git branch --set-upstream-to=origin/$(git_current_branch)'
|
||||
|
||||
ggu() {
|
||||
[[ "$#" != 1 ]] && local b="$(git_current_branch)"
|
||||
git pull --rebase origin "${b:=$1}"
|
||||
[[ "$#" != 1 ]] && local b="$(git_current_branch)"
|
||||
git pull --rebase origin "${b:=$1}"
|
||||
}
|
||||
compdef _git ggu=git-checkout
|
||||
|
||||
alias ggpur='ggu'
|
||||
compdef _git ggpur=git-checkout
|
||||
|
||||
alias ggpull='git pull origin $(git_current_branch)'
|
||||
compdef _git ggpull=git-checkout
|
||||
|
||||
alias ggpush='git push origin $(git_current_branch)'
|
||||
compdef _git ggpush=git-checkout
|
||||
|
||||
alias ggsup='git branch --set-upstream-to=origin/$(git_current_branch)'
|
||||
alias gpsup='git push --set-upstream origin $(git_current_branch)'
|
||||
|
||||
alias ghh='git help'
|
||||
|
||||
alias gignore='git update-index --assume-unchanged'
|
||||
alias gignored='git ls-files -v | grep "^[[:lower:]]"'
|
||||
alias git-svn-dcommit-push='git svn dcommit && git push github master:svntrunk'
|
||||
compdef git-svn-dcommit-push=git
|
||||
compdef _git git-svn-dcommit-push=git
|
||||
|
||||
alias gk='\gitk --all --branches'
|
||||
compdef _git gk='gitk'
|
||||
alias gke='\gitk --all $(git log -g --pretty=format:%h)'
|
||||
alias gke='\gitk --all $(git log -g --pretty=%h)'
|
||||
compdef _git gke='gitk'
|
||||
|
||||
alias gl='git pull'
|
||||
alias glg='git log --stat --color'
|
||||
alias glgp='git log --stat --color -p'
|
||||
alias glgg='git log --graph --color'
|
||||
alias glg='git log --stat'
|
||||
alias glgp='git log --stat -p'
|
||||
alias glgg='git log --graph'
|
||||
alias glgga='git log --graph --decorate --all'
|
||||
alias glgm='git log --graph --max-count=10'
|
||||
alias glo='git log --oneline --decorate --color'
|
||||
alias glol="git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
|
||||
alias glola="git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --all"
|
||||
alias glog='git log --oneline --decorate --color --graph'
|
||||
alias glo='git log --oneline --decorate'
|
||||
alias glol="git log --graph --pretty='%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
|
||||
alias glola="git log --graph --pretty='%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --all"
|
||||
alias glog='git log --oneline --decorate --graph'
|
||||
alias gloga='git log --oneline --decorate --graph --all'
|
||||
alias glp="_git_log_prettily"
|
||||
compdef _git glp=git-log
|
||||
|
||||
@ -197,8 +219,9 @@ alias gsps='git show --pretty=short --show-signature'
|
||||
alias gsr='git svn rebase'
|
||||
alias gss='git status -s'
|
||||
alias gst='git status'
|
||||
alias gsta='git stash'
|
||||
alias gsta='git stash save'
|
||||
alias gstaa='git stash apply'
|
||||
alias gstc='git stash clear'
|
||||
alias gstd='git stash drop'
|
||||
alias gstl='git stash list'
|
||||
alias gstp='git stash pop'
|
||||
@ -215,4 +238,4 @@ alias gupv='git pull --rebase -v'
|
||||
alias glum='git pull upstream master'
|
||||
|
||||
alias gwch='git whatchanged -p --abbrev-commit --pretty=medium'
|
||||
alias gwip='git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit -m "--wip--"'
|
||||
alias gwip='git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit --no-verify -m "--wip--"'
|
||||
|
@ -104,6 +104,7 @@ __git_zsh_bash_func ()
|
||||
|
||||
local expansion=$(__git_aliased_command "$command")
|
||||
if [ -n "$expansion" ]; then
|
||||
words[1]=$expansion
|
||||
completion_func="_git_${expansion//-/_}"
|
||||
declare -f $completion_func >/dev/null && $completion_func
|
||||
fi
|
||||
@ -213,8 +214,10 @@ _git ()
|
||||
|
||||
if (( $+functions[__${service}_zsh_main] )); then
|
||||
__${service}_zsh_main
|
||||
else
|
||||
elif (( $+functions[__${service}_main] )); then
|
||||
emulate ksh -c __${service}_main
|
||||
elif (( $+functions[_${service}] )); then
|
||||
emulate ksh -c _${service}
|
||||
fi
|
||||
|
||||
let _ret && _default && _ret=0
|
||||
|
@ -10,17 +10,24 @@
|
||||
# *) local and remote tag names
|
||||
# *) .git/remotes file names
|
||||
# *) git 'subcommands'
|
||||
# *) git email aliases for git-send-email
|
||||
# *) tree paths within 'ref:path/to/file' expressions
|
||||
# *) file paths within current working directory and index
|
||||
# *) common --long-options
|
||||
#
|
||||
# To use these routines:
|
||||
#
|
||||
# 1) Copy this file to somewhere (e.g. ~/.git-completion.sh).
|
||||
# 1) Copy this file to somewhere (e.g. ~/.git-completion.bash).
|
||||
# 2) Add the following line to your .bashrc/.zshrc:
|
||||
# source ~/.git-completion.sh
|
||||
# source ~/.git-completion.bash
|
||||
# 3) Consider changing your PS1 to also show the current branch,
|
||||
# see git-prompt.sh for details.
|
||||
#
|
||||
# If you use complex aliases of form '!f() { ... }; f', you can use the null
|
||||
# command ':' as the first command in the function body to declare the desired
|
||||
# completion style. For example '!f() { : git commit ; ... }; f' will
|
||||
# tell the completion to use commit completion. This also works with aliases
|
||||
# of form "!sh -c '...'". For example, "!sh -c ': git commit ; ... '".
|
||||
|
||||
case "$COMP_WORDBREAKS" in
|
||||
*:*) : great ;;
|
||||
@ -180,7 +187,7 @@ fi
|
||||
|
||||
__gitcompappend ()
|
||||
{
|
||||
local i=${#COMPREPLY[@]}
|
||||
local x i=${#COMPREPLY[@]}
|
||||
for x in $1; do
|
||||
if [[ "$x" == "$3"* ]]; then
|
||||
COMPREPLY[i++]="$2$x$4"
|
||||
@ -275,16 +282,12 @@ __gitcomp_file ()
|
||||
# argument, and using the options specified in the second argument.
|
||||
__git_ls_files_helper ()
|
||||
{
|
||||
(
|
||||
test -n "${CDPATH+set}" && unset CDPATH
|
||||
cd "$1"
|
||||
if [ "$2" == "--committable" ]; then
|
||||
git diff-index --name-only --relative HEAD
|
||||
else
|
||||
# NOTE: $2 is not quoted in order to support multiple options
|
||||
git ls-files --exclude-standard $2
|
||||
fi
|
||||
) 2>/dev/null
|
||||
if [ "$2" == "--committable" ]; then
|
||||
git -C "$1" diff-index --name-only --relative HEAD
|
||||
else
|
||||
# NOTE: $2 is not quoted in order to support multiple options
|
||||
git -C "$1" ls-files --exclude-standard $2
|
||||
fi 2>/dev/null
|
||||
}
|
||||
|
||||
|
||||
@ -382,7 +385,8 @@ __git_refs ()
|
||||
;;
|
||||
*)
|
||||
echo "HEAD"
|
||||
git for-each-ref --format="%(refname:short)" -- "refs/remotes/$dir/" | sed -e "s#^$dir/##"
|
||||
git for-each-ref --format="%(refname:short)" -- \
|
||||
"refs/remotes/$dir/" 2>/dev/null | sed -e "s#^$dir/##"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
@ -408,12 +412,9 @@ __git_refs_remotes ()
|
||||
|
||||
__git_remotes ()
|
||||
{
|
||||
local i IFS=$'\n' d="$(__gitdir)"
|
||||
local d="$(__gitdir)"
|
||||
test -d "$d/remotes" && ls -1 "$d/remotes"
|
||||
for i in $(git --git-dir="$d" config --get-regexp 'remote\..*\.url' 2>/dev/null); do
|
||||
i="${i#remote.}"
|
||||
echo "${i/.url*/}"
|
||||
done
|
||||
git --git-dir="$d" remote
|
||||
}
|
||||
|
||||
__git_list_merge_strategies ()
|
||||
@ -516,7 +517,7 @@ __git_complete_index_file ()
|
||||
;;
|
||||
esac
|
||||
|
||||
__gitcomp_file "$(__git_index_files "$1" "$pfx")" "$pfx" "$cur_"
|
||||
__gitcomp_file "$(__git_index_files "$1" ${pfx:+"$pfx"})" "$pfx" "$cur_"
|
||||
}
|
||||
|
||||
__git_complete_file ()
|
||||
@ -663,10 +664,11 @@ __git_list_porcelain_commands ()
|
||||
check-mailmap) : plumbing;;
|
||||
check-ref-format) : plumbing;;
|
||||
checkout-index) : plumbing;;
|
||||
column) : internal helper;;
|
||||
commit-tree) : plumbing;;
|
||||
count-objects) : infrequent;;
|
||||
credential-cache) : credentials helper;;
|
||||
credential-store) : credentials helper;;
|
||||
credential) : credentials;;
|
||||
credential-*) : credentials helper;;
|
||||
cvsexportcommit) : export;;
|
||||
cvsimport) : import;;
|
||||
cvsserver) : daemon;;
|
||||
@ -735,35 +737,28 @@ __git_list_porcelain_commands ()
|
||||
__git_porcelain_commands=
|
||||
__git_compute_porcelain_commands ()
|
||||
{
|
||||
__git_compute_all_commands
|
||||
test -n "$__git_porcelain_commands" ||
|
||||
__git_porcelain_commands=$(__git_list_porcelain_commands)
|
||||
}
|
||||
|
||||
# Lists all set config variables starting with the given section prefix,
|
||||
# with the prefix removed.
|
||||
__git_get_config_variables ()
|
||||
{
|
||||
local section="$1" i IFS=$'\n'
|
||||
for i in $(git --git-dir="$(__gitdir)" config --name-only --get-regexp "^$section\..*" 2>/dev/null); do
|
||||
echo "${i#$section.}"
|
||||
done
|
||||
}
|
||||
|
||||
__git_pretty_aliases ()
|
||||
{
|
||||
local i IFS=$'\n'
|
||||
for i in $(git --git-dir="$(__gitdir)" config --get-regexp "pretty\..*" 2>/dev/null); do
|
||||
case "$i" in
|
||||
pretty.*)
|
||||
i="${i#pretty.}"
|
||||
echo "${i/ */}"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
__git_get_config_variables "pretty"
|
||||
}
|
||||
|
||||
__git_aliases ()
|
||||
{
|
||||
local i IFS=$'\n'
|
||||
for i in $(git --git-dir="$(__gitdir)" config --get-regexp "alias\..*" 2>/dev/null); do
|
||||
case "$i" in
|
||||
alias.*)
|
||||
i="${i#alias.}"
|
||||
echo "${i/ */}"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
__git_get_config_variables "alias"
|
||||
}
|
||||
|
||||
# __git_aliased_command requires 1 argument
|
||||
@ -781,6 +776,10 @@ __git_aliased_command ()
|
||||
-*) : option ;;
|
||||
*=*) : setting env ;;
|
||||
git) : git itself ;;
|
||||
\(\)) : skip parens of shell function definition ;;
|
||||
{) : skip start of shell helper function ;;
|
||||
:) : skip null command ;;
|
||||
\'*) : skip opening quote after sh -c ;;
|
||||
*)
|
||||
echo "$word"
|
||||
return
|
||||
@ -973,7 +972,7 @@ _git_branch ()
|
||||
|
||||
case "$cur" in
|
||||
--set-upstream-to=*)
|
||||
__gitcomp "$(__git_refs)" "" "${cur##--set-upstream-to=}"
|
||||
__gitcomp_nl "$(__git_refs)" "" "${cur##--set-upstream-to=}"
|
||||
;;
|
||||
--*)
|
||||
__gitcomp "
|
||||
@ -1041,7 +1040,7 @@ _git_checkout ()
|
||||
|
||||
_git_cherry ()
|
||||
{
|
||||
__gitcomp "$(__git_refs)"
|
||||
__gitcomp_nl "$(__git_refs)"
|
||||
}
|
||||
|
||||
_git_cherry_pick ()
|
||||
@ -1110,7 +1109,7 @@ _git_commit ()
|
||||
|
||||
case "$cur" in
|
||||
--cleanup=*)
|
||||
__gitcomp "default strip verbatim whitespace
|
||||
__gitcomp "default scissors strip verbatim whitespace
|
||||
" "" "${cur##--cleanup=}"
|
||||
return
|
||||
;;
|
||||
@ -1165,12 +1164,12 @@ __git_diff_common_options="--stat --numstat --shortstat --summary
|
||||
--full-index --binary --abbrev --diff-filter=
|
||||
--find-copies-harder
|
||||
--text --ignore-space-at-eol --ignore-space-change
|
||||
--ignore-all-space --exit-code --quiet --ext-diff
|
||||
--no-ext-diff
|
||||
--ignore-all-space --ignore-blank-lines --exit-code
|
||||
--quiet --ext-diff --no-ext-diff
|
||||
--no-prefix --src-prefix= --dst-prefix=
|
||||
--inter-hunk-context=
|
||||
--patience --histogram --minimal
|
||||
--raw --word-diff
|
||||
--raw --word-diff --word-diff-regex=
|
||||
--dirstat --dirstat= --dirstat-by-file
|
||||
--dirstat-by-file= --cumulative
|
||||
--diff-algorithm=
|
||||
@ -1197,7 +1196,7 @@ _git_diff ()
|
||||
}
|
||||
|
||||
__git_mergetools_common="diffuse diffmerge ecmerge emerge kdiff3 meld opendiff
|
||||
tkdiff vimdiff gvimdiff xxdiff araxis p4merge bc3 codecompare
|
||||
tkdiff vimdiff gvimdiff xxdiff araxis p4merge bc codecompare
|
||||
"
|
||||
|
||||
_git_difftool ()
|
||||
@ -1221,14 +1220,20 @@ _git_difftool ()
|
||||
__git_complete_revlist_file
|
||||
}
|
||||
|
||||
__git_fetch_recurse_submodules="yes on-demand no"
|
||||
|
||||
__git_fetch_options="
|
||||
--quiet --verbose --append --upload-pack --force --keep --depth=
|
||||
--tags --no-tags --all --prune --dry-run
|
||||
--tags --no-tags --all --prune --dry-run --recurse-submodules=
|
||||
"
|
||||
|
||||
_git_fetch ()
|
||||
{
|
||||
case "$cur" in
|
||||
--recurse-submodules=*)
|
||||
__gitcomp "$__git_fetch_recurse_submodules" "" "${cur##--recurse-submodules=}"
|
||||
return
|
||||
;;
|
||||
--*)
|
||||
__gitcomp "$__git_fetch_options"
|
||||
return
|
||||
@ -1292,7 +1297,7 @@ _git_gitk ()
|
||||
}
|
||||
|
||||
__git_match_ctag() {
|
||||
awk "/^${1////\\/}/ { print \$1 }" "$2"
|
||||
awk "/^${1//\//\\/}/ { print \$1 }" "$2"
|
||||
}
|
||||
|
||||
_git_grep ()
|
||||
@ -1307,6 +1312,7 @@ _git_grep ()
|
||||
--full-name --line-number
|
||||
--extended-regexp --basic-regexp --fixed-strings
|
||||
--perl-regexp
|
||||
--threads
|
||||
--files-with-matches --name-only
|
||||
--files-without-match
|
||||
--max-depth
|
||||
@ -1412,7 +1418,7 @@ __git_log_gitk_options="
|
||||
# Options that go well for log and shortlog (not gitk)
|
||||
__git_log_shortlog_options="
|
||||
--author= --committer= --grep=
|
||||
--all-match
|
||||
--all-match --invert-grep
|
||||
"
|
||||
|
||||
__git_log_pretty_formats="oneline short medium full fuller email raw format:"
|
||||
@ -1438,7 +1444,7 @@ _git_log ()
|
||||
return
|
||||
;;
|
||||
--decorate=*)
|
||||
__gitcomp "long short" "" "${cur##--decorate=}"
|
||||
__gitcomp "full short no" "" "${cur##--decorate=}"
|
||||
return
|
||||
;;
|
||||
--*)
|
||||
@ -1451,6 +1457,7 @@ _git_log ()
|
||||
--abbrev-commit --abbrev=
|
||||
--relative-date --date=
|
||||
--pretty= --format= --oneline
|
||||
--show-signature
|
||||
--cherry-pick
|
||||
--graph
|
||||
--decorate --decorate=
|
||||
@ -1466,9 +1473,12 @@ _git_log ()
|
||||
__git_complete_revlist
|
||||
}
|
||||
|
||||
# Common merge options shared by git-merge(1) and git-pull(1).
|
||||
__git_merge_options="
|
||||
--no-commit --no-stat --log --no-log --squash --strategy
|
||||
--commit --stat --no-squash --ff --no-ff --ff-only --edit --no-edit
|
||||
--verify-signatures --no-verify-signatures --gpg-sign
|
||||
--quiet --verbose --progress --no-progress
|
||||
"
|
||||
|
||||
_git_merge ()
|
||||
@ -1477,7 +1487,8 @@ _git_merge ()
|
||||
|
||||
case "$cur" in
|
||||
--*)
|
||||
__gitcomp "$__git_merge_options"
|
||||
__gitcomp "$__git_merge_options
|
||||
--rerere-autoupdate --no-rerere-autoupdate --abort"
|
||||
return
|
||||
esac
|
||||
__gitcomp_nl "$(__git_refs)"
|
||||
@ -1583,6 +1594,10 @@ _git_pull ()
|
||||
__git_complete_strategy && return
|
||||
|
||||
case "$cur" in
|
||||
--recurse-submodules=*)
|
||||
__gitcomp "$__git_fetch_recurse_submodules" "" "${cur##--recurse-submodules=}"
|
||||
return
|
||||
;;
|
||||
--*)
|
||||
__gitcomp "
|
||||
--rebase --no-rebase
|
||||
@ -1595,22 +1610,55 @@ _git_pull ()
|
||||
__git_complete_remote_or_refspec
|
||||
}
|
||||
|
||||
__git_push_recurse_submodules="check on-demand"
|
||||
|
||||
__git_complete_force_with_lease ()
|
||||
{
|
||||
local cur_=$1
|
||||
|
||||
case "$cur_" in
|
||||
--*=)
|
||||
;;
|
||||
*:*)
|
||||
__gitcomp_nl "$(__git_refs)" "" "${cur_#*:}"
|
||||
;;
|
||||
*)
|
||||
__gitcomp_nl "$(__git_refs)" "" "$cur_"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
_git_push ()
|
||||
{
|
||||
case "$prev" in
|
||||
--repo)
|
||||
__gitcomp_nl "$(__git_remotes)"
|
||||
return
|
||||
;;
|
||||
--recurse-submodules)
|
||||
__gitcomp "$__git_push_recurse_submodules"
|
||||
return
|
||||
;;
|
||||
esac
|
||||
case "$cur" in
|
||||
--repo=*)
|
||||
__gitcomp_nl "$(__git_remotes)" "" "${cur##--repo=}"
|
||||
return
|
||||
;;
|
||||
--recurse-submodules=*)
|
||||
__gitcomp "$__git_push_recurse_submodules" "" "${cur##--recurse-submodules=}"
|
||||
return
|
||||
;;
|
||||
--force-with-lease=*)
|
||||
__git_complete_force_with_lease "${cur##--force-with-lease=}"
|
||||
return
|
||||
;;
|
||||
--*)
|
||||
__gitcomp "
|
||||
--all --mirror --tags --dry-run --force --verbose
|
||||
--quiet --prune --delete --follow-tags
|
||||
--receive-pack= --repo= --set-upstream
|
||||
--force-with-lease --force-with-lease= --recurse-submodules=
|
||||
"
|
||||
return
|
||||
;;
|
||||
@ -1621,7 +1669,10 @@ _git_push ()
|
||||
_git_rebase ()
|
||||
{
|
||||
local dir="$(__gitdir)"
|
||||
if [ -d "$dir"/rebase-apply ] || [ -d "$dir"/rebase-merge ]; then
|
||||
if [ -f "$dir"/rebase-merge/interactive ]; then
|
||||
__gitcomp "--continue --skip --abort --edit-todo"
|
||||
return
|
||||
elif [ -d "$dir"/rebase-apply ] || [ -d "$dir"/rebase-merge ]; then
|
||||
__gitcomp "--continue --skip --abort"
|
||||
return
|
||||
fi
|
||||
@ -1637,7 +1688,12 @@ _git_rebase ()
|
||||
--preserve-merges --stat --no-stat
|
||||
--committer-date-is-author-date --ignore-date
|
||||
--ignore-whitespace --whitespace=
|
||||
--autosquash --fork-point --no-fork-point
|
||||
--autosquash --no-autosquash
|
||||
--fork-point --no-fork-point
|
||||
--autostash --no-autostash
|
||||
--verify --no-verify
|
||||
--keep-empty --root --force-rebase --no-ff
|
||||
--exec
|
||||
"
|
||||
|
||||
return
|
||||
@ -1662,6 +1718,15 @@ __git_send_email_suppresscc_options="author self cc bodycc sob cccmd body all"
|
||||
|
||||
_git_send_email ()
|
||||
{
|
||||
case "$prev" in
|
||||
--to|--cc|--bcc|--from)
|
||||
__gitcomp "
|
||||
$(git --git-dir="$(__gitdir)" send-email --dump-aliases 2>/dev/null)
|
||||
"
|
||||
return
|
||||
;;
|
||||
esac
|
||||
|
||||
case "$cur" in
|
||||
--confirm=*)
|
||||
__gitcomp "
|
||||
@ -1686,6 +1751,12 @@ _git_send_email ()
|
||||
" "" "${cur##--thread=}"
|
||||
return
|
||||
;;
|
||||
--to=*|--cc=*|--bcc=*|--from=*)
|
||||
__gitcomp "
|
||||
$(git --git-dir="$(__gitdir)" send-email --dump-aliases 2>/dev/null)
|
||||
" "" "${cur#--*=}"
|
||||
return
|
||||
;;
|
||||
--*)
|
||||
__gitcomp "--annotate --bcc --cc --cc-cmd --chain-reply-to
|
||||
--compose --confirm= --dry-run --envelope-sender
|
||||
@ -1727,15 +1798,7 @@ __git_config_get_set_variables ()
|
||||
c=$((--c))
|
||||
done
|
||||
|
||||
git --git-dir="$(__gitdir)" config $config_file --list 2>/dev/null |
|
||||
while read -r line
|
||||
do
|
||||
case "$line" in
|
||||
*.*=*)
|
||||
echo "${line/=*/}"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
git --git-dir="$(__gitdir)" config $config_file --name-only --list 2>/dev/null
|
||||
}
|
||||
|
||||
_git_config ()
|
||||
@ -1750,7 +1813,7 @@ _git_config ()
|
||||
return
|
||||
;;
|
||||
branch.*.rebase)
|
||||
__gitcomp "false true"
|
||||
__gitcomp "false true preserve interactive"
|
||||
return
|
||||
;;
|
||||
remote.pushdefault)
|
||||
@ -1820,6 +1883,10 @@ _git_config ()
|
||||
__gitcomp "$__git_send_email_suppresscc_options"
|
||||
return
|
||||
;;
|
||||
sendemail.transferencoding)
|
||||
__gitcomp "7bit 8bit quoted-printable base64"
|
||||
return
|
||||
;;
|
||||
--get|--get-all|--unset|--unset-all)
|
||||
__gitcomp_nl "$(__git_config_get_set_variables)"
|
||||
return
|
||||
@ -1836,6 +1903,7 @@ _git_config ()
|
||||
--get --get-all --get-regexp
|
||||
--add --unset --unset-all
|
||||
--remove-section --rename-section
|
||||
--name-only
|
||||
"
|
||||
return
|
||||
;;
|
||||
@ -1954,6 +2022,7 @@ _git_config ()
|
||||
color.status.changed
|
||||
color.status.header
|
||||
color.status.nobranch
|
||||
color.status.unmerged
|
||||
color.status.untracked
|
||||
color.status.updated
|
||||
color.ui
|
||||
@ -1991,6 +2060,7 @@ _git_config ()
|
||||
core.sparseCheckout
|
||||
core.symlinks
|
||||
core.trustctime
|
||||
core.untrackedCache
|
||||
core.warnAmbiguousRefs
|
||||
core.whitespace
|
||||
core.worktree
|
||||
@ -2065,6 +2135,8 @@ _git_config ()
|
||||
http.noEPSV
|
||||
http.postBuffer
|
||||
http.proxy
|
||||
http.sslCipherList
|
||||
http.sslVersion
|
||||
http.sslCAInfo
|
||||
http.sslCAPath
|
||||
http.sslCert
|
||||
@ -2128,6 +2200,7 @@ _git_config ()
|
||||
pull.octopus
|
||||
pull.twohead
|
||||
push.default
|
||||
push.followTags
|
||||
rebase.autosquash
|
||||
rebase.stat
|
||||
receive.autogc
|
||||
@ -2201,12 +2274,7 @@ _git_remote ()
|
||||
__git_complete_remote_or_refspec
|
||||
;;
|
||||
update)
|
||||
local i c='' IFS=$'\n'
|
||||
for i in $(git --git-dir="$(__gitdir)" config --get-regexp "remotes\..*" 2>/dev/null); do
|
||||
i="${i#remotes.}"
|
||||
c="$c ${i/ */}"
|
||||
done
|
||||
__gitcomp "$c"
|
||||
__gitcomp "$(__git_get_config_variables "remotes")"
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
@ -2233,6 +2301,11 @@ _git_reset ()
|
||||
|
||||
_git_revert ()
|
||||
{
|
||||
local dir="$(__gitdir)"
|
||||
if [ -f "$dir"/REVERT_HEAD ]; then
|
||||
__gitcomp "--continue --quit --abort"
|
||||
return
|
||||
fi
|
||||
case "$cur" in
|
||||
--*)
|
||||
__gitcomp "--edit --mainline --no-edit --no-commit --signoff"
|
||||
@ -2287,6 +2360,7 @@ _git_show ()
|
||||
;;
|
||||
--*)
|
||||
__gitcomp "--pretty= --format= --abbrev-commit --oneline
|
||||
--show-signature
|
||||
$__git_diff_common_options
|
||||
"
|
||||
return
|
||||
@ -2300,7 +2374,7 @@ _git_show_branch ()
|
||||
case "$cur" in
|
||||
--*)
|
||||
__gitcomp "
|
||||
--all --remotes --topo-order --current --more=
|
||||
--all --remotes --topo-order --date-order --current --more=
|
||||
--list --independent --merge-base --no-name
|
||||
--color --no-color
|
||||
--sha1-name --sparse --topics --reflog
|
||||
@ -2313,7 +2387,7 @@ _git_show_branch ()
|
||||
|
||||
_git_stash ()
|
||||
{
|
||||
local save_opts='--keep-index --no-keep-index --quiet --patch'
|
||||
local save_opts='--all --keep-index --no-keep-index --quiet --patch --include-untracked'
|
||||
local subcommands='save list show apply clear drop pop create branch'
|
||||
local subcommand="$(__git_find_on_cmdline "$subcommands")"
|
||||
if [ -z "$subcommand" ]; then
|
||||
@ -2335,9 +2409,20 @@ _git_stash ()
|
||||
apply,--*|pop,--*)
|
||||
__gitcomp "--index --quiet"
|
||||
;;
|
||||
show,--*|drop,--*|branch,--*)
|
||||
drop,--*)
|
||||
__gitcomp "--quiet"
|
||||
;;
|
||||
show,*|apply,*|drop,*|pop,*|branch,*)
|
||||
show,--*|branch,--*)
|
||||
;;
|
||||
branch,*)
|
||||
if [ $cword -eq 3 ]; then
|
||||
__gitcomp_nl "$(__git_refs)";
|
||||
else
|
||||
__gitcomp_nl "$(git --git-dir="$(__gitdir)" stash list \
|
||||
| sed -n -e 's/:.*//p')"
|
||||
fi
|
||||
;;
|
||||
show,*|apply,*|drop,*|pop,*)
|
||||
__gitcomp_nl "$(git --git-dir="$(__gitdir)" stash list \
|
||||
| sed -n -e 's/:.*//p')"
|
||||
;;
|
||||
@ -2492,6 +2577,16 @@ _git_tag ()
|
||||
__gitcomp_nl "$(__git_refs)"
|
||||
;;
|
||||
esac
|
||||
|
||||
case "$cur" in
|
||||
--*)
|
||||
__gitcomp "
|
||||
--list --delete --verify --annotate --message --file
|
||||
--sign --cleanup --local-user --force --column --sort
|
||||
--contains --points-at
|
||||
"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
_git_whatchanged ()
|
||||
@ -2547,6 +2642,7 @@ __git_main ()
|
||||
|
||||
local expansion=$(__git_aliased_command "$command")
|
||||
if [ -n "$expansion" ]; then
|
||||
words[1]=$expansion
|
||||
completion_func="_git_${expansion//-/_}"
|
||||
declare -f $completion_func >/dev/null && $completion_func
|
||||
fi
|
||||
@ -2675,6 +2771,6 @@ __git_complete gitk __gitk_main
|
||||
# when the user has tab-completed the executable name and consequently
|
||||
# included the '.exe' suffix.
|
||||
#
|
||||
if [ Cygwin = "$(uname -o 2>/dev/null)" ]; then
|
||||
if [[ "$OSTYPE" = cygwin* ]]; then
|
||||
__git_complete git.exe __git_main
|
||||
fi
|
||||
|
@ -66,6 +66,10 @@
|
||||
# git always compare HEAD to @{upstream}
|
||||
# svn always compare HEAD to your SVN upstream
|
||||
#
|
||||
# You can change the separator between the branch name and the above
|
||||
# state symbols by setting GIT_PS1_STATESEPARATOR. The default separator
|
||||
# is SP.
|
||||
#
|
||||
# By default, __git_ps1 will compare HEAD to your SVN upstream if it can
|
||||
# find one, or @{upstream} otherwise. Once you have set
|
||||
# GIT_PS1_SHOWUPSTREAM, you can override it on a per-repository basis by
|
||||
@ -84,6 +88,11 @@
|
||||
# GIT_PS1_SHOWCOLORHINTS to a nonempty value. The colors are based on
|
||||
# the colored output of "git status -sb" and are available only when
|
||||
# using __git_ps1 for PROMPT_COMMAND or precmd.
|
||||
#
|
||||
# If you would like __git_ps1 to do nothing in the case when the current
|
||||
# directory is set up to be ignored by git, then set
|
||||
# GIT_PS1_HIDE_IF_PWD_IGNORED to a nonempty value. Override this on the
|
||||
# repository level by setting bash.hideIfPwdIgnored to "false".
|
||||
|
||||
# check whether printf supports -v
|
||||
__git_printf_supports_v=
|
||||
@ -207,7 +216,16 @@ __git_ps1_show_upstream ()
|
||||
p=" u+${count#* }-${count% *}" ;;
|
||||
esac
|
||||
if [[ -n "$count" && -n "$name" ]]; then
|
||||
p="$p $(git rev-parse --abbrev-ref "$upstream" 2>/dev/null)"
|
||||
__git_ps1_upstream_name=$(git rev-parse \
|
||||
--abbrev-ref "$upstream" 2>/dev/null)
|
||||
if [ $pcmode = yes ] && [ $ps1_expanded = yes ]; then
|
||||
p="$p \${__git_ps1_upstream_name}"
|
||||
else
|
||||
p="$p ${__git_ps1_upstream_name}"
|
||||
# not needed anymore; keep user's
|
||||
# environment clean
|
||||
unset __git_ps1_upstream_name
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
@ -259,9 +277,9 @@ __git_ps1_colorize_gitstring ()
|
||||
r="$c_clear$r"
|
||||
}
|
||||
|
||||
eread ()
|
||||
__git_eread ()
|
||||
{
|
||||
f="$1"
|
||||
local f="$1"
|
||||
shift
|
||||
test -r "$f" && read "$@" <"$f"
|
||||
}
|
||||
@ -279,6 +297,8 @@ eread ()
|
||||
# In this mode you can request colored hints using GIT_PS1_SHOWCOLORHINTS=true
|
||||
__git_ps1 ()
|
||||
{
|
||||
# preserve exit status
|
||||
local exit=$?
|
||||
local pcmode=no
|
||||
local detached=no
|
||||
local ps1pc_start='\u@\h:\w '
|
||||
@ -290,13 +310,54 @@ __git_ps1 ()
|
||||
ps1pc_start="$1"
|
||||
ps1pc_end="$2"
|
||||
printf_format="${3:-$printf_format}"
|
||||
# set PS1 to a plain prompt so that we can
|
||||
# simply return early if the prompt should not
|
||||
# be decorated
|
||||
PS1="$ps1pc_start$ps1pc_end"
|
||||
;;
|
||||
0|1) printf_format="${1:-$printf_format}"
|
||||
;;
|
||||
*) return
|
||||
*) return $exit
|
||||
;;
|
||||
esac
|
||||
|
||||
# ps1_expanded: This variable is set to 'yes' if the shell
|
||||
# subjects the value of PS1 to parameter expansion:
|
||||
#
|
||||
# * bash does unless the promptvars option is disabled
|
||||
# * zsh does not unless the PROMPT_SUBST option is set
|
||||
# * POSIX shells always do
|
||||
#
|
||||
# If the shell would expand the contents of PS1 when drawing
|
||||
# the prompt, a raw ref name must not be included in PS1.
|
||||
# This protects the user from arbitrary code execution via
|
||||
# specially crafted ref names. For example, a ref named
|
||||
# 'refs/heads/$(IFS=_;cmd=sudo_rm_-rf_/;$cmd)' might cause the
|
||||
# shell to execute 'sudo rm -rf /' when the prompt is drawn.
|
||||
#
|
||||
# Instead, the ref name should be placed in a separate global
|
||||
# variable (in the __git_ps1_* namespace to avoid colliding
|
||||
# with the user's environment) and that variable should be
|
||||
# referenced from PS1. For example:
|
||||
#
|
||||
# __git_ps1_foo=$(do_something_to_get_ref_name)
|
||||
# PS1="...stuff...\${__git_ps1_foo}...stuff..."
|
||||
#
|
||||
# If the shell does not expand the contents of PS1, the raw
|
||||
# ref name must be included in PS1.
|
||||
#
|
||||
# The value of this variable is only relevant when in pcmode.
|
||||
#
|
||||
# Assume that the shell follows the POSIX specification and
|
||||
# expands PS1 unless determined otherwise. (This is more
|
||||
# likely to be correct if the user has a non-bash, non-zsh
|
||||
# shell and safer than the alternative if the assumption is
|
||||
# incorrect.)
|
||||
#
|
||||
local ps1_expanded=yes
|
||||
[ -z "$ZSH_VERSION" ] || [[ -o PROMPT_SUBST ]] || ps1_expanded=no
|
||||
[ -z "$BASH_VERSION" ] || shopt -q promptvars || ps1_expanded=no
|
||||
|
||||
local repo_info rev_parse_exit_code
|
||||
repo_info="$(git rev-parse --git-dir --is-inside-git-dir \
|
||||
--is-bare-repository --is-inside-work-tree \
|
||||
@ -304,11 +365,7 @@ __git_ps1 ()
|
||||
rev_parse_exit_code="$?"
|
||||
|
||||
if [ -z "$repo_info" ]; then
|
||||
if [ $pcmode = yes ]; then
|
||||
#In PC mode PS1 always needs to be set
|
||||
PS1="$ps1pc_start$ps1pc_end"
|
||||
fi
|
||||
return
|
||||
return $exit
|
||||
fi
|
||||
|
||||
local short_sha
|
||||
@ -323,14 +380,22 @@ __git_ps1 ()
|
||||
local inside_gitdir="${repo_info##*$'\n'}"
|
||||
local g="${repo_info%$'\n'*}"
|
||||
|
||||
if [ "true" = "$inside_worktree" ] &&
|
||||
[ -n "${GIT_PS1_HIDE_IF_PWD_IGNORED-}" ] &&
|
||||
[ "$(git config --bool bash.hideIfPwdIgnored)" != "false" ] &&
|
||||
git check-ignore -q .
|
||||
then
|
||||
return $exit
|
||||
fi
|
||||
|
||||
local r=""
|
||||
local b=""
|
||||
local step=""
|
||||
local total=""
|
||||
if [ -d "$g/rebase-merge" ]; then
|
||||
eread "$g/rebase-merge/head-name" b
|
||||
eread "$g/rebase-merge/msgnum" step
|
||||
eread "$g/rebase-merge/end" total
|
||||
__git_eread "$g/rebase-merge/head-name" b
|
||||
__git_eread "$g/rebase-merge/msgnum" step
|
||||
__git_eread "$g/rebase-merge/end" total
|
||||
if [ -f "$g/rebase-merge/interactive" ]; then
|
||||
r="|REBASE-i"
|
||||
else
|
||||
@ -338,10 +403,10 @@ __git_ps1 ()
|
||||
fi
|
||||
else
|
||||
if [ -d "$g/rebase-apply" ]; then
|
||||
eread "$g/rebase-apply/next" step
|
||||
eread "$g/rebase-apply/last" total
|
||||
__git_eread "$g/rebase-apply/next" step
|
||||
__git_eread "$g/rebase-apply/last" total
|
||||
if [ -f "$g/rebase-apply/rebasing" ]; then
|
||||
eread "$g/rebase-apply/head-name" b
|
||||
__git_eread "$g/rebase-apply/head-name" b
|
||||
r="|REBASE"
|
||||
elif [ -f "$g/rebase-apply/applying" ]; then
|
||||
r="|AM"
|
||||
@ -365,11 +430,8 @@ __git_ps1 ()
|
||||
b="$(git symbolic-ref HEAD 2>/dev/null)"
|
||||
else
|
||||
local head=""
|
||||
if ! eread "$g/HEAD" head; then
|
||||
if [ $pcmode = yes ]; then
|
||||
PS1="$ps1pc_start$ps1pc_end"
|
||||
fi
|
||||
return
|
||||
if ! __git_eread "$g/HEAD" head; then
|
||||
return $exit
|
||||
fi
|
||||
# is it a symbolic ref?
|
||||
b="${head#ref: }"
|
||||
@ -414,21 +476,21 @@ __git_ps1 ()
|
||||
if [ -n "${GIT_PS1_SHOWDIRTYSTATE-}" ] &&
|
||||
[ "$(git config --bool bash.showDirtyState)" != "false" ]
|
||||
then
|
||||
git diff --no-ext-diff --quiet --exit-code || w="*"
|
||||
if [ -n "$short_sha" ]; then
|
||||
git diff-index --cached --quiet HEAD -- || i="+"
|
||||
else
|
||||
git diff --no-ext-diff --quiet || w="*"
|
||||
git diff --no-ext-diff --cached --quiet || i="+"
|
||||
if [ -z "$short_sha" ] && [ -z "$i" ]; then
|
||||
i="#"
|
||||
fi
|
||||
fi
|
||||
if [ -n "${GIT_PS1_SHOWSTASHSTATE-}" ] &&
|
||||
[ -r "$g/refs/stash" ]; then
|
||||
git rev-parse --verify --quiet refs/stash >/dev/null
|
||||
then
|
||||
s="$"
|
||||
fi
|
||||
|
||||
if [ -n "${GIT_PS1_SHOWUNTRACKEDFILES-}" ] &&
|
||||
[ "$(git config --bool bash.showUntrackedFiles)" != "false" ] &&
|
||||
git ls-files --others --exclude-standard --error-unmatch -- '*' >/dev/null 2>/dev/null
|
||||
git ls-files --others --exclude-standard --directory --no-empty-directory --error-unmatch -- ':/*' >/dev/null 2>/dev/null
|
||||
then
|
||||
u="%${ZSH_VERSION+%}"
|
||||
fi
|
||||
@ -440,13 +502,21 @@ __git_ps1 ()
|
||||
|
||||
local z="${GIT_PS1_STATESEPARATOR-" "}"
|
||||
|
||||
# NO color option unless in PROMPT_COMMAND mode
|
||||
if [ $pcmode = yes ] && [ -n "${GIT_PS1_SHOWCOLORHINTS-}" ]; then
|
||||
__git_ps1_colorize_gitstring
|
||||
# NO color option unless in PROMPT_COMMAND mode or it's Zsh
|
||||
if [ -n "${GIT_PS1_SHOWCOLORHINTS-}" ]; then
|
||||
if [ $pcmode = yes ] || [ -n "${ZSH_VERSION-}" ]; then
|
||||
__git_ps1_colorize_gitstring
|
||||
fi
|
||||
fi
|
||||
|
||||
b=${b##refs/heads/}
|
||||
if [ $pcmode = yes ] && [ $ps1_expanded = yes ]; then
|
||||
__git_ps1_branch_name=$b
|
||||
b="\${__git_ps1_branch_name}"
|
||||
fi
|
||||
|
||||
local f="$w$i$s$u"
|
||||
local gitstring="$c${b##refs/heads/}${f:+$z$f}$r$p"
|
||||
local gitstring="$c$b${f:+$z$f}$r$p"
|
||||
|
||||
if [ $pcmode = yes ]; then
|
||||
if [ "${__git_printf_supports_v-}" != yes ]; then
|
||||
@ -458,4 +528,6 @@ __git_ps1 ()
|
||||
else
|
||||
printf -- "$printf_format" "$gitstring"
|
||||
fi
|
||||
|
||||
return $exit
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
# github
|
||||
|
||||
This plugin supports working with GitHub the command line. It provides a few things:
|
||||
This plugin supports working with GitHub from the command line. It provides a few things:
|
||||
|
||||
* Sets up the `hub` wrapper and completions for the `git` command if you have `hub` installed.
|
||||
* Completion for the `github` Ruby gem.
|
||||
@ -37,7 +37,7 @@ See `man hub` for more details.
|
||||
|
||||
### Homebrew installation note
|
||||
|
||||
If you have installed `hub` using Homebrew, its completions may not be on your `$FPATH` if you are using the system `zsh`. Homebrew installs `zsh` completion definitions to `/usr/local/share/zsh/site-functions`, which on `$FPATH` for the Homebrew-installed `zsh`, but not for the system `zsh`. If you want it to work with the system `zsh`, add this to your `~/.zshrc` before it sources `oh-my-zsh.sh`.
|
||||
If you have installed `hub` using Homebrew, its completions may not be on your `$FPATH` if you are using the system `zsh`. Homebrew installs `zsh` completion definitions to `/usr/local/share/zsh/site-functions`, which will be on `$FPATH` for the Homebrew-installed `zsh`, but not for the system `zsh`. If you want it to work with the system `zsh`, add this to your `~/.zshrc` before it sources `oh-my-zsh.sh`.
|
||||
|
||||
```zsh
|
||||
if (( ! ${fpath[(I)/usr/local/share/zsh/site-functions]} )); then
|
||||
|
@ -71,7 +71,7 @@ exist_gh() { # [DIRECTORY]
|
||||
#
|
||||
git.io() {
|
||||
emulate -L zsh
|
||||
curl -i -s http://git.io -F "url=$1" | grep "Location" | cut -f 2 -d " "
|
||||
curl -i -s https://git.io -F "url=$1" | grep "Location" | cut -f 2 -d " "
|
||||
}
|
||||
|
||||
# End Functions #############################################################
|
||||
|
62
plugins/globalias/README.md
Normal file
62
plugins/globalias/README.md
Normal file
@ -0,0 +1,62 @@
|
||||
# Globalias plugin
|
||||
|
||||
Expands all glob expressions, subcommands and aliases (including global).
|
||||
|
||||
Idea from: http://blog.patshead.com/2012/11/automatically-expaning-zsh-global-aliases---simplified.html.
|
||||
|
||||
## Usage
|
||||
|
||||
Add `globalias` to the plugins array in your zshrc file:
|
||||
|
||||
```zsh
|
||||
plugins=(... globalias)
|
||||
```
|
||||
|
||||
Then just press `SPACE` to trigger the expansion of a command you've written.
|
||||
|
||||
If you only want to insert a space without expanding the command line, press
|
||||
`CTRL`+`SPACE`.
|
||||
|
||||
## Examples
|
||||
|
||||
#### Glob expressions
|
||||
|
||||
```
|
||||
$ touch {1..10}<space>
|
||||
# expands to
|
||||
$ touch 1 2 3 4 5 6 7 8 9 10
|
||||
|
||||
$ ls **/*.json<space>
|
||||
# expands to
|
||||
$ ls folder/file.json anotherfolder/another.json
|
||||
```
|
||||
|
||||
#### Subcommands
|
||||
|
||||
```
|
||||
$ mkdir "`date -R`"
|
||||
# expands to
|
||||
$ mkdir Tue,\ 04\ Oct\ 2016\ 13:54:03\ +0300
|
||||
|
||||
```
|
||||
|
||||
#### Aliases
|
||||
|
||||
```
|
||||
# .zshrc:
|
||||
alias -g G="| grep --color=auto -P"
|
||||
alias l='ls --color=auto -lah'
|
||||
|
||||
$ l<space>G<space>
|
||||
# expands to
|
||||
$ ls --color=auto -lah | grep --color=auto -P
|
||||
```
|
||||
|
||||
```
|
||||
# .zsrc:
|
||||
alias S="sudo systemctl"
|
||||
|
||||
$ S<space>
|
||||
# expands to:
|
||||
$ sudo systemctl
|
||||
```
|
17
plugins/globalias/globalias.plugin.zsh
Normal file
17
plugins/globalias/globalias.plugin.zsh
Normal file
@ -0,0 +1,17 @@
|
||||
globalias() {
|
||||
zle _expand_alias
|
||||
zle expand-word
|
||||
zle self-insert
|
||||
}
|
||||
zle -N globalias
|
||||
|
||||
# space expands all aliases, including global
|
||||
bindkey -M emacs " " globalias
|
||||
bindkey -M viins " " globalias
|
||||
|
||||
# control-space to make a normal space
|
||||
bindkey -M emacs "^ " magic-space
|
||||
bindkey -M viins "^ " magic-space
|
||||
|
||||
# normal space during searches
|
||||
bindkey -M isearch " " magic-space
|
@ -179,5 +179,15 @@ __go_tool_complete() {
|
||||
|
||||
compdef __go_tool_complete go
|
||||
|
||||
# aliases
|
||||
alias gfa='go fmt . ./...'
|
||||
# aliases: go<~>
|
||||
alias gob='go build'
|
||||
alias goc='go clean'
|
||||
alias god='go doc'
|
||||
alias gof='go fmt'
|
||||
alias gofa='go fmt . ./...'
|
||||
alias gog='go get'
|
||||
alias goi='go install'
|
||||
alias gol='go list'
|
||||
alias gor='go run'
|
||||
alias got='go test'
|
||||
alias gov='go vet'
|
||||
|
1
plugins/gradle/_gradle
Symbolic link
1
plugins/gradle/_gradle
Symbolic link
@ -0,0 +1 @@
|
||||
gradle.plugin.zsh
|
1
plugins/gradle/_gradlew
Symbolic link
1
plugins/gradle/_gradlew
Symbolic link
@ -0,0 +1 @@
|
||||
gradle.plugin.zsh
|
@ -60,6 +60,35 @@ _gradle_does_task_list_need_generating () {
|
||||
[[ ! -f .gradletasknamecache ]] || [[ build.gradle -nt .gradletasknamecache ]]
|
||||
}
|
||||
|
||||
##############
|
||||
# Parse the tasks from `gradle(w) tasks --all` into .gradletasknamecache
|
||||
# All lines in the output from gradle(w) that are between /^-+$/ and /^\s*$/
|
||||
# are considered to be tasks. If and when gradle adds support for listing tasks
|
||||
# for programmatic parsing, this method can be deprecated.
|
||||
##############
|
||||
_gradle_parse_tasks () {
|
||||
lines_might_be_tasks=false
|
||||
task_name_buffer=""
|
||||
while read -r line; do
|
||||
if [[ $line =~ ^-+$ ]]; then
|
||||
lines_might_be_tasks=true
|
||||
# Empty buffer, because it contains items that are not tasks
|
||||
task_name_buffer=""
|
||||
elif [[ $line =~ ^\s*$ ]]; then
|
||||
if [[ "$lines_might_be_tasks" = true ]]; then
|
||||
# If a newline is found, send the buffer to .gradletasknamecache
|
||||
while read -r task; do
|
||||
echo $task | awk '/[a-zA-Z0-9:-]+/ {print $1}'
|
||||
done <<< "$task_name_buffer"
|
||||
# Empty buffer, because we are done with the tasks
|
||||
task_name_buffer=""
|
||||
fi
|
||||
lines_might_be_tasks=false
|
||||
elif [[ "$lines_might_be_tasks" = true ]]; then
|
||||
task_name_buffer="${task_name_buffer}\n${line}"
|
||||
fi
|
||||
done <<< "$1"
|
||||
}
|
||||
|
||||
##############################################################################
|
||||
# Discover the gradle tasks by running "gradle tasks --all"
|
||||
@ -68,7 +97,7 @@ _gradle_tasks () {
|
||||
if [[ -f build.gradle ]]; then
|
||||
_gradle_arguments
|
||||
if _gradle_does_task_list_need_generating; then
|
||||
gradle tasks --all | awk '/[a-zA-Z0-9:-]* - / {print $1}' > .gradletasknamecache
|
||||
_gradle_parse_tasks "$(gradle tasks --all)" > .gradletasknamecache
|
||||
fi
|
||||
compadd -X "==== Gradle Tasks ====" $(cat .gradletasknamecache)
|
||||
fi
|
||||
@ -78,7 +107,7 @@ _gradlew_tasks () {
|
||||
if [[ -f build.gradle ]]; then
|
||||
_gradle_arguments
|
||||
if _gradle_does_task_list_need_generating; then
|
||||
./gradlew tasks --all | awk '/[a-zA-Z0-9:-]* - / {print $1}' > .gradletasknamecache
|
||||
_gradle_parse_tasks "$(./gradlew tasks --all)" > .gradletasknamecache
|
||||
fi
|
||||
compadd -X "==== Gradlew Tasks ====" $(cat .gradletasknamecache)
|
||||
fi
|
||||
|
@ -38,7 +38,11 @@ function jira() {
|
||||
_jira_query $@
|
||||
elif [[ "$action" == "dashboard" ]]; then
|
||||
echo "Opening dashboard"
|
||||
open_command "${jira_url}/secure/Dashboard.jspa"
|
||||
if [[ "$JIRA_RAPID_BOARD" == "true" ]]; then
|
||||
open_command "${jira_url}/secure/RapidBoard.jspa"
|
||||
else
|
||||
open_command "${jira_url}/secure/Dashboard.jspa"
|
||||
fi
|
||||
elif [[ "$action" == "dumpconfig" ]]; then
|
||||
echo "JIRA_URL=$jira_url"
|
||||
echo "JIRA_PREFIX=$jira_prefix"
|
||||
@ -99,4 +103,3 @@ function _jira_query() {
|
||||
query="${lookup}+%3D+%22${jira_name}%22+AND+resolution+%3D+unresolved+ORDER+BY+priority+DESC%2C+created+ASC"
|
||||
open_command "${jira_url}/secure/IssueNavigator.jspa?reset=true&jqlQuery=${query}"
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
export MARKPATH=$HOME/.marks
|
||||
|
||||
jump() {
|
||||
cd -P "$MARKPATH/$1" 2>/dev/null || echo "No such mark: $1"
|
||||
cd -P "$MARKPATH/$1" 2>/dev/null || {echo "No such mark: $1"; return 1}
|
||||
}
|
||||
|
||||
mark() {
|
||||
|
@ -1,41 +1,85 @@
|
||||
# author: Peter Eisentraut
|
||||
# source: https://gist.github.com/petere/10307599
|
||||
# compdef kitchen
|
||||
#compdef kitchen
|
||||
# ------------------------------------------------------------------------------
|
||||
# Copyright (c) 2014 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 Test Kitchen (http://kitchen.ci/).
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
# Authors
|
||||
# -------
|
||||
#
|
||||
# * Peter Eisentraut (https://github.com/petere)
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
|
||||
_kitchen() {
|
||||
local curcontext="$curcontext" state line
|
||||
typeset -A opt_args
|
||||
local curcontext="$curcontext" state line
|
||||
typeset -A opt_args
|
||||
|
||||
_arguments '1: :->cmds'\
|
||||
'2: :->args'
|
||||
_arguments '1: :->cmds'\
|
||||
'2: :->args'
|
||||
|
||||
case $state in
|
||||
cmds)
|
||||
_arguments "1:Commands:(console converge create destroy diagnose driver help init list login setup test verify version)"
|
||||
;;
|
||||
args)
|
||||
case $line[1] in
|
||||
converge|create|destroy|diagnose|list|setup|test|verify)
|
||||
compadd "$@" all
|
||||
_kitchen_instances
|
||||
;;
|
||||
login)
|
||||
_kitchen_instances
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
case $state in
|
||||
cmds)
|
||||
_kitchen_commands
|
||||
;;
|
||||
args)
|
||||
case $line[1] in
|
||||
converge|create|destroy|diagnose|list|setup|test|verify)
|
||||
compadd 'all'
|
||||
_kitchen_instances
|
||||
;;
|
||||
login)
|
||||
_kitchen_instances
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
_kitchen_commands() {
|
||||
local commands
|
||||
|
||||
commands=("${(@f)$(_call_program commands $service help | sed -n 's/^ kitchen \([[:alpha:]]*\) [ [].*# \(.*\)$/\1:\2/p')}")
|
||||
_describe -t commands 'kitchen commands' commands
|
||||
}
|
||||
|
||||
_kitchen_instances() {
|
||||
if [[ $_kitchen_instances_cache_dir != $PWD ]]; then
|
||||
unset _kitchen_instances_cache
|
||||
fi
|
||||
if [[ ${+_kitchen_instances_cache} -eq 0 ]]; then
|
||||
_kitchen_instances_cache=(${(f)"$(bundle exec kitchen list -b 2>/dev/null || kitchen list -b 2>/dev/null)"})
|
||||
_kitchen_instances_cache_dir=$PWD
|
||||
fi
|
||||
compadd -a _kitchen_instances_cache
|
||||
if [[ $_kitchen_instances_cache_dir != $PWD ]]; then
|
||||
unset _kitchen_instances_cache
|
||||
fi
|
||||
if [[ ${+_kitchen_instances_cache} -eq 0 ]]; then
|
||||
_kitchen_instances_cache=(${(f)"$(_call_program instances $service list -b 2>/dev/null)"})
|
||||
_kitchen_instances_cache_dir=$PWD
|
||||
fi
|
||||
_wanted instances expl 'instance' compadd -a _kitchen_instances_cache
|
||||
}
|
||||
|
||||
_kitchen "$@"
|
||||
|
@ -3,6 +3,9 @@
|
||||
# You can override the path to knife.rb and your cookbooks by setting
|
||||
# KNIFE_CONF_PATH=/path/to/my/.chef/knife.rb
|
||||
# KNIFE_COOKBOOK_PATH=/path/to/my/chef/cookbooks
|
||||
# If you want your local cookbooks path to be calculated relative to where you are then
|
||||
# set the below option
|
||||
# KNIFE_RELATIVE_PATH=true
|
||||
# Read around where these are used for more detail.
|
||||
|
||||
# These flags should be available everywhere according to man knife
|
||||
@ -119,7 +122,19 @@ _knife() {
|
||||
_arguments '4:Subsubsubcommands:($(_chef_$words[2]_$words[3]s_remote))'
|
||||
;;
|
||||
file)
|
||||
_arguments '*:file or directory:_files -g "*.(rb|json)"'
|
||||
case $words[2] in
|
||||
environment)
|
||||
_arguments '*:files:_path_files -g "*.(rb|json)" -W "$(_chef_root)/environments"'
|
||||
;;
|
||||
node)
|
||||
_arguments '*:files:_path_files -g "*.(rb|json)" -W "$(_chef_root)/nodes"'
|
||||
;;
|
||||
role)
|
||||
_arguments '*:files:_path_files -g "*.(rb|json)" -W "$(_chef_root)/roles"'
|
||||
;;
|
||||
*)
|
||||
_arguments '*:Subsubcommands:($(_knife_options3))'
|
||||
esac
|
||||
;;
|
||||
list)
|
||||
compadd -a "$@" knife_general_flags
|
||||
@ -132,11 +147,22 @@ _knife() {
|
||||
if (( versioncomp > 0 )); then
|
||||
compadd "$@" attributes definitions files libraries providers recipes resources templates
|
||||
else
|
||||
_arguments '*:Subsubcommands:($(_knife_options2))'
|
||||
case $words[5] in
|
||||
file)
|
||||
_arguments '*:directory:_path_files -/ -W "$(_chef_root)/data_bags" -qS \ '
|
||||
;;
|
||||
*) _arguments '*:Subsubcommands:($(_knife_options2))'
|
||||
esac
|
||||
fi
|
||||
;;
|
||||
knifesubcmd5)
|
||||
_arguments '*:Subsubcommands:($(_knife_options3))'
|
||||
case $words[5] in
|
||||
file)
|
||||
_arguments '*:files:_path_files -g "*.json" -W "$(_chef_root)/data_bags/$words[6]"'
|
||||
;;
|
||||
*)
|
||||
_arguments '*:Subsubcommands:($(_knife_options3))'
|
||||
esac
|
||||
esac
|
||||
}
|
||||
|
||||
@ -184,12 +210,15 @@ _chef_environments_remote() {
|
||||
|
||||
# The chef_x_local functions use the knife config to find the paths of relevant objects x to be uploaded to the server
|
||||
_chef_cookbooks_local() {
|
||||
|
||||
local knife_rb=${KNIFE_CONF_PATH:-${HOME}/.chef/knife.rb}
|
||||
if [ -f ./.chef/knife.rb ]; then
|
||||
knife_rb="./.chef/knife.rb"
|
||||
if [ $KNIFE_RELATIVE_PATH ]; then
|
||||
local cookbook_path="$(_chef_root)/cookbooks"
|
||||
else
|
||||
local knife_rb=${KNIFE_CONF_PATH:-${HOME}/.chef/knife.rb}
|
||||
if [ -f ./.chef/knife.rb ]; then
|
||||
knife_rb="./.chef/knife.rb"
|
||||
fi
|
||||
local cookbook_path=${KNIFE_COOKBOOK_PATH:-$(grep cookbook_path $knife_rb | awk 'BEGIN {FS = "[" }; {print $2}' | sed 's/\,//g' | sed "s/'//g" | sed 's/\(.*\)]/\1/' )}
|
||||
fi
|
||||
local cookbook_path=${KNIFE_COOKBOOK_PATH:-$(grep cookbook_path $knife_rb | awk 'BEGIN {FS = "[" }; {print $2}' | sed 's/\,//g' | sed "s/'//g" | sed 's/\(.*\)]/\1/' )}
|
||||
(for i in $cookbook_path; do ls $i; done)
|
||||
}
|
||||
|
||||
@ -198,4 +227,15 @@ _cookbook_versions() {
|
||||
(knife cookbook show $words[4] | grep -v $words[4] | grep -v -E '\]|\[|\{|\}' | sed 's/ //g' | sed 's/"//g')
|
||||
}
|
||||
|
||||
# Searches up from current directory to find the closest folder that has a .chef folder
|
||||
# Useful for the knife upload/from file commands
|
||||
_chef_root () {
|
||||
directory="$PWD"
|
||||
while [ $directory != '/' ]
|
||||
do
|
||||
test -e "$directory/.chef" && echo "$directory" && return
|
||||
directory="${directory:h}"
|
||||
done
|
||||
}
|
||||
|
||||
_knife "$@"
|
||||
|
7
plugins/kubectl/kubectl.plugin.zsh
Normal file
7
plugins/kubectl/kubectl.plugin.zsh
Normal file
@ -0,0 +1,7 @@
|
||||
# Autocompletion for kubectl, the command line interface for Kubernetes
|
||||
#
|
||||
# Author: https://github.com/pstadler
|
||||
|
||||
if [ $commands[kubectl] ]; then
|
||||
source <(kubectl completion zsh)
|
||||
fi
|
9
plugins/last-working-dir/README.md
Normal file
9
plugins/last-working-dir/README.md
Normal file
@ -0,0 +1,9 @@
|
||||
# last-working-dir plugin
|
||||
|
||||
Keeps track of the last used working directory and automatically jumps into it
|
||||
for new shells, unless:
|
||||
|
||||
- The plugin is already loaded.
|
||||
- The current `$PWD` is not `$HOME`.
|
||||
|
||||
Adds `lwd` function to jump to the last working directory.
|
@ -1,26 +1,23 @@
|
||||
#!/usr/bin/env zsh
|
||||
# Keeps track of the last used working directory and automatically jumps
|
||||
# into it for new shells.
|
||||
|
||||
# Flag indicating if we've previously jumped to last directory.
|
||||
# Flag indicating if we've previously jumped to last directory
|
||||
typeset -g ZSH_LAST_WORKING_DIRECTORY
|
||||
mkdir -p $ZSH_CACHE_DIR
|
||||
cache_file="$ZSH_CACHE_DIR/last-working-dir"
|
||||
|
||||
# Updates the last directory once directory is changed.
|
||||
# Updates the last directory once directory is changed
|
||||
chpwd_functions+=(chpwd_last_working_dir)
|
||||
function chpwd_last_working_dir() {
|
||||
# Use >| in case noclobber is set to avoid "file exists" error
|
||||
chpwd_last_working_dir() {
|
||||
local cache_file="$ZSH_CACHE_DIR/last-working-dir"
|
||||
pwd >| "$cache_file"
|
||||
}
|
||||
|
||||
# Changes directory to the last working directory.
|
||||
function lwd() {
|
||||
[[ ! -r "$cache_file" ]] || cd "`cat "$cache_file"`"
|
||||
# Changes directory to the last working directory
|
||||
lwd() {
|
||||
local cache_file="$ZSH_CACHE_DIR/last-working-dir"
|
||||
[[ -r "$cache_file" ]] && cd "$(cat "$cache_file")"
|
||||
}
|
||||
|
||||
# Automatically jump to last working directory unless this isn't the first time
|
||||
# this plugin has been loaded.
|
||||
if [[ -z "$ZSH_LAST_WORKING_DIRECTORY" ]]; then
|
||||
lwd 2>/dev/null && ZSH_LAST_WORKING_DIRECTORY=1 || true
|
||||
fi
|
||||
# Jump to last directory automatically unless:
|
||||
# - this isn't the first time the plugin is loaded
|
||||
# - it's not in $HOME directory
|
||||
[[ -n "$ZSH_LAST_WORKING_DIRECTORY" ]] && return
|
||||
[[ "$PWD" != "$HOME" ]] && return
|
||||
|
||||
lwd 2>/dev/null && ZSH_LAST_WORKING_DIRECTORY=1 || true
|
||||
|
@ -33,6 +33,8 @@ function _lein_commands() {
|
||||
"version:print leiningen's version"
|
||||
)
|
||||
_describe -t subcommands 'leiningen subcommands' subcommands && ret=0
|
||||
;;
|
||||
*) _files
|
||||
esac
|
||||
|
||||
return ret
|
||||
|
45
plugins/meteor/README.md
Normal file
45
plugins/meteor/README.md
Normal file
@ -0,0 +1,45 @@
|
||||
## Introduction
|
||||
|
||||
The [meteor plugin](https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins/meteor) provides many
|
||||
[useful aliases](#aliases) as well as completion for the `meteor` command.
|
||||
|
||||
Enable it by adding `meteor` to the plugins array in your zshrc file:
|
||||
```zsh
|
||||
plugins=(... meteor)
|
||||
```
|
||||
|
||||
## Aliases
|
||||
|
||||
| Alias | Command | Description |
|
||||
|---------|----------------------------|------------------------------------------------------------------|
|
||||
| `ma` | `meteor add` | Add a package to this project |
|
||||
| `map` | `meteor add-platform` | Add a platform to this project |
|
||||
| `mad` | `meteor admin` | Administrative commands |
|
||||
| `mau` | `meteor authorized` | View or change authorized users and organizations for a site |
|
||||
| `mb` | `meteor build` | Build this project for all platforms |
|
||||
| `mcl` | `meteor claim` | Claim a site deployed with an old Meteor version |
|
||||
| `mca` | `meteor configure-android` | Run the Android configuration tool from Meteor's ADK environment |
|
||||
| `mc` | `meteor create` | Create a new project |
|
||||
| `mdb` | `meteor debug` | Run the project, but suspend the server process for debugging |
|
||||
| `mde` | `meteor deploy` | Deploy this project to Meteor |
|
||||
| `mis` | `meteor install-sdk` | Installs SDKs for a platform |
|
||||
| `ml` | `meteor list` | List the packages explicitly used by your project |
|
||||
| `mlp` | `meteor list-platforms` | List the platforms added to your project |
|
||||
| `mls` | `meteor list-sites` | List sites for which you are authorized |
|
||||
| `mli` | `meteor login` | Log in to your Meteor developer account |
|
||||
| `mlo` | `meteor logout` | Log out of your Meteor developer account |
|
||||
| `mlog` | `meteor logs` | Show logs for specified site |
|
||||
| `mm` | `meteor mongo` | Connect to the Mongo database for the specified site |
|
||||
| `mp` | `meteor publish` | Publish a new version of a package to the package server |
|
||||
| `mpa` | `meteor publish-for-arch` | Builds an already-published package for a new platform |
|
||||
| `mpr` | `meteor publish-release` | Publish a new meteor release to the package server |
|
||||
| `mr` | `meteor remove` | Remove a package from this project |
|
||||
| `mrp` | `meteor remove-platform` | Remove a platform from this project |
|
||||
| `mre` | `meteor reset` | Reset the project state. Erases the local database |
|
||||
| `m` | `meteor run` | **[default]** Run this project in local development mode |
|
||||
| `ms` | `meteor search` | Search through the package server database |
|
||||
| `msh` | `meteor shell` | Launch a Node REPL for interactively evaluating server-side code |
|
||||
| `msw` | `meteor show` | Show detailed information about a release or package |
|
||||
| `mt` | `meteor test-packages` | Test one or more packages |
|
||||
| `mu` | `meteor update` | Upgrade this project's dependencies to their latest versions |
|
||||
| `mw` | `meteor whoami` | Prints the username of your Meteor developer account |
|
33
plugins/meteor/meteor.plugin.zsh
Normal file
33
plugins/meteor/meteor.plugin.zsh
Normal file
@ -0,0 +1,33 @@
|
||||
# Aliases in alphabetical order
|
||||
|
||||
alias ma='meteor add' # Add a package to this project.
|
||||
alias map='meteor add-platform' # Add a platform to this project.
|
||||
alias mad='meteor admin' # Administrative commands.
|
||||
alias mau='meteor authorized' # View or change authorized users and organizations for a site.
|
||||
alias mb='meteor build' # Build this project for all platforms.
|
||||
alias mcl='meteor claim' # Claim a site deployed with an old Meteor version.
|
||||
alias mca='meteor configure-android' # Run the Android configuration tool from Meteor's ADK environment.
|
||||
alias mc='meteor create' # Create a new project.
|
||||
alias mdb='meteor debug' # Run the project, but suspend the server process for debugging.
|
||||
alias mde='meteor deploy' # Deploy this project to Meteor.
|
||||
alias mis='meteor install-sdk' # Installs SDKs for a platform.
|
||||
alias ml='meteor list' # List the packages explicitly used by your project.
|
||||
alias mlp='meteor list-platforms' # List the platforms added to your project.
|
||||
alias mls='meteor list-sites' # List sites for which you are authorized.
|
||||
alias mli='meteor login' # Log in to your Meteor developer account.
|
||||
alias mlo='meteor logout' # Log out of your Meteor developer account.
|
||||
alias mlog='meteor logs' # Show logs for specified site.
|
||||
alias mm='meteor mongo' # Connect to the Mongo database for the specified site.
|
||||
alias mp='meteor publish' # Publish a new version of a package to the package server.
|
||||
alias mpa='meteor publish-for-arch' # Builds an already-published package for a new platform.
|
||||
alias mpr='meteor publish-release' # Publish a new meteor release to the package server.
|
||||
alias mr='meteor remove' # Remove a package from this project.
|
||||
alias mrp='meteor remove-platform' # Remove a platform from this project.
|
||||
alias mre='meteor reset' # Reset the project state. Erases the local database.
|
||||
alias m='meteor run' # [default] Run this project in local development mode.
|
||||
alias ms='meteor search' # Search through the package server database.
|
||||
alias msh='meteor shell' # Launch a Node REPL for interactively evaluating server-side code.
|
||||
alias msw='meteor show' # Show detailed information about a release or package.
|
||||
alias mt='meteor test-packages' # Test one or more packages.
|
||||
alias mu='meteor update' # Upgrade this project's dependencies to their latest versions.
|
||||
alias mw='meteor whoami' # Prints the username of your Meteor developer account.
|
@ -38,6 +38,15 @@ _1st_arguments=(
|
||||
'local.hex:Install hex locally'
|
||||
'local.rebar:Install rebar locally'
|
||||
'new:Create a new Elixir project'
|
||||
'phoenix.digest:Digests and compress static files'
|
||||
'phoenix.gen.channel:Generates a Phoenix channel'
|
||||
'phoenix.gen.html:Generates controller, model and views for an HTML based resource'
|
||||
'phoenix.gen.json:Generates a controller and model for a JSON based resource'
|
||||
'phoenix.gen.model:Generates an Ecto model'
|
||||
'phoenix.gen.secret:Generates a secret'
|
||||
'phoenix.new:Create a new Phoenix application'
|
||||
'phoenix.routes:Prints all routes'
|
||||
'phoenix.server:Starts applications and their servers'
|
||||
'run:Run the given file or expression'
|
||||
"test:Run a project's tests"
|
||||
'--help:Describe available tasks'
|
||||
@ -49,7 +58,7 @@ __task_list ()
|
||||
local expl
|
||||
declare -a tasks
|
||||
|
||||
tasks=(app.start archive archive.build archive.install archive.uninstall clean cmd compile compile.protocols deps deps.clean deps.compile deps.get deps.unlock deps.update do escript.build help hex hex.config hex.docs hex.info hex.key hex.outdated hex.owner hex.publish hex.search hex.user loadconfig local local.hex local.rebar new run test)
|
||||
tasks=(app.start archive archive.build archive.install archive.uninstall clean cmd compile compile.protocols deps deps.clean deps.compile deps.get deps.unlock deps.update do escript.build help hex hex.config hex.docs hex.info hex.key hex.outdated hex.owner hex.publish hex.search hex.user loadconfig local local.hex local.rebar new phoenix.digest phoenix.gen.channel phoenix.gen.html phoenix.gen.json phoenix.gen.model phoenix.gen.secret phoenix.new phoenix.routes phoenix.server run test)
|
||||
|
||||
_wanted tasks expl 'help' compadd $tasks
|
||||
}
|
||||
@ -73,7 +82,10 @@ case $state in
|
||||
case $line[1] in
|
||||
(help)
|
||||
_arguments ':feature:__task_list'
|
||||
;;
|
||||
(test)
|
||||
_files
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
|
||||
|
33
plugins/mvn/README.md
Normal file
33
plugins/mvn/README.md
Normal file
@ -0,0 +1,33 @@
|
||||
## Introduction
|
||||
|
||||
The [mvn plugin](https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins/mvn) provides many
|
||||
[useful aliases](#aliases) as well as completion for the `mvn` command.
|
||||
|
||||
Enable it by adding `mvn` to the plugins array in your zshrc file:
|
||||
```zsh
|
||||
plugins=(... mvn)
|
||||
```
|
||||
|
||||
## Aliases
|
||||
|
||||
| Alias | Command |
|
||||
|:---------------------|:------------------------------------------------|
|
||||
| `mvncie` | `mvn clean install eclipse:eclipse` |
|
||||
| `mvnci` | `mvn clean install` |
|
||||
| `mvncist` | `mvn clean install -DskipTests` |
|
||||
| `mvncisto` | `mvn clean install -DskipTests --offline` |
|
||||
| `mvne` | `mvn eclipse:eclipse` |
|
||||
| `mvnd` | `mvn deploy` |
|
||||
| `mvnp` | `mvn package` |
|
||||
| `mvnc` | `mvn clean` |
|
||||
| `mvncom` | `mvn compile` |
|
||||
| `mvnct` | `mvn clean test` |
|
||||
| `mvnt` | `mvn test` |
|
||||
| `mvnag` | `mvn archetype:generate` |
|
||||
| `mvn-updates` | `mvn versions:display-dependency-updates` |
|
||||
| `mvntc7` | `mvn tomcat7:run` |
|
||||
| `mvnjetty` | `mvn jetty:run` |
|
||||
| `mvndt` | `mvn dependency:tree` |
|
||||
| `mvns` | `mvn site` |
|
||||
| `mvnsrc` | `mvn dependency:sources` |
|
||||
| `mvndocs` | `mvn dependency:resolve -Dclassifier=javadoc` |
|
@ -45,6 +45,7 @@ mvn-color()
|
||||
alias mvncie='mvn clean install eclipse:eclipse'
|
||||
alias mvnci='mvn clean install'
|
||||
alias mvncist='mvn clean install -DskipTests'
|
||||
alias mvncisto='mvn clean install -DskipTests --offline'
|
||||
alias mvne='mvn eclipse:eclipse'
|
||||
alias mvnce='mvn clean eclipse:clean eclipse:eclipse'
|
||||
alias mvnd='mvn deploy'
|
||||
@ -109,6 +110,8 @@ function listMavenCompletions {
|
||||
help:active-profiles help:all-profiles help:describe help:effective-pom help:effective-settings help:evaluate help:expressions help:system
|
||||
# release
|
||||
release:clean release:prepare release:rollback release:perform release:stage release:branch release:update-versions
|
||||
# jgitflow
|
||||
jgitflow:feature-start jgitflow:feature-finish jgitflow:release-start jgitflow:release-finish jgitflow:hotfix-start jgitflow:hotfix-finish jgitflow:build-number
|
||||
# repository
|
||||
repository:bundle-create repository:bundle-pack
|
||||
# source
|
||||
@ -171,7 +174,7 @@ function listMavenCompletions {
|
||||
gwt:browser gwt:clean gwt:compile gwt:compile-report gwt:css gwt:debug gwt:eclipse gwt:eclipseTest gwt:generateAsync gwt:help gwt:i18n gwt:mergewebxml gwt:resources gwt:run gwt:sdkInstall gwt:source-jar gwt:soyc gwt:test
|
||||
|
||||
# options
|
||||
-Dmaven.test.skip=true -DskipTests -Dmaven.surefire.debug -DenableCiProfile -Dpmd.skip=true -Dcheckstyle.skip=true -Dtycho.mode=maven
|
||||
-Dmaven.test.skip=true -DskipTests -DskipITs -Dmaven.surefire.debug -DenableCiProfile -Dpmd.skip=true -Dcheckstyle.skip=true -Dtycho.mode=maven -Dmaven.test.failure.ignore=true -DgroupId= -DartifactId= -Dversion= -Dpackaging=jar -Dfile=
|
||||
|
||||
# arguments
|
||||
-am -amd -B -C -c -cpu -D -e -emp -ep -f -fae -ff -fn -gs -h -l -N -npr -npu -nsu -o -P -pl -q -rf -s -T -t -U -up -V -v -X
|
||||
@ -180,6 +183,7 @@ function listMavenCompletions {
|
||||
archetype:generate generate-sources
|
||||
cobertura:cobertura
|
||||
-Dtest= `if [ -d ./src/test/java ] ; then find ./src/test/java -type f -name '*.java' | grep -v svn | sed 's?.*/\([^/]*\)\..*?-Dtest=\1?' ; fi`
|
||||
-Dit.test= `if [ -d ./src/test/java ] ; then find ./src/test/java -type f -name '*.java' | grep -v svn | sed 's?.*/\([^/]*\)\..*?-Dit.test=\1?' ; fi`
|
||||
);
|
||||
}
|
||||
|
||||
|
37
plugins/ng/README.md
Normal file
37
plugins/ng/README.md
Normal file
@ -0,0 +1,37 @@
|
||||
## NG Plugin
|
||||
|
||||
This [ng plugin](https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins/ng)
|
||||
adds completion support for Angular's CLI (named ng).
|
||||
|
||||
Ng is hosted on [ng home](https://github.com/catull/angular-cli)
|
||||
|
||||
It is used to generate Angular 2 app "stubs", build those apps, configure them,
|
||||
test them, lint them etc.
|
||||
|
||||
Ahem, "stubs" is not what Angular engineers refer to the items ng can generate
|
||||
for you.
|
||||
|
||||
"Stubs" can be any one of:
|
||||
- class
|
||||
- component
|
||||
- directive
|
||||
- enum
|
||||
- module
|
||||
- pipe
|
||||
- route
|
||||
- service
|
||||
|
||||
At the moment, `ng completion` creates a very rough completion for Zsh and
|
||||
Bash.
|
||||
|
||||
It is missing most of the options and a few arguments.
|
||||
In future, this plugin may be shortened to simply being
|
||||
|
||||
```zsh
|
||||
eval `ng completion`
|
||||
```
|
||||
|
||||
There is hope this materialises in the 21st century.
|
||||
|
||||
### CONTRIBUTOR
|
||||
- Carlo Dapor ([catull](https://github.com/catull))
|
77
plugins/ng/ng.plugin.zsh
Normal file
77
plugins/ng/ng.plugin.zsh
Normal file
@ -0,0 +1,77 @@
|
||||
|
||||
ng_opts='addon asset-sizes b build completion d destroy doc e2e g generate get github-pages:deploy gh-pages:deploy h help i init install lint make-this-awesome new s serve server set t test v version -h --help'
|
||||
|
||||
_ng_completion () {
|
||||
local words cword opts
|
||||
read -Ac words
|
||||
read -cn cword
|
||||
let cword-=1
|
||||
|
||||
case $words[cword] in
|
||||
addon )
|
||||
opts='-b --blueprint -d -dir --directory --dry-run -sb --skip-bower -sg --skip-git -sn --skip-npm -v --verbose'
|
||||
;;
|
||||
|
||||
asset-sizes )
|
||||
opts='-o --output-path'
|
||||
;;
|
||||
|
||||
b | build )
|
||||
opts='--environment --output-path --suppress-sizes --target --watch --watcher -dev -e -prod'
|
||||
;;
|
||||
|
||||
d | destroy )
|
||||
opts='--dry-run --verbose --pod --classic --dummy --in-repo --in-repo-addon -d -v -p -c -dum -id -ir'
|
||||
;;
|
||||
|
||||
g | generate )
|
||||
opts='class component directive enum module pipe route service --generate -d --dry-run --verbose -v --pod -p --classic -c --dummy -dum -id --in-repo --in-repo-addon -ir'
|
||||
;;
|
||||
|
||||
gh-pages:deploy | github-pages:deploy )
|
||||
opts='--environment --gh-token --gh-username --skip-build --user-page --message'
|
||||
;;
|
||||
|
||||
h | help | -h | --help)
|
||||
opts='--json --verbose -v'
|
||||
;;
|
||||
|
||||
init )
|
||||
opts='--blueprint --dry-run --link-cli --mobile --name --prefix --skip-bower --skip-npm --source-dir --style --verbose -b -d -lc -n -p -sb -sd -sn -v'
|
||||
;;
|
||||
|
||||
new )
|
||||
opts='--blueprint --directory --dry-run --link-cli --mobile --prefix --skip-bower --skip-git --skip-npm --source-dir --style --verbose -b -d -dir -lc -p -sb -sd -sg -sn -v'
|
||||
;;
|
||||
|
||||
s | serve | server )
|
||||
opts='--environment --host --insecure-proxy --inspr --live-reload --live-reload-base-url --live-reload-host --live-reload-live-css --live-reload-port --output-path --port --proxy --ssl --ssl-cert --ssl-key --target --watcher -H -dev -e -lr -lrbu -lrh -lrp -op -out -p -pr -prod -pxy -t -w'
|
||||
;;
|
||||
|
||||
set )
|
||||
opts='--global -g'
|
||||
;;
|
||||
|
||||
t | test )
|
||||
opts='--browsers --colors --config-file --environment --filter --host --launch --log-level --module --path --port --query --reporter --server --silent --test-page --test-port --watch -H -c -cf -e -f -m -r -s -tp -w'
|
||||
;;
|
||||
|
||||
v | version )
|
||||
opts='--verbose'
|
||||
;;
|
||||
|
||||
ng )
|
||||
opts=$ng_opts
|
||||
;;
|
||||
|
||||
* )
|
||||
opts=''
|
||||
;;
|
||||
esac
|
||||
|
||||
setopt shwordsplit
|
||||
reply=($opts)
|
||||
unset shwordsplit
|
||||
}
|
||||
|
||||
compctl -K _ng_completion ng
|
15
plugins/nomad/README.md
Normal file
15
plugins/nomad/README.md
Normal file
@ -0,0 +1,15 @@
|
||||
# Nomad
|
||||
|
||||
The `nomad` plugin provides a simple autocompletion for [Nomad](https://nomadproject.io/), a tool from Hashicorp for easily deploy applications at any scale.
|
||||
|
||||
## Usage
|
||||
|
||||
1. Enable the `nomad` plugin:
|
||||
|
||||
```zsh
|
||||
plugins=(... nomad)
|
||||
```
|
||||
|
||||
2. Install [Nomad](https://nomadproject.io/)
|
||||
|
||||
3. Type `nomad` into your prompt and hit `TAB` to see available completion options.
|
153
plugins/nomad/_nomad
Normal file
153
plugins/nomad/_nomad
Normal file
@ -0,0 +1,153 @@
|
||||
#compdef nomad
|
||||
|
||||
local -a _nomad_cmds
|
||||
_nomad_cmds=(
|
||||
'agent:Runs a Nomad agent'
|
||||
'agent-info:Display status information about the local agent'
|
||||
'alloc-status:Display allocation status information and metadata'
|
||||
'client-config:View or modify client configuration details'
|
||||
'eval-status:Display evaluation status and placement failure reasons'
|
||||
'fs:Inspect the contents of an allocation directory'
|
||||
'init:Create an example job file'
|
||||
'inspect:Inspect a submitted job'
|
||||
'logs:Streams the logs of a task.'
|
||||
'node-drain:Toggle drain mode on a given node'
|
||||
'node-status:Display status information about nodes'
|
||||
'plan:Dry-run a job update to determine its effects'
|
||||
'run:Run a new job or update an existing'
|
||||
'server-force-leave:Force a server into the left state'
|
||||
'server-join:Join server nodes together'
|
||||
'server-members:Display a list of known servers and their'
|
||||
'status:Display status information about jobs'
|
||||
'stop:Stop a running job'
|
||||
'validate:Checks if a given job specification is valid'
|
||||
'version:Prints the Nomad version'
|
||||
)
|
||||
|
||||
__allocstatus() {
|
||||
_arguments \
|
||||
'-address=[(addr) The address of the Nomad server. Overrides the NOMAD_ADDR environment variable if set. Default = http://127.0.0.1:4646]' \
|
||||
'-region=[(region) The region of the Nomad servers to forward commands to. Overrides the NOMAD_REGION environment variable if set. Defaults to the Agent s local region.]' \
|
||||
'-no-color[Disables colored command output.]' \
|
||||
'-short[Display short output. Shows only the most recent task event.]' \
|
||||
'-stats[Display detailed resource usage statistics.]' \
|
||||
'-verbose[Show full information.]' \
|
||||
'-json[Output the allocation in its JSON format.]' \
|
||||
'-t[Format and display allocation using a Go template.]'
|
||||
}
|
||||
|
||||
__evalstatus() {
|
||||
_arguments \
|
||||
'-address=[(addr) The address of the Nomad server. Overrides the NOMAD_ADDR environment variable if set. Default = http://127.0.0.1:4646]' \
|
||||
'-region=[(region) The region of the Nomad servers to forward commands to. Overrides the NOMAD_REGION environment variable if set. Defaults to the Agent s local region.]' \
|
||||
'-no-color[Disables colored command output.]' \
|
||||
'-monitor[Monitor an outstanding evaluation.]' \
|
||||
'-verbose[Show full information.]' \
|
||||
'-json[Output the allocation in its JSON format.]' \
|
||||
'-t[Format and display allocation using a Go template.]'
|
||||
}
|
||||
|
||||
__inspect() {
|
||||
_arguments \
|
||||
'-address=[(addr) The address of the Nomad server. Overrides the NOMAD_ADDR environment variable if set. Default = http://127.0.0.1:4646]' \
|
||||
'-region=[(region) The region of the Nomad servers to forward commands to. Overrides the NOMAD_REGION environment variable if set. Defaults to the Agent s local region.]' \
|
||||
'-no-color[Disables colored command output.]' \
|
||||
'-json[Output the allocation in its JSON format.]' \
|
||||
'-t[Format and display allocation using a Go template.]'
|
||||
}
|
||||
|
||||
__logs() {
|
||||
_arguments \
|
||||
'-address=[(addr) The address of the Nomad server. Overrides the NOMAD_ADDR environment variable if set. Default = http://127.0.0.1:4646]' \
|
||||
'-region=[(region) The region of the Nomad servers to forward commands to. Overrides the NOMAD_REGION environment variable if set. Defaults to the Agent s local region.]' \
|
||||
'-no-color[Disables colored command output.]' \
|
||||
'-stderr[ Display stderr logs.]' \
|
||||
'-job[<job-id> Use a random allocation from the specified job ID.]' \
|
||||
'-verbose[Show full information.]' \
|
||||
'-f[Causes the output to not stop when the end of the logs are reached, but rather to wait for additional output.]' \
|
||||
'-tail[Show the logs contents with offsets relative to the end of the logs. If no offset is given, -n is defaulted to 10.]' \
|
||||
'-n[Sets the tail location in best-efforted number of lines relative to the end of the logs.]' \
|
||||
'-c[Sets the tail location in number of bytes relative to the end of the logs.]'
|
||||
}
|
||||
|
||||
__nodestatus() {
|
||||
_arguments \
|
||||
'-address=[(addr) The address of the Nomad server. Overrides the NOMAD_ADDR environment variable if set. Default = http://127.0.0.1:4646]' \
|
||||
'-region=[(region) The region of the Nomad servers to forward commands to. Overrides the NOMAD_REGION environment variable if set. Defaults to the Agent s local region.]' \
|
||||
'-no-color[Disables colored command output.]' \
|
||||
'-self[Query the status of the local node.]' \
|
||||
'-allocs[ Display a count of running allocations for each node.]' \
|
||||
'-short[Display short output. Shows only the most recent task event.]' \
|
||||
'-stats[Display detailed resource usage statistics.]' \
|
||||
'-verbose[Show full information.]' \
|
||||
'-json[Output the allocation in its JSON format.]' \
|
||||
'-t[Format and display allocation using a Go template.]'
|
||||
}
|
||||
|
||||
__plan() {
|
||||
_arguments \
|
||||
'-address=[(addr) The address of the Nomad server. Overrides the NOMAD_ADDR environment variable if set. Default = http://127.0.0.1:4646]' \
|
||||
'-region=[(region) The region of the Nomad servers to forward commands to. Overrides the NOMAD_REGION environment variable if set. Defaults to the Agent s local region.]' \
|
||||
'-no-color[Disables colored command output.]' \
|
||||
'-diff[Determines whether the diff between the remote job and planned job is shown. Defaults to true.]'
|
||||
}
|
||||
|
||||
__run() {
|
||||
_arguments \
|
||||
'-address=[(addr) The address of the Nomad server. Overrides the NOMAD_ADDR environment variable if set. Default = http://127.0.0.1:4646]' \
|
||||
'-region=[(region) The region of the Nomad servers to forward commands to. Overrides the NOMAD_REGION environment variable if set. Defaults to the Agent s local region.]' \
|
||||
'-no-color[Disables colored command output.]' \
|
||||
'-check-index[If set, the job is only registered or updated if the the passed job modify index matches the server side version. If a check-index value of zero is passed, the job is only registered if it does not yet exist. If a non-zero value is passed, it ensures that the job is being updated from a known state. The use of this flag is most common in conjunction with plan command.]' \
|
||||
'-detach[Return immediately instead of entering monitor mode. After job submission, the evaluation ID will be printed to the screen, which can be used to examine the evaluation using the eval-status command.]' \
|
||||
'-output[Output the JSON that would be submitted to the HTTP API without submitting the job.]' \
|
||||
'-verbose[Show full information.]'
|
||||
}
|
||||
|
||||
__status() {
|
||||
_arguments \
|
||||
'-address=[(addr) The address of the Nomad server. Overrides the NOMAD_ADDR environment variable if set. Default = http://127.0.0.1:4646]' \
|
||||
'-region=[(region) The region of the Nomad servers to forward commands to. Overrides the NOMAD_REGION environment variable if set. Defaults to the Agent s local region.]' \
|
||||
'-no-color[Disables colored command output.]' \
|
||||
'-short[Display short output. Shows only the most recent task event.]' \
|
||||
'-evals[Display the evaluations associated with the job.]' \
|
||||
'-verbose[Show full information.]'
|
||||
}
|
||||
|
||||
__stop() {
|
||||
_arguments \
|
||||
'-address=[(addr) The address of the Nomad server. Overrides the NOMAD_ADDR environment variable if set. Default = http://127.0.0.1:4646]' \
|
||||
'-region=[(region) The region of the Nomad servers to forward commands to. Overrides the NOMAD_REGION environment variable if set. Defaults to the Agent s local region.]' \
|
||||
'-no-color[Disables colored command output.]' \
|
||||
'-detach[Return immediately instead of entering monitor mode. After the deregister command is submitted, a new evaluation ID is printed to the screen, which can be used to examine the evaluation using the eval-status command.]' \
|
||||
'-yes[Automatic yes to prompts.]' \
|
||||
'-verbose[Show full information.]'
|
||||
}
|
||||
|
||||
_arguments '*:: :->command'
|
||||
|
||||
if (( CURRENT == 1 )); then
|
||||
_describe -t commands "nomad command" _nomad_cmds
|
||||
return
|
||||
fi
|
||||
|
||||
local -a _command_args
|
||||
case "$words[1]" in
|
||||
alloc-status)
|
||||
__allocstatus ;;
|
||||
eval-status)
|
||||
__evalstatus ;;
|
||||
inspect)
|
||||
__inspect ;;
|
||||
logs)
|
||||
__logs ;;
|
||||
node-status)
|
||||
__nodestatus ;;
|
||||
plan)
|
||||
__plan ;;
|
||||
run)
|
||||
__run ;;
|
||||
status)
|
||||
__status ;;
|
||||
stop)
|
||||
__stop ;;
|
||||
esac
|
@ -1,4 +1,15 @@
|
||||
eval "$(npm completion 2>/dev/null)"
|
||||
(( $+commands[npm] )) && {
|
||||
__NPM_COMPLETION_FILE="${ZSH_CACHE_DIR}/npm_completion"
|
||||
|
||||
if [[ ! -f $__NPM_COMPLETION_FILE ]]; then
|
||||
npm completion >! $__NPM_COMPLETION_FILE 2>/dev/null
|
||||
[[ $? -ne 0 ]] && rm -f $__NPM_COMPLETION_FILE
|
||||
fi
|
||||
|
||||
[[ -f $__NPM_COMPLETION_FILE ]] && source $__NPM_COMPLETION_FILE
|
||||
|
||||
unset __NPM_COMPLETION_FILE
|
||||
}
|
||||
|
||||
# Install dependencies globally
|
||||
alias npmg="npm i -g "
|
||||
@ -17,3 +28,19 @@ alias npmD="npm i -D "
|
||||
# Execute command from node_modules folder based on current directory
|
||||
# i.e npmE gulp
|
||||
alias npmE='PATH="$(npm bin)":"$PATH"'
|
||||
|
||||
# Check which npm modules are outdated
|
||||
alias npmO="npm outdated"
|
||||
|
||||
# Check package versions
|
||||
alias npmV="npm -v"
|
||||
|
||||
# List packages
|
||||
alias npmL="npm list"
|
||||
|
||||
# Run npm start
|
||||
alias npmst="npm start"
|
||||
|
||||
# Run npm test
|
||||
alias npmt="npm test"
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#compdef nvm
|
||||
#autoload
|
||||
|
||||
[[ -s ~/.nvm/nvm.sh ]] || return 0
|
||||
[[ -f "$NVM_DIR/nvm.sh" ]] || return 0
|
||||
|
||||
local -a _1st_arguments
|
||||
_1st_arguments=(
|
||||
|
@ -1,3 +1,5 @@
|
||||
# The addition 'nvm install' attempts in ~/.profile
|
||||
# Set NVM_DIR if it isn't already defined
|
||||
[[ -z "$NVM_DIR" ]] && export NVM_DIR="$HOME/.nvm"
|
||||
|
||||
[[ -s ~/.nvm/nvm.sh ]] && . ~/.nvm/nvm.sh
|
||||
# Load nvm if it exists
|
||||
[[ -f "$NVM_DIR/nvm.sh" ]] && source "$NVM_DIR/nvm.sh"
|
||||
|
33
plugins/osx/README.md
Normal file
33
plugins/osx/README.md
Normal file
@ -0,0 +1,33 @@
|
||||
# OSX plugin
|
||||
|
||||
## Description
|
||||
|
||||
This plugin provides a few utilities to make it more enjoyable on OSX.
|
||||
|
||||
To start using it, add the `osx` plugin to your plugins array in `~/.zshrc`:
|
||||
|
||||
```zsh
|
||||
plugins=(... osx)
|
||||
```
|
||||
|
||||
Original author: [Sorin Ionescu](https://github.com/sorin-ionescu)
|
||||
|
||||
|
||||
## Commands
|
||||
|
||||
| Command | Description |
|
||||
| :-------------- | :----------------------------------------------- |
|
||||
| `tab` | Open the current directory in a new tab |
|
||||
| `split_tab` | Split the current terminal tab horizontally |
|
||||
| `vsplit_tab` | Split the current terminal tab vertically |
|
||||
| `ofd` | Open the current directory in a Finder window |
|
||||
| `pfd` | Return the path of the frontmost Finder window |
|
||||
| `pfs` | Return the current Finder selection |
|
||||
| `cdf` | `cd` to the current Finder directory |
|
||||
| `pushdf` | `pushd` to the current Finder directory |
|
||||
| `quick-look` | Quick-Look a specified file |
|
||||
| `man-preview` | Open a specified man page in Preview app |
|
||||
| `showfiles` | Show hidden files |
|
||||
| `hidefiles` | Hide the hidden files |
|
||||
| `itunes` | Control iTunes. User `itunes -h` for usage details |
|
||||
| `spotify` | Control Spotify and search by artist, album, track and etc.|
|
@ -1,5 +0,0 @@
|
||||
#compdef man-preview
|
||||
#autoload
|
||||
|
||||
_man
|
||||
|
@ -1,9 +1,5 @@
|
||||
# ------------------------------------------------------------------------------
|
||||
# FILE: osx.plugin.zsh
|
||||
# DESCRIPTION: oh-my-zsh plugin file.
|
||||
# AUTHOR: Sorin Ionescu (sorin.ionescu@gmail.com)
|
||||
# VERSION: 1.1.0
|
||||
# ------------------------------------------------------------------------------
|
||||
# Open the current directory in a Finder window
|
||||
alias ofd='open_command $PWD'
|
||||
|
||||
function _omz_osx_get_frontmost_app() {
|
||||
local the_app=$(
|
||||
@ -46,6 +42,16 @@ EOF
|
||||
end tell
|
||||
EOF
|
||||
|
||||
elif [[ "$the_app" == 'iTerm2' ]]; then
|
||||
osascript <<EOF
|
||||
tell application "iTerm2"
|
||||
tell current window
|
||||
create tab with default profile
|
||||
tell current session to write text "${command}"
|
||||
end tell
|
||||
end tell
|
||||
EOF
|
||||
|
||||
else
|
||||
echo "tab: unsupported terminal app: $the_app"
|
||||
false
|
||||
@ -73,6 +79,19 @@ function vsplit_tab() {
|
||||
end tell
|
||||
EOF
|
||||
|
||||
elif [[ "$the_app" == 'iTerm2' ]]; then
|
||||
osascript <<EOF
|
||||
tell application "iTerm2"
|
||||
tell current session of first window
|
||||
set newSession to (split vertically with same profile)
|
||||
tell newSession
|
||||
write text "${command}"
|
||||
select
|
||||
end tell
|
||||
end tell
|
||||
end tell
|
||||
EOF
|
||||
|
||||
else
|
||||
echo "$0: unsupported terminal app: $the_app" >&2
|
||||
false
|
||||
@ -100,6 +119,19 @@ function split_tab() {
|
||||
end tell
|
||||
EOF
|
||||
|
||||
elif [[ "$the_app" == 'iTerm2' ]]; then
|
||||
osascript <<EOF
|
||||
tell application "iTerm2"
|
||||
tell current session of first window
|
||||
set newSession to (split horizontally with same profile)
|
||||
tell newSession
|
||||
write text "${command}"
|
||||
select
|
||||
end tell
|
||||
end tell
|
||||
end tell
|
||||
EOF
|
||||
|
||||
else
|
||||
echo "$0: unsupported terminal app: $the_app" >&2
|
||||
false
|
||||
@ -143,6 +175,7 @@ function quick-look() {
|
||||
function man-preview() {
|
||||
man -t "$@" | open -f -a Preview
|
||||
}
|
||||
compdef _man man-preview
|
||||
|
||||
function vncviewer() {
|
||||
open vnc://$@
|
||||
@ -227,3 +260,271 @@ EOF
|
||||
esac
|
||||
osascript -e "tell application \"iTunes\" to $opt"
|
||||
}
|
||||
|
||||
# Spotify control function
|
||||
function spotify() {
|
||||
|
||||
showHelp () {
|
||||
echo "Usage:";
|
||||
echo;
|
||||
echo " $(basename "$0") <command>";
|
||||
echo;
|
||||
echo "Commands:";
|
||||
echo;
|
||||
echo " play # Resumes playback where Spotify last left off.";
|
||||
echo " play [song name] # Finds a song by name and plays it.";
|
||||
echo " play album [album name] # Finds an album by name and plays it.";
|
||||
echo " play artist [artist name] # Finds an artist by name and plays it.";
|
||||
echo " play list [playlist name] # Finds a playlist by name and plays it.";
|
||||
echo " pause # Pauses Spotify playback.";
|
||||
echo " next # Skips to the next song in a playlist.";
|
||||
echo " prev # Returns to the previous song in a playlist.";
|
||||
echo " pos [time] # Jumps to a time (in secs) in the current song.";
|
||||
echo " quit # Stops playback and quits Spotify.";
|
||||
echo;
|
||||
echo " vol up # Increases the volume by 10%.";
|
||||
echo " vol down # Decreases the volume by 10%.";
|
||||
echo " vol [amount] # Sets the volume to an amount between 0 and 100.";
|
||||
echo " vol show # Shows the current Spotify volume.";
|
||||
echo;
|
||||
echo " status # Shows the current player status.";
|
||||
echo " share # Copies the current song URL to the clipboard."
|
||||
echo " info # Shows Full Information about song that is playing.";
|
||||
echo;
|
||||
echo " toggle shuffle # Toggles shuffle playback mode.";
|
||||
echo " toggle repeat # Toggles repeat playback mode.";
|
||||
}
|
||||
|
||||
cecho(){
|
||||
bold=$(tput bold);
|
||||
green=$(tput setaf 2);
|
||||
reset=$(tput sgr0);
|
||||
echo "$bold$green$1$reset";
|
||||
}
|
||||
|
||||
showStatus () {
|
||||
state=$(osascript -e 'tell application "Spotify" to player state as string');
|
||||
cecho "Spotify is currently $state.";
|
||||
if [ "$state" = "playing" ]; then
|
||||
artist=$(osascript -e 'tell application "Spotify" to artist of current track as string');
|
||||
album=$(osascript -e 'tell application "Spotify" to album of current track as string');
|
||||
track=$(osascript -e 'tell application "Spotify" to name of current track as string');
|
||||
duration=$(osascript -e 'tell application "Spotify" to duration of current track as string');
|
||||
duration=$(echo "scale=2; $duration / 60 / 1000" | bc);
|
||||
position=$(osascript -e 'tell application "Spotify" to player position as string' | tr ',' '.');
|
||||
position=$(echo "scale=2; $position / 60" | bc | awk '{printf "%0.2f", $0}');
|
||||
|
||||
printf "$reset""Artist: %s\nAlbum: %s\nTrack: %s \nPosition: %s / %s\n" "$artist" "$album" "$track" "$position" "$duration";
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
|
||||
if [ $# = 0 ]; then
|
||||
showHelp;
|
||||
else
|
||||
if [ "$(osascript -e 'application "Spotify" is running')" = "false" ]; then
|
||||
osascript -e 'tell application "Spotify" to activate'
|
||||
sleep 2
|
||||
fi
|
||||
fi
|
||||
|
||||
while [ $# -gt 0 ]; do
|
||||
arg=$1;
|
||||
|
||||
case $arg in
|
||||
"play" )
|
||||
if [ $# != 1 ]; then
|
||||
# There are additional arguments, so find out how many
|
||||
array=( $@ );
|
||||
len=${#array[@]};
|
||||
SPOTIFY_SEARCH_API="https://api.spotify.com/v1/search"
|
||||
SPOTIFY_PLAY_URI="";
|
||||
|
||||
searchAndPlay() {
|
||||
type="$1"
|
||||
Q="$2"
|
||||
|
||||
cecho "Searching ${type}s for: $Q";
|
||||
|
||||
SPOTIFY_PLAY_URI=$( \
|
||||
curl -s -G $SPOTIFY_SEARCH_API --data-urlencode "q=$Q" -d "type=$type&limit=1&offset=0" -H "Accept: application/json" \
|
||||
| grep -E -o "spotify:$type:[a-zA-Z0-9]+" -m 1
|
||||
)
|
||||
}
|
||||
|
||||
case $2 in
|
||||
"list" )
|
||||
_args=${array[*]:2:$len};
|
||||
Q=$_args;
|
||||
|
||||
cecho "Searching playlists for: $Q";
|
||||
|
||||
results=$( \
|
||||
curl -s -G $SPOTIFY_SEARCH_API --data-urlencode "q=$Q" -d "type=playlist&limit=10&offset=0" -H "Accept: application/json" \
|
||||
| grep -E -o "spotify:user:[a-zA-Z0-9_]+:playlist:[a-zA-Z0-9]+" -m 10 \
|
||||
)
|
||||
|
||||
count=$( \
|
||||
echo "$results" | grep -c "spotify:user" \
|
||||
)
|
||||
|
||||
if [ "$count" -gt 0 ]; then
|
||||
random=$(( RANDOM % count));
|
||||
|
||||
SPOTIFY_PLAY_URI=$( \
|
||||
echo "$results" | awk -v random="$random" '/spotify:user:[a-zA-Z0-9]+:playlist:[a-zA-Z0-9]+/{i++}i==random{print; exit}' \
|
||||
)
|
||||
fi;;
|
||||
|
||||
"album" | "artist" | "track" )
|
||||
_args=${array[*]:2:$len};
|
||||
searchAndPlay "$2" "$_args";;
|
||||
|
||||
* )
|
||||
_args=${array[*]:1:$len};
|
||||
searchAndPlay track "$_args";;
|
||||
esac
|
||||
|
||||
if [ "$SPOTIFY_PLAY_URI" != "" ]; then
|
||||
cecho "Playing ($Q Search) -> Spotify URL: $SPOTIFY_PLAY_URI";
|
||||
|
||||
osascript -e "tell application \"Spotify\" to play track \"$SPOTIFY_PLAY_URI\"";
|
||||
|
||||
else
|
||||
cecho "No results when searching for $Q";
|
||||
fi
|
||||
else
|
||||
# play is the only param
|
||||
cecho "Playing Spotify.";
|
||||
osascript -e 'tell application "Spotify" to play';
|
||||
fi
|
||||
break ;;
|
||||
|
||||
"pause" )
|
||||
state=$(osascript -e 'tell application "Spotify" to player state as string');
|
||||
if [ "$state" = "playing" ]; then
|
||||
cecho "Pausing Spotify.";
|
||||
else
|
||||
cecho "Playing Spotify.";
|
||||
fi
|
||||
|
||||
osascript -e 'tell application "Spotify" to playpause';
|
||||
break ;;
|
||||
|
||||
"quit" )
|
||||
cecho "Quitting Spotify.";
|
||||
osascript -e 'tell application "Spotify" to quit';
|
||||
exit 1 ;;
|
||||
|
||||
"next" )
|
||||
cecho "Going to next track." ;
|
||||
osascript -e 'tell application "Spotify" to next track';
|
||||
break ;;
|
||||
|
||||
"prev" )
|
||||
cecho "Going to previous track.";
|
||||
osascript -e 'tell application "Spotify" to previous track';
|
||||
break ;;
|
||||
|
||||
"vol" )
|
||||
vol=$(osascript -e 'tell application "Spotify" to sound volume as integer');
|
||||
if [[ "$2" = "show" || "$2" = "" ]]; then
|
||||
cecho "Current Spotify volume level is $vol.";
|
||||
break ;
|
||||
elif [ "$2" = "up" ]; then
|
||||
if [ "$vol" -le 90 ]; then
|
||||
newvol=$(( vol+10 ));
|
||||
cecho "Increasing Spotify volume to $newvol.";
|
||||
else
|
||||
newvol=100;
|
||||
cecho "Spotify volume level is at max.";
|
||||
fi
|
||||
elif [ "$2" = "down" ]; then
|
||||
if [ "$vol" -ge 10 ]; then
|
||||
newvol=$(( vol-10 ));
|
||||
cecho "Reducing Spotify volume to $newvol.";
|
||||
else
|
||||
newvol=0;
|
||||
cecho "Spotify volume level is at min.";
|
||||
fi
|
||||
elif [ "$2" -ge 0 ]; then
|
||||
newvol=$2;
|
||||
fi
|
||||
|
||||
osascript -e "tell application \"Spotify\" to set sound volume to $newvol";
|
||||
break ;;
|
||||
|
||||
"toggle" )
|
||||
if [ "$2" = "shuffle" ]; then
|
||||
osascript -e 'tell application "Spotify" to set shuffling to not shuffling';
|
||||
curr=$(osascript -e 'tell application "Spotify" to shuffling');
|
||||
cecho "Spotify shuffling set to $curr";
|
||||
elif [ "$2" = "repeat" ]; then
|
||||
osascript -e 'tell application "Spotify" to set repeating to not repeating';
|
||||
curr=$(osascript -e 'tell application "Spotify" to repeating');
|
||||
cecho "Spotify repeating set to $curr";
|
||||
fi
|
||||
break ;;
|
||||
|
||||
"pos" )
|
||||
cecho "Adjusting Spotify play position."
|
||||
osascript -e "tell application \"Spotify\" to set player position to $2";
|
||||
break;;
|
||||
|
||||
"status" )
|
||||
showStatus;
|
||||
break ;;
|
||||
|
||||
"info" )
|
||||
info=$(osascript -e 'tell application "Spotify"
|
||||
set tM to round (duration of current track / 60) rounding down
|
||||
set tS to duration of current track mod 60
|
||||
set pos to player position as text
|
||||
set myTime to tM as text & "min " & tS as text & "s"
|
||||
set nM to round (player position / 60) rounding down
|
||||
set nS to round (player position mod 60) rounding down
|
||||
set nowAt to nM as text & "min " & nS as text & "s"
|
||||
set info to "" & "\nArtist: " & artist of current track
|
||||
set info to info & "\nTrack: " & name of current track
|
||||
set info to info & "\nAlbum Artist: " & album artist of current track
|
||||
set info to info & "\nAlbum: " & album of current track
|
||||
set info to info & "\nSeconds: " & duration of current track
|
||||
set info to info & "\nSeconds played: " & pos
|
||||
set info to info & "\nDuration: " & mytime
|
||||
set info to info & "\nNow at: " & nowAt
|
||||
set info to info & "\nPlayed Count: " & played count of current track
|
||||
set info to info & "\nTrack Number: " & track number of current track
|
||||
set info to info & "\nPopularity: " & popularity of current track
|
||||
set info to info & "\nId: " & id of current track
|
||||
set info to info & "\nSpotify URL: " & spotify url of current track
|
||||
set info to info & "\nArtwork: " & artwork of current track
|
||||
set info to info & "\nPlayer: " & player state
|
||||
set info to info & "\nVolume: " & sound volume
|
||||
set info to info & "\nShuffle: " & shuffling
|
||||
set info to info & "\nRepeating: " & repeating
|
||||
end tell
|
||||
return info')
|
||||
echo "$info";
|
||||
break ;;
|
||||
|
||||
"share" )
|
||||
url=$(osascript -e 'tell application "Spotify" to spotify url of current track');
|
||||
remove='spotify:track:'
|
||||
url=${url#$remove}
|
||||
url="http://open.spotify.com/track/$url"
|
||||
cecho "Share URL: $url";
|
||||
cecho -n "$url" | pbcopy
|
||||
break;;
|
||||
|
||||
-h|--help| *)
|
||||
showHelp;
|
||||
break ;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
# Show/hide hidden files in the Finder
|
||||
alias showfiles="defaults write com.apple.finder AppleShowAllFiles -bool true && killall Finder"
|
||||
alias hidefiles="defaults write com.apple.finder AppleShowAllFiles -bool false && killall Finder"
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user