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

Merge branch 'master' into fabric_task_description

parents 225425fe 40df67bc
...@@ -51,6 +51,9 @@ _arguments \ ...@@ -51,6 +51,9 @@ _arguments \
if (( CURRENT == 1 )); then if (( CURRENT == 1 )); then
_describe -t commands "rails subcommand" _1st_arguments _describe -t commands "rails subcommand" _1st_arguments
return return
else
_files
return
fi fi
case "$words[1]" in case "$words[1]" in
......
function _rails_command () { function _rails_command () {
if [ -e "bin/rails" ]; then if [ -e "bin/stubs/rails" ]; then
bin/stubs/rails $@
elif [ -e "bin/rails" ]; then
bin/rails $@ bin/rails $@
elif [ -e "script/rails" ]; then elif [ -e "script/rails" ]; then
ruby script/rails $@ ruby script/rails $@
...@@ -11,9 +13,11 @@ function _rails_command () { ...@@ -11,9 +13,11 @@ function _rails_command () {
} }
function _rake_command () { function _rake_command () {
if [ -e "bin/rake" ]; then if [ -e "bin/stubs/rake" ]; then
bin/stubs/rake $@
elif [ -e "bin/rake" ]; then
bin/rake $@ bin/rake $@
elif type bundle &> /dev/null && [ -e "Gemfile" ]; then elif type bundle &> /dev/null && ([ -e "Gemfile" ] || [ -e "gems.rb" ]); then
bundle exec rake $@ bundle exec rake $@
else else
command rake $@ command rake $@
...@@ -39,7 +43,7 @@ alias rc='rails console' ...@@ -39,7 +43,7 @@ alias rc='rails console'
alias rcs='rails console --sandbox' alias rcs='rails console --sandbox'
alias rd='rails destroy' alias rd='rails destroy'
alias rdb='rails dbconsole' alias rdb='rails dbconsole'
alias rg='rails generate' alias rgen='rails generate'
alias rgm='rails generate migration' alias rgm='rails generate migration'
alias rp='rails plugin' alias rp='rails plugin'
alias ru='rails runner' alias ru='rails runner'
......
...@@ -8,7 +8,7 @@ checks the file modification time to see if it needs to regenerate the cache ...@@ -8,7 +8,7 @@ checks the file modification time to see if it needs to regenerate the cache
file. file.
This is entirely based on [this pull request by Ullrich Schäfer](https://github.com/robb/.dotfiles/pull/10/), This is entirely based on [this pull request by Ullrich Schäfer](https://github.com/robb/.dotfiles/pull/10/),
which is inspired by [this Ruby on Rails trick from 2006](http://weblog.rubyonrails.org/2006/3/9/fast-rake-task-completion-for-zsh/). which is inspired by [this Ruby on Rails trick from 2006](https://weblog.rubyonrails.org/2006/3/9/fast-rake-task-completion-for-zsh/).
Think about that. 2006. Think about that. 2006.
......
...@@ -20,7 +20,7 @@ _tasks_changed () { ...@@ -20,7 +20,7 @@ _tasks_changed () {
} }
_rake_generate () { _rake_generate () {
rake --silent --tasks | cut -d " " -f 2 > .rake_tasks rake --silent --tasks | cut -d " " -f 2 | sed 's/\[.*\]//g' > .rake_tasks
} }
_rake () { _rake () {
......
# Rake plugin
This plugin adds support for [rake](https://ruby.github.io/rake/), the Ruby
build tool or Ruby Make.
To use it, add `rake` to the plugins array in your zshrc file:
```zsh
plugins=(... rake)
```
## Aliases
The plugin aliases the rake command so you can pass arguments when invoking rake tasks
without having to escape the brackets, i.e., you can run
```
rake namespace:task['argument']
```
instead of having to do
```
rake namespace:task\['argument'\]
```
| Alias | Command | Description |
|--------|--------------------------------|-----------------------------------------------|
| rake | `noglob rake` | Allows unescaped square brackets |
| brake | `noglob bundle exec rake` | Same as above but call rake using bundler |
| srake | `noglob sudo rake` | Same as rake but using sudo |
| sbrake | `noglob sudo bundle exec rake` | Same as above but using both sudo and bundler |
## Jim Weirich
The plugin also aliases `rake` to [`jimweirich`](https://github.com/jimweirich), author of Rake
and big time contributor to the Ruby open source community. He passed away in 2014:
> Thank you Jim for everything you contributed to the Ruby and open source community
> over the years. We will miss you dearly. — [**@robbyrussell**](https://github.com/robbyrussell/oh-my-zsh/commit/598a9c6f990756386517d66b6bcf77e53791e905)
# rand-quote plugin
Displays a random quote taken from [quotationspage.com](http://www.quotationspage.com/random.php)
Created by [Eduardo San Martin Morote, aka Posva](https://posva.github.io)
## Usage
Add the plugin to the plugins array in your zshrc file and restart zsh:
```zsh
plugins=(... rand-quote)
```
Then, run `quote` to get a new random quote.
# Get a random quote fron the site http://www.quotationspage.com/random.php3 if ! (( $+commands[curl] )); then
# Created by Eduardo San Martin Morote aka Posva
# http://posva.github.io
# Sun Jun 09 10:59:36 CEST 2013
# Don't remove this header, thank you
# Usage: quote
WHO_COLOR="\e[0;33m"
TEXT_COLOR="\e[0;35m"
COLON_COLOR="\e[0;35m"
END_COLOR="\e[m"
if [[ -x `which curl` ]]; then
function quote()
{
Q=$(curl -s --connect-timeout 2 "http://www.quotationspage.com/random.php3" | iconv -c -f ISO-8859-1 -t UTF-8 | grep -m 1 "dt ")
TXT=$(echo "$Q" | sed -e 's/<\/dt>.*//g' -e 's/.*html//g' -e 's/^[^a-zA-Z]*//' -e 's/<\/a..*$//g')
W=$(echo "$Q" | sed -e 's/.*\/quotes\///g' -e 's/<.*//g' -e 's/.*">//g')
if [ "$W" -a "$TXT" ]; then
echo "${WHO_COLOR}${W}${COLON_COLOR}: ${TEXT_COLOR}${TXT}${END_COLOR}"
fi
}
#quote
else
echo "rand-quote plugin needs curl to work" >&2 echo "rand-quote plugin needs curl to work" >&2
return
fi fi
function quote {
emulate -L zsh
Q=$(curl -s --connect-timeout 2 "http://www.quotationspage.com/random.php" | iconv -c -f ISO-8859-1 -t UTF-8 | grep -m 1 "dt ")
TXT=$(echo "$Q" | sed -e 's/<\/dt>.*//g' -e 's/.*html//g' -e 's/^[^a-zA-Z]*//' -e 's/<\/a..*$//g')
WHO=$(echo "$Q" | sed -e 's/.*\/quotes\///g' -e 's/<.*//g' -e 's/.*">//g')
[[ -n "$WHO" && -n "$TXT" ]] && print -P "%F{3}${WHO}%f: “%F{5}${TXT}%f”"
}
# rbenv plugin
The primary job of this plugin is to provide `rbenv_prompt_info` which can be added to your theme to include Ruby
version and gemset information into your prompt.
Some functionality of this plugin will not work unless you also have the rbenv plugin *gemset* installed.
https://github.com/jf/rbenv-gemset
To use it, add `rbenv` to the plugins array in your zshrc file:
```zsh
plugins=(... rbenv)
```
## Alias
| Alias | Command | Description |
|----------------|---------------------|----------------------------------|
| rubies | `rbenv versions` | List the installed Ruby versions |
| gemsets | `rbenv gemset list` | List the existing gemsets |
## Functions
* `current_ruby`: The version of Ruby currently being used.
* `current_gemset`: The name of the current gemset.
* `gems`: Lists installed gems with enhanced formatting and color.
* `rbenv_prompt_info`: For adding information to your prompt. Format: `<ruby version>@<current gemset>`.
_homebrew-installed() { # This plugin loads rbenv into the current shell and provides prompt info via
type brew &> /dev/null # the 'rbenv_prompt_info' function.
}
FOUND_RBENV=$+commands[rbenv]
FOUND_RBENV=0
rbenvdirs=("$HOME/.rbenv" "/usr/local/rbenv" "/opt/rbenv" "/usr/local/opt/rbenv") if [[ $FOUND_RBENV -ne 1 ]]; then
if _homebrew-installed && rbenv_homebrew_path=$(brew --prefix rbenv 2>/dev/null); then rbenvdirs=("$HOME/.rbenv" "/usr/local/rbenv" "/opt/rbenv" "/usr/local/opt/rbenv")
rbenvdirs=($rbenv_homebrew_path "${rbenvdirs[@]}") for dir in $rbenvdirs; do
unset rbenv_homebrew_path if [[ -d $dir/bin ]]; then
export PATH="$dir/bin:$PATH"
FOUND_RBENV=1
break
fi
done
fi fi
for rbenvdir in "${rbenvdirs[@]}" ; do if [[ $FOUND_RBENV -ne 1 ]]; then
if [ -d $rbenvdir/bin -a $FOUND_RBENV -eq 0 ] ; then if (( $+commands[brew] )) && dir=$(brew --prefix rbenv 2>/dev/null); then
FOUND_RBENV=1 if [[ -d $dir/bin ]]; then
if [[ $RBENV_ROOT = '' ]]; then export PATH="$dir/bin:$PATH"
RBENV_ROOT=$rbenvdir FOUND_RBENV=1
fi
fi fi
export RBENV_ROOT fi
export PATH=${rbenvdir}/bin:$PATH
if [[ $FOUND_RBENV -eq 1 ]]; then
eval "$(rbenv init --no-rehash - zsh)" eval "$(rbenv init --no-rehash - zsh)"
alias rubies="rbenv versions" alias rubies="rbenv versions"
alias gemsets="rbenv gemset list" alias gemsets="rbenv gemset list"
function current_ruby() { function current_ruby() {
echo "$(rbenv version-name)" echo "$(rbenv version-name)"
} }
function current_gemset() { function current_gemset() {
echo "$(rbenv gemset active 2&>/dev/null | sed -e ":a" -e '$ s/\n/+/gp;N;b a' | head -n1)" echo "$(rbenv gemset active 2&>/dev/null | sed -e ":a" -e '$ s/\n/+/gp;N;b a' | head -n1)"
} }
function gems { function gems() {
local rbenv_path=$(rbenv prefix) local rbenv_path=$(rbenv prefix)
gem list $@ | sed -E \ gem list $@ | sed -E \
-e "s/\([0-9a-z, \.]+( .+)?\)/$fg[blue]&$reset_color/g" \ -e "s/\([0-9a-z, \.]+( .+)?\)/$fg[blue]&$reset_color/g" \
-e "s|$(echo $rbenv_path)|$fg[magenta]\$rbenv_path$reset_color|g" \ -e "s|$(echo $rbenv_path)|$fg[magenta]\$rbenv_path$reset_color|g" \
-e "s/$current_ruby@global/$fg[yellow]&$reset_color/g" \ -e "s/$current_ruby@global/$fg[yellow]&$reset_color/g" \
-e "s/$current_ruby$current_gemset$/$fg[green]&$reset_color/g" -e "s/$current_ruby$current_gemset$/$fg[green]&$reset_color/g"
} }
function rbenv_prompt_info() { function rbenv_prompt_info() {
if [[ -n $(current_gemset) ]] ; then if [[ -n $(current_gemset) ]] ; then
echo "$(current_ruby)@$(current_gemset)" echo "$(current_ruby)@$(current_gemset)"
else else
echo "$(current_ruby)" echo "$(current_ruby)"
fi fi
} }
fi else
done alias rubies="ruby -v"
unset rbenvdir function gemsets() { echo "not supported" }
function current_ruby() { echo "not supported" }
if [ $FOUND_RBENV -eq 0 ] ; then function current_gemset() { echo "not supported" }
alias rubies='ruby -v' function gems() { echo "not supported" }
function gemsets() { echo 'not supported' } function rbenv_prompt_info() { echo "system: $(ruby -v | cut -f-2 -d ' ')" }
function rbenv_prompt_info() { echo "system: $(ruby -v | cut -f-2 -d ' ')" }
fi fi
unset FOUND_RBENV rbenvdirs dir
# React Native # React Native plugin
**Maintainer:** [BilalBudhani](https://github.com/BilalBudhani) This plugin adds completion for [`react-native`](https://facebook.github.io/react-native/).
It also defines a few [aliases](#aliases) for the commands more frequently used.
### List of Aliases To enable, add `react-native` to your `plugins` array in your zshrc file:
Alias | React Native command ```zsh
------|--------------------- plugins=(... react-native)
**rnand** | *react-native run-android* ```
**rnios** | *react-native run-ios*
**rnios4s** | *react-native run-ios --simulator "iPhone 4s"*
**rnios5** | *react-native run-ios --simulator "iPhone 5"*
**rnios5s** | *react-native run-ios --simulator "iPhone 5s"*
## Aliases
| Alias | React Native command |
| :------------ | :------------------------------------------------- |
| **rn** | `react-native` |
| **rns** | `react-native start` |
| **rnlink** | `react-native link` |
| _Logging_ | |
| **rnland** | `react-native log-android` |
| **rnlios** | `react-native log-ios` |
| _App Testing_ | |
| **rnand** | `react-native run-android` |
| **rnios** | `react-native run-ios` |
| _iPhone_ | |
| **rnios4s** | `react-native run-ios --simulator "iPhone 4s"` |
| **rnios5** | `react-native run-ios --simulator "iPhone 5"` |
| **rnios5s** | `react-native run-ios --simulator "iPhone 5s"` |
| **rnios6** | `react-native run-ios --simulator "iPhone 6"` |
| **rnios6s** | `react-native run-ios --simulator "iPhone 6s"` |
| **rnios6p** | `react-native run-ios --simulator "iPhone 6 Plus"` |
| **rnios6sp** | `react-native run-ios --simulator "iPhone 6s Plus"` |
| **rnios7** | `react-native run-ios --simulator "iPhone 7"` |
| **rnios7p** | `react-native run-ios --simulator "iPhone 7 Plus"` |
| **rnios8** | `react-native run-ios --simulator "iPhone 8"` |
| **rnios8p** | `react-native run-ios --simulator "iPhone 8 Plus"` |
| **rniosse** | `react-native run-ios --simulator "iPhone SE"` |
| **rniosx** | `react-native run-ios --simulator "iPhone X"` |
| **rniosxs** | `react-native run-ios --simulator "iPhone Xs"` |
| **rniosxsm** | `react-native run-ios --simulator "iPhone Xs Max"` |
| **rniosxr** | `react-native run-ios --simulator "iPhone Xʀ"` |
| **rnios11** | `react-native run-ios --simulator "iPhone 11"` |
| **rnios11p** | `react-native run-ios --simulator "iPhone 11 Pro"` |
| **rnios11pm** | `react-native run-ios --simulator "iPhone 11 Pro Max"` |
| _iPad_ | |
| **rnipad2** | `react-native run-ios --simulator "iPad 2"` |
| **rnipad5** | `react-native run-ios --simulator "iPad (5th generation)"` |
| **rnipad6** | `react-native run-ios --simulator "iPad (6th generation)"` |
| **rnipadr** | `react-native run-ios --simulator "iPad Retina"` |
| **rnipada** | `react-native run-ios --simulator "iPad Air"` |
| **rnipada2** | `react-native run-ios --simulator "iPad Air 2"` |
| **rnipada3** | `react-native run-ios --simulator "iPad Air (3rd generation)"` |
| **rnipadm2** | `react-native run-ios --simulator "iPad mini 2"` |
| **rnipadm3** | `react-native run-ios --simulator "iPad mini 3"` |
| **rnipadm4** | `react-native run-ios --simulator "iPad mini 4"` |
| **rnipadm5** | `react-native run-ios --simulator "iPad mini (5th generation)"` |
| **rnipadp9** | `react-native run-ios --simulator "iPad Pro (9.7-inch)"` |
| **rnipadp12** | `react-native run-ios --simulator "iPad Pro (12.9-inch)"` |
| **rnipadp122** | `react-native run-ios --simulator "iPad Pro (12.9-inch) (2nd generation)"` |
| **rnipadp10** | `react-native run-ios --simulator "iPad Pro (10.5-inch)"` |
| **rnipad11** | `react-native run-ios --simulator "iPad Pro (11-inch)"` |
| **rnipad123** | `react-native run-ios --simulator "iPad Pro (12.9-inch) (3rd generation)"` |
| _Apple TV_ | |
| **rnatv** | `react-native run-ios --simulator "Apple TV"` |
| **rnatv4k** | `react-native run-ios --simulator "Apple TV 4K"` |
| **rnatv4k1080**| `react-native run-ios --simulator "Apple TV 4K (at 1080p)"` |
| **rnipad123** | `react-native run-ios --simulator "iPad Pro (12.9-inch) (3rd generation)"` |
| _Apple Watch_ | |
| **rnaw38** | `react-native run-ios --simulator "Apple Watch - 38mm"` |
| **rnaw42** | `react-native run-ios --simulator "Apple Watch - 42mm"` |
| **rnaws238** | `react-native run-ios --simulator "Apple Watch Series 2 - 38mm"` |
| **rnaws242** | `react-native run-ios --simulator "Apple Watch Series 2 - 42mm"` |
| **rnaws338** | `react-native run-ios --simulator "Apple Watch Series 3 - 38mm"` |
| **rnaws342** | `react-native run-ios --simulator "Apple Watch Series 3 - 42mm"` |
| **rnaws440** | `react-native run-ios --simulator "Apple Watch Series 4 - 40mm"` |
| **rnaws444** | `react-native run-ios --simulator "Apple Watch Series 4 - 44mm"` |
...@@ -3,12 +3,21 @@ ...@@ -3,12 +3,21 @@
local -a _1st_arguments local -a _1st_arguments
_1st_arguments=( _1st_arguments=(
'init:<ProjectName> generates a new project and installs its dependencies'
'android:creates an empty android project'
'start:starts the webserver' 'start:starts the webserver'
'bundle:builds the javascript bundle for offline use' 'run-ios:builds your app and starts it on iOS simulator'
'new-library:generates a native library bridge'
'android:generates an Android project for your app'
'run-android:builds your app and starts it on a connected Android emulator or device' 'run-android:builds your app and starts it on a connected Android emulator or device'
'upgrade:upgrade your apps template files to the latest version; run this after updating the react-native version in your package.json and running npm install' 'new-library:generates a native library bridge'
'bundle:builds the javascript bundle for offline use'
'unbundle:builds javascript as "unbundle" for offline use'
'link:[options] <packageName> links all native dependencies'
'unlink:[options] <packageName> unlink native dependency'
'install:[options] <packageName> install and link native dependencies'
'uninstall:[options] <packageName> uninstall and unlink native dependencies'
"upgrade:upgrade your app's template files to the latest version; run this after updating the react-native version in your package.json and running npm install"
'log-android:starts adb logcat'
'log-ios:starts iOS device syslog tail'
) )
......
# React Native
alias rn='react-native'
alias rns='react-native start'
alias rnlink='react-native link'
alias rnland='react-native log-android'
alias rnlios='react-native log-ios'
alias rnand='react-native run-android' alias rnand='react-native run-android'
alias rnios='react-native run-ios'
# iPhone
alias rnios4s='react-native run-ios --simulator "iPhone 4s"' alias rnios4s='react-native run-ios --simulator "iPhone 4s"'
alias rnios5='react-native run-ios --simulator "iPhone 5"' alias rnios5='react-native run-ios --simulator "iPhone 5"'
alias rnios5s='react-native run-ios --simulator "iPhone 5s"' alias rnios5s='react-native run-ios --simulator "iPhone 5s"'
alias rnios='react-native run-ios' alias rnios6='react-native run-ios --simulator "iPhone 6"'
alias rnios6p='react-native run-ios --simulator "iPhone 6 Plus"'
alias rnios6s='react-native run-ios --simulator "iPhone 6s"'
alias rnios6sp='react-native run-ios --simulator "iPhone 6s Plus"'
alias rnios7='react-native run-ios --simulator "iPhone 7"'
alias rnios7p='react-native run-ios --simulator "iPhone 7 Plus"'
alias rnios8='react-native run-ios --simulator "iPhone 8"'
alias rnios8p='react-native run-ios --simulator "iPhone 8 Plus"'
alias rniosse='react-native run-ios --simulator "iPhone SE"'
alias rniosx='react-native run-ios --simulator "iPhone X"'
alias rniosxs='react-native run-ios --simulator "iPhone Xs"'
alias rniosxsm='react-native run-ios --simulator "iPhone Xs Max"'
alias rniosxr='react-native run-ios --simulator "iPhone Xʀ"'
alias rnios11='react-native run-ios --simulator "iPhone 11"'
alias rnios11p='react-native run-ios --simulator "iPhone 11 Pro"'
alias rnios11pm='react-native run-ios --simulator "iPhone 11 Pro Max"'
# iPad
alias rnipad2='react-native run-ios --simulator "iPad 2"'
alias rnipad5='react-native run-ios --simulator "iPad (5th generation)"'
alias rnipad6='react-native run-ios --simulator "iPad (6th generation)"'
alias rnipadr='react-native run-ios --simulator "iPad Retina"'
alias rnipada='react-native run-ios --simulator "iPad Air"'
alias rnipada2='react-native run-ios --simulator "iPad Air 2"'
alias rnipada3='react-native run-ios --simulator "iPad Air (3rd generation)"'
alias rnipadm2='react-native run-ios --simulator "iPad mini 2"'
alias rnipadm3='react-native run-ios --simulator "iPad mini 3"'
alias rnipadm4='react-native run-ios --simulator "iPad mini 4"'
alias rnipadm5='react-native run-ios --simulator "iPad mini (5th generation)"'
alias rnipadp9='react-native run-ios --simulator "iPad Pro (9.7-inch)"'
alias rnipadp12='react-native run-ios --simulator "iPad Pro (12.9-inch)"'
alias rnipadp122='react-native run-ios --simulator "iPad Pro (12.9-inch) (2nd generation)"'
alias rnipadp10='react-native run-ios --simulator "iPad Pro (10.5-inch)"'
alias rnipad11='react-native run-ios --simulator "iPad Pro (11-inch)"'
alias rnipad123='react-native run-ios --simulator "iPad Pro (12.9-inch) (3rd generation)"'
# Apple TV
alias rnatv='react-native run-ios --simulator "Apple TV"'
alias rnatv4k='react-native run-ios --simulator "Apple TV 4K"'
alias rnatv4k1080='react-native run-ios --simulator "Apple TV 4K (at 1080p)"'
# Apple Watch
alias rnaw38='react-native run-ios --simulator "Apple Watch - 38mm"'
alias rnaw42='react-native run-ios --simulator "Apple Watch - 42mm"'
alias rnaws238='react-native run-ios --simulator "Apple Watch Series 2 - 38mm"'
alias rnaws242='react-native run-ios --simulator "Apple Watch Series 2 - 42mm"'
alias rnaws338='react-native run-ios --simulator "Apple Watch Series 3 - 38mm"'
alias rnaws342='react-native run-ios --simulator "Apple Watch Series 3 - 42mm"'
alias rnaws440='react-native run-ios --simulator "Apple Watch Series 4 - 40mm"'
alias rnaws444='react-native run-ios --simulator "Apple Watch Series 4 - 44mm"'
# rebar plugin
This plugin adds completions for the [rebar](https://www.rebar3.org/) Erlang build tool.
To use it, add `rebar` to the plugins array in your zshrc file:
```zsh
plugins=(... rebar)
```
# Redis-CLI
This plugin adds [redis-cli](https://redis.io/topics/rediscli) completion, based off of Homebrew completion.
To use it, add `redis-cli` to the plugins array in your zshrc file:
```zsh
plugins=(... redis-cli)
```
## Requirements
In order to make this work, you will need to have redis installed.
More info on the usage and install: https://redis.io/topics/quickstart
...@@ -2,6 +2,6 @@ ...@@ -2,6 +2,6 @@
**Maintainer:** [Stibbons](https://github.com/Stibbons) **Maintainer:** [Stibbons](https://github.com/Stibbons)
This plugin mainly add support automatic completion for the repo command line tool: This plugin mainly add support automatic completion for the repo command line tool:
http://code.google.com/p/git-repo/ https://code.google.com/p/git-repo/
* `r` aliases `repo` * `r` aliases `repo`
# ripgrep
This plugin adds completion for the text search tool [`ripgrep`](https://github.com/BurntSushi/ripgrep), also known as `rg`.
To use it, add `ripgrep` to the plugins array in your zshrc file:
```zsh
plugins=(... ripgrep)
```
Completion is taken from the ripgrep release [`11.0.2`](https://github.com/BurntSushi/ripgrep/releases/tag/11.0.2).
Updated on August 16th, 2019.
#compdef rg
##
# zsh completion function for ripgrep
#
# Run ci/test_complete.sh after building to ensure that the options supported by
# this function stay in synch with the `rg` binary.
#
# For convenience, a completion reference guide is included at the bottom of
# this file.
#
# Originally based on code from the zsh-users project — see copyright notice
# below.
_rg() {
local curcontext=$curcontext no='!' descr ret=1
local -a context line state state_descr args tmp suf
local -A opt_args
# ripgrep has many options which negate the effect of a more common one — for
# example, `--no-column` to negate `--column`, and `--messages` to negate
# `--no-messages`. There are so many of these, and they're so infrequently
# used, that some users will probably find it irritating if they're completed
# indiscriminately, so let's not do that unless either the current prefix
# matches one of those negation options or the user has the `complete-all`
# style set. Note that this prefix check has to be updated manually to account
# for all of the potential negation options listed below!
if
# We also want to list all of these options during testing
[[ $_RG_COMPLETE_LIST_ARGS == (1|t*|y*) ]] ||
# (--[imnp]* => --ignore*, --messages, --no-*, --pcre2-unicode)
[[ $PREFIX$SUFFIX == --[imnp]* ]] ||
zstyle -t ":complete:$curcontext:*" complete-all
then
no=
fi
# We make heavy use of argument groups here to prevent the option specs from
# growing unwieldy. These aren't supported in zsh <5.4, though, so we'll strip
# them out below if necessary. This makes the exclusions inaccurate on those
# older versions, but oh well — it's not that big a deal
args=(
+ '(exclusive)' # Misc. fully exclusive options
'(: * -)'{-h,--help}'[display help information]'
'(: * -)'{-V,--version}'[display version information]'
'(: * -)'--pcre2-version'[print the version of PCRE2 used by ripgrep, if available]'
+ '(buffered)' # buffering options
'--line-buffered[force line buffering]'
$no"--no-line-buffered[don't force line buffering]"
'--block-buffered[force block buffering]'
$no"--no-block-buffered[don't force block buffering]"
+ '(case)' # Case-sensitivity options
{-i,--ignore-case}'[search case-insensitively]'
{-s,--case-sensitive}'[search case-sensitively]'
{-S,--smart-case}'[search case-insensitively if pattern is all lowercase]'
+ '(context-a)' # Context (after) options
'(context-c)'{-A+,--after-context=}'[specify lines to show after each match]:number of lines'
+ '(context-b)' # Context (before) options
'(context-c)'{-B+,--before-context=}'[specify lines to show before each match]:number of lines'
+ '(context-c)' # Context (combined) options
'(context-a context-b)'{-C+,--context=}'[specify lines to show before and after each match]:number of lines'
+ '(column)' # Column options
'--column[show column numbers for matches]'
$no"--no-column[don't show column numbers for matches]"
+ '(count)' # Counting options
{-c,--count}'[only show count of matching lines for each file]'
'--count-matches[only show count of individual matches for each file]'
+ '(encoding)' # Encoding options
{-E+,--encoding=}'[specify text encoding of files to search]: :_rg_encodings'
$no'--no-encoding[use default text encoding]'
+ file # File-input options
'(1)*'{-f+,--file=}'[specify file containing patterns to search for]: :_files'
+ '(file-match)' # Files with/without match options
'(stats)'{-l,--files-with-matches}'[only show names of files with matches]'
'(stats)--files-without-match[only show names of files without matches]'
+ '(file-name)' # File-name options
{-H,--with-filename}'[show file name for matches]'
{-I,--no-filename}"[don't show file name for matches]"
+ '(file-system)' # File system options
"--one-file-system[don't descend into directories on other file systems]"
$no'--no-one-file-system[descend into directories on other file systems]'
+ '(fixed)' # Fixed-string options
{-F,--fixed-strings}'[treat pattern as literal string instead of regular expression]'
$no"--no-fixed-strings[don't treat pattern as literal string]"
+ '(follow)' # Symlink-following options
{-L,--follow}'[follow symlinks]'
$no"--no-follow[don't follow symlinks]"
+ glob # File-glob options
'*'{-g+,--glob=}'[include/exclude files matching specified glob]:glob'
'*--iglob=[include/exclude files matching specified case-insensitive glob]:glob'
+ '(glob-case-insensitive)' # File-glob case sensitivity options
'--glob-case-insensitive[treat -g/--glob patterns case insensitively]'
$no'--no-glob-case-insensitive[treat -g/--glob patterns case sensitively]'
+ '(heading)' # Heading options
'(pretty-vimgrep)--heading[show matches grouped by file name]'
"(pretty-vimgrep)--no-heading[don't show matches grouped by file name]"
+ '(hidden)' # Hidden-file options
'--hidden[search hidden files and directories]'
$no"--no-hidden[don't search hidden files and directories]"
+ '(hybrid)' # hybrid regex options
'--auto-hybrid-regex[dynamically use PCRE2 if necessary]'
$no"--no-auto-hybrid-regex[don't dynamically use PCRE2 if necessary]"
+ '(ignore)' # Ignore-file options
"(--no-ignore-global --no-ignore-parent --no-ignore-vcs --no-ignore-dot)--no-ignore[don't respect ignore files]"
$no'(--ignore-global --ignore-parent --ignore-vcs --ignore-dot)--ignore[respect ignore files]'
+ '(ignore-file-case-insensitive)' # Ignore-file case sensitivity options
'--ignore-file-case-insensitive[process ignore files case insensitively]'
$no'--no-ignore-file-case-insensitive[process ignore files case sensitively]'
+ '(ignore-global)' # Global ignore-file options
"--no-ignore-global[don't respect global ignore files]"
$no'--ignore-global[respect global ignore files]'
+ '(ignore-parent)' # Parent ignore-file options
"--no-ignore-parent[don't respect ignore files in parent directories]"
$no'--ignore-parent[respect ignore files in parent directories]'
+ '(ignore-vcs)' # VCS ignore-file options
"--no-ignore-vcs[don't respect version control ignore files]"
$no'--ignore-vcs[respect version control ignore files]'
+ '(ignore-dot)' # .ignore-file options
"--no-ignore-dot[don't respect .ignore files]"
$no'--ignore-dot[respect .ignore files]'
+ '(json)' # JSON options
'--json[output results in JSON Lines format]'
$no"--no-json[don't output results in JSON Lines format]"
+ '(line-number)' # Line-number options
{-n,--line-number}'[show line numbers for matches]'
{-N,--no-line-number}"[don't show line numbers for matches]"
+ '(line-terminator)' # Line-terminator options
'--crlf[use CRLF as line terminator]'
$no"--no-crlf[don't use CRLF as line terminator]"
'(text)--null-data[use NUL as line terminator]'
+ '(max-columns-preview)' # max column preview options
'--max-columns-preview[show preview for long lines (with -M)]'
$no"--no-max-columns-preview[don't show preview for long lines (with -M)]"
+ '(max-depth)' # Directory-depth options
'--max-depth=[specify max number of directories to descend]:number of directories'
'!--maxdepth=:number of directories'
+ '(messages)' # Error-message options
'(--no-ignore-messages)--no-messages[suppress some error messages]'
$no"--messages[don't suppress error messages affected by --no-messages]"
+ '(messages-ignore)' # Ignore-error message options
"--no-ignore-messages[don't show ignore-file parse error messages]"
$no'--ignore-messages[show ignore-file parse error messages]'
+ '(mmap)' # mmap options
'--mmap[search using memory maps when possible]'
"--no-mmap[don't search using memory maps]"
+ '(multiline)' # Multiline options
{-U,--multiline}'[permit matching across multiple lines]'
$no'(multiline-dotall)--no-multiline[restrict matches to at most one line each]'
+ '(multiline-dotall)' # Multiline DOTALL options
'(--no-multiline)--multiline-dotall[allow "." to match newline (with -U)]'
$no"(--no-multiline)--no-multiline-dotall[don't allow \".\" to match newline (with -U)]"
+ '(only)' # Only-match options
{-o,--only-matching}'[show only matching part of each line]'
+ '(passthru)' # Pass-through options
'(--vimgrep)--passthru[show both matching and non-matching lines]'
'!(--vimgrep)--passthrough'
+ '(pcre2)' # PCRE2 options
{-P,--pcre2}'[enable matching with PCRE2]'
$no'(pcre2-unicode)--no-pcre2[disable matching with PCRE2]'
+ '(pcre2-unicode)' # PCRE2 Unicode options
$no'(--no-pcre2 --no-pcre2-unicode)--pcre2-unicode[enable PCRE2 Unicode mode (with -P)]'
'(--no-pcre2 --pcre2-unicode)--no-pcre2-unicode[disable PCRE2 Unicode mode (with -P)]'
+ '(pre)' # Preprocessing options
'(-z --search-zip)--pre=[specify preprocessor utility]:preprocessor utility:_command_names -e'
$no'--no-pre[disable preprocessor utility]'
+ pre-glob # Preprocessing glob options
'*--pre-glob[include/exclude files for preprocessing with --pre]'
+ '(pretty-vimgrep)' # Pretty/vimgrep display options
'(heading)'{-p,--pretty}'[alias for --color=always --heading -n]'
'(heading passthru)--vimgrep[show results in vim-compatible format]'
+ regexp # Explicit pattern options
'(1 file)*'{-e+,--regexp=}'[specify pattern]:pattern'
+ '(replace)' # Replacement options
{-r+,--replace=}'[specify string used to replace matches]:replace string'
+ '(sort)' # File-sorting options
'(threads)--sort=[sort results in ascending order (disables parallelism)]:sort method:((
none\:"no sorting"
path\:"sort by file path"
modified\:"sort by last modified time"
accessed\:"sort by last accessed time"
created\:"sort by creation time"
))'
'(threads)--sortr=[sort results in descending order (disables parallelism)]:sort method:((
none\:"no sorting"
path\:"sort by file path"
modified\:"sort by last modified time"
accessed\:"sort by last accessed time"
created\:"sort by creation time"
))'
'!(threads)--sort-files[sort results by file path (disables parallelism)]'
+ '(stats)' # Statistics options
'(--files file-match)--stats[show search statistics]'
$no"--no-stats[don't show search statistics]"
+ '(text)' # Binary-search options
{-a,--text}'[search binary files as if they were text]'
"--binary[search binary files, don't print binary data]"
$no"--no-binary[don't search binary files]"
$no"(--null-data)--no-text[don't search binary files as if they were text]"
+ '(threads)' # Thread-count options
'(sort)'{-j+,--threads=}'[specify approximate number of threads to use]:number of threads'
+ '(trim)' # Trim options
'--trim[trim any ASCII whitespace prefix from each line]'
$no"--no-trim[don't trim ASCII whitespace prefix from each line]"
+ type # Type options
'*'{-t+,--type=}'[only search files matching specified type]: :_rg_types'
'*--type-add=[add new glob for specified file type]: :->typespec'
'*--type-clear=[clear globs previously defined for specified file type]: :_rg_types'
# This should actually be exclusive with everything but other type options
'(: *)--type-list[show all supported file types and their associated globs]'
'*'{-T+,--type-not=}"[don't search files matching specified file type]: :_rg_types"
+ '(word-line)' # Whole-word/line match options
{-w,--word-regexp}'[only show matches surrounded by word boundaries]'
{-x,--line-regexp}'[only show matches surrounded by line boundaries]'
+ '(zip)' # Compression options
'(--pre)'{-z,--search-zip}'[search in compressed files]'
$no"--no-search-zip[don't search in compressed files]"
+ misc # Other options — no need to separate these at the moment
'(-b --byte-offset)'{-b,--byte-offset}'[show 0-based byte offset for each matching line]'
'--color=[specify when to use colors in output]:when:((
never\:"never use colors"
auto\:"use colors or not based on stdout, TERM, etc."
always\:"always use colors"
ansi\:"always use ANSI colors (even on Windows)"
))'
'*--colors=[specify color and style settings]: :->colorspec'
'--context-separator=[specify string used to separate non-continuous context lines in output]:separator'
'--debug[show debug messages]'
'--dfa-size-limit=[specify upper size limit of generated DFA]:DFA size (bytes)'
"(1 stats)--files[show each file that would be searched (but don't search)]"
'*--ignore-file=[specify additional ignore file]:ignore file:_files'
'(-v --invert-match)'{-v,--invert-match}'[invert matching]'
'(-M --max-columns)'{-M+,--max-columns=}'[specify max length of lines to print]:number of bytes'
'(-m --max-count)'{-m+,--max-count=}'[specify max number of matches per file]:number of matches'
'--max-filesize=[specify size above which files should be ignored]:file size (bytes)'
"--no-config[don't load configuration files]"
'(-0 --null)'{-0,--null}'[print NUL byte after file names]'
'--path-separator=[specify path separator to use when printing file names]:separator'
'(-q --quiet)'{-q,--quiet}'[suppress normal output]'
'--regex-size-limit=[specify upper size limit of compiled regex]:regex size (bytes)'
'*'{-u,--unrestricted}'[reduce level of "smart" searching]'
+ operand # Operands
'(--files --type-list file regexp)1: :_guard "^-*" pattern'
'(--type-list)*: :_files'
)
# This is used with test_complete.sh to verify that there are no options
# listed in the help output that aren't also defined here
[[ $_RG_COMPLETE_LIST_ARGS == (1|t*|y*) ]] && {
print -rl - $args
return 0
}
# Strip out argument groups where unsupported (see above)
[[ $ZSH_VERSION == (4|5.<0-3>)(.*)# ]] &&
args=( ${(@)args:#(#i)(+|[a-z0-9][a-z0-9_-]#|\([a-z0-9][a-z0-9_-]#\))} )
_arguments -C -s -S : $args && ret=0
case $state in
colorspec)
if [[ ${IPREFIX#--*=}$PREFIX == [^:]# ]]; then
suf=( -qS: )
tmp=(
'column:specify coloring for column numbers'
'line:specify coloring for line numbers'
'match:specify coloring for match text'
'path:specify coloring for file names'
)
descr='color/style type'
elif [[ ${IPREFIX#--*=}$PREFIX == (column|line|match|path):[^:]# ]]; then
suf=( -qS: )
tmp=(
'none:clear color/style for type'
'bg:specify background color'
'fg:specify foreground color'
'style:specify text style'
)
descr='color/style attribute'
elif [[ ${IPREFIX#--*=}$PREFIX == [^:]##:(bg|fg):[^:]# ]]; then
tmp=( black blue green red cyan magenta yellow white )
descr='color name or r,g,b'
elif [[ ${IPREFIX#--*=}$PREFIX == [^:]##:style:[^:]# ]]; then
tmp=( {,no}bold {,no}intense {,no}underline )
descr='style name'
else
_message -e colorspec 'no more arguments'
fi
(( $#tmp )) && {
compset -P '*:'
_describe -t colorspec $descr tmp $suf && ret=0
}
;;
typespec)
if compset -P '[^:]##:include:'; then
_sequence -s , _rg_types && ret=0
# @todo This bit in particular could be better, but it's a little
# complex, and attempting to solve it seems to run us up against a crash
# bug — zsh # 40362
elif compset -P '[^:]##:'; then
_message 'glob or include directive' && ret=1
elif [[ ! -prefix *:* ]]; then
_rg_types -qS : && ret=0
fi
;;
esac
return ret
}
# Complete encodings
_rg_encodings() {
local -a expl
local -aU _encodings
# This is impossible to read, but these encodings rarely if ever change, so it
# probably doesn't matter. They are derived from the list given here:
# https://encoding.spec.whatwg.org/#concept-encoding-get
_encodings=(
{{,us-}ascii,arabic,chinese,cyrillic,greek{,8},hebrew,korean}
logical visual mac {,cs}macintosh x-mac-{cyrillic,roman,ukrainian}
866 ibm{819,866} csibm866
big5{,-hkscs} {cn-,cs}big5 x-x-big5
cp{819,866,125{0..8}} x-cp125{0..8}
csiso2022{jp,kr} csiso8859{6,8}{e,i}
csisolatin{{1..6},9} csisolatin{arabic,cyrillic,greek,hebrew}
ecma-{114,118} asmo-708 elot_928 sun_eu_greek
euc-{jp,kr} x-euc-jp cseuckr cseucpkdfmtjapanese
{,x-}gbk csiso58gb231280 gb18030 {,cs}gb2312 gb_2312{,-80} hz-gb-2312
iso-2022-{cn,cn-ext,jp,kr}
iso8859{,-}{{1..11},13,14,15}
iso-8859-{{1..11},{6,8}-{e,i},13,14,15,16} iso_8859-{{1..9},15}
iso_8859-{1,2,6,7}:1987 iso_8859-{3,4,5,8}:1988 iso_8859-9:1989
iso-ir-{58,100,101,109,110,126,127,138,144,148,149,157}
koi{,8,8-r,8-ru,8-u,8_r} cskoi8r
ks_c_5601-{1987,1989} ksc{,_}5691 csksc56011987
latin{1..6} l{{1..6},9}
shift{-,_}jis csshiftjis {,x-}sjis ms_kanji ms932
utf{,-}8 utf-16{,be,le} unicode-1-1-utf-8
windows-{31j,874,949,125{0..8}} dos-874 tis-620 ansi_x3.4-1968
x-user-defined auto none
)
_wanted encodings expl encoding compadd -a "$@" - _encodings
}
# Complete file types
_rg_types() {
local -a expl
local -aU _types
_types=( ${(@)${(f)"$( _call_program types rg --type-list )"}%%:*} )
_wanted types expl 'file type' compadd -a "$@" - _types
}
_rg "$@"
################################################################################
# ZSH COMPLETION REFERENCE
#
# For the convenience of developers who aren't especially familiar with zsh
# completion functions, a brief reference guide follows. This is in no way
# comprehensive; it covers just enough of the basic structure, syntax, and
# conventions to help someone make simple changes like adding new options. For
# more complete documentation regarding zsh completion functions, please see the
# following:
#
# * http://zsh.sourceforge.net/Doc/Release/Completion-System.html
# * https://github.com/zsh-users/zsh/blob/master/Etc/completion-style-guide
#
# OVERVIEW
#
# Most zsh completion functions are defined in terms of `_arguments`, which is a
# shell function that takes a series of argument specifications. The specs for
# `rg` are stored in an array, which is common for more complex functions; the
# elements of the array are passed to `_arguments` on invocation.
#
# ARGUMENT-SPECIFICATION SYNTAX
#
# The following is a contrived example of the argument specs for a simple tool:
#
# '(: * -)'{-h,--help}'[display help information]'
# '(-q -v --quiet --verbose)'{-q,--quiet}'[decrease output verbosity]'
# '!(-q -v --quiet --verbose)--silent'
# '(-q -v --quiet --verbose)'{-v,--verbose}'[increase output verbosity]'
# '--color=[specify when to use colors]:when:(always never auto)'
# '*:example file:_files'
#
# Although there may appear to be six specs here, there are actually nine; we
# use brace expansion to combine specs for options that go by multiple names,
# like `-q` and `--quiet`. This is customary, and ties in with the fact that zsh
# merges completion possibilities together when they have the same description.
#
# The first line defines the option `-h`/`--help`. With most tools, it isn't
# useful to complete anything after `--help` because it effectively overrides
# all others; the `(: * -)` at the beginning of the spec tells zsh not to
# complete any other operands (`:` and `*`) or options (`-`) after this one has
# been used. The `[...]` at the end associates a description with `-h`/`--help`;
# as mentioned, zsh will see the identical descriptions and merge these options
# together when offering completion possibilities.
#
# The next line defines `-q`/`--quiet`. Here we don't want to suppress further
# completions entirely, but we don't want to offer `-q` if `--quiet` has been
# given (since they do the same thing), nor do we want to offer `-v` (since it
# doesn't make sense to be quiet and verbose at the same time). We don't need to
# tell zsh not to offer `--quiet` a second time, since that's the default
# behaviour, but since this line expands to two specs describing `-q` *and*
# `--quiet` we do need to explicitly list all of them here.
#
# The next line defines a hidden option `--silent` — maybe it's a deprecated
# synonym for `--quiet`. The leading `!` indicates that zsh shouldn't offer this
# option during completion. The benefit of providing a spec for an option that
# shouldn't be completed is that, if someone *does* use it, we can correctly
# suppress completion of other options afterwards.
#
# The next line defines `-v`/`--verbose`; this works just like `-q`/`--quiet`.
#
# The next line defines `--color`. In this example, `--color` doesn't have a
# corresponding short option, so we don't need to use brace expansion. Further,
# there are no other options it's exclusive with (just itself), so we don't need
# to define those at the beginning. However, it does take a mandatory argument.
# The `=` at the end of `--color=` indicates that the argument may appear either
# like `--color always` or like `--color=always`; this is how most GNU-style
# command-line tools work. The corresponding short option would normally use `+`
# — for example, `-c+` would allow either `-c always` or `-calways`. For this
# option, the arguments are known ahead of time, so we can simply list them in
# parentheses at the end (`when` is used as the description for the argument).
#
# The last line defines an operand (a non-option argument). In this example, the
# operand can be used any number of times (the leading `*`), and it should be a
# file path, so we tell zsh to call the `_files` function to complete it. The
# `example file` in the middle is the description to use for this operand; we
# could use a space instead to accept the default provided by `_files`.
#
# GROUPING ARGUMENT SPECIFICATIONS
#
# Newer versions of zsh support grouping argument specs together. All specs
# following a `+` and then a group name are considered to be members of the
# named group. Grouping is useful mostly for organisational purposes; it makes
# the relationship between different options more obvious, and makes it easier
# to specify exclusions.
#
# We could rewrite our example above using grouping as follows:
#
# '(: * -)'{-h,--help}'[display help information]'
# '--color=[specify when to use colors]:when:(always never auto)'
# '*:example file:_files'
# + '(verbosity)'
# {-q,--quiet}'[decrease output verbosity]'
# '!--silent'
# {-v,--verbose}'[increase output verbosity]'
#
# Here we take advantage of a useful feature of spec grouping — when the group
# name is surrounded by parentheses, as in `(verbosity)`, it tells zsh that all
# of the options in that group are exclusive with each other. As a result, we
# don't need to manually list out the exclusions at the beginning of each
# option.
#
# Groups can also be referred to by name in other argument specs; for example:
#
# '(xyz)--aaa' '*: :_files'
# + xyz --xxx --yyy --zzz
#
# Here we use the group name `xyz` to tell zsh that `--xxx`, `--yyy`, and
# `--zzz` are not to be completed after `--aaa`. This makes the exclusion list
# much more compact and reusable.
#
# CONVENTIONS
#
# zsh completion functions generally adhere to the following conventions:
#
# * Use two spaces for indentation
# * Combine specs for options with different names using brace expansion
# * In combined specs, list the short option first (as in `{-a,--text}`)
# * Use `+` or `=` as described above for options that take arguments
# * Provide a description for all options, option-arguments, and operands
# * Capitalise/punctuate argument descriptions as phrases, not complete
# sentences — 'display help information', never 'Display help information.'
# (but still capitalise acronyms and proper names)
# * Write argument descriptions as verb phrases — 'display x', 'enable y',
# 'use z'
# * Word descriptions to make it clear when an option expects an argument;
# usually this is done with the word 'specify', as in 'specify x' or
# 'use specified x')
# * Write argument descriptions as tersely as possible — for example, articles
# like 'a' and 'the' should be omitted unless it would be confusing
#
# Other conventions currently used by this function:
#
# * Order argument specs alphabetically by group name, then option name
# * Group options that are directly related, mutually exclusive, or frequently
# referenced by other argument specs
# * Use only characters in the set [a-z0-9_-] in group names
# * Order exclusion lists as follows: short options, long options, groups
# * Use American English in descriptions
# * Use 'don't' in descriptions instead of 'do not'
# * Word descriptions for related options as similarly as possible. For example,
# `--foo[enable foo]` and `--no-foo[disable foo]`, or `--foo[use foo]` and
# `--no-foo[don't use foo]`
# * Word descriptions to make it clear when an option only makes sense with
# another option, usually by adding '(with -x)' to the end
# * Don't quote strings or variables unnecessarily. When quotes are required,
# prefer single-quotes to double-quotes
# * Prefix option specs with `$no` when the option serves only to negate the
# behaviour of another option that must be provided explicitly by the user.
# This prevents rarely used options from cluttering up the completion menu
################################################################################
# ------------------------------------------------------------------------------
# Copyright (c) 2011 Github zsh-users - http://github.com/zsh-users
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the zsh-users nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL ZSH-USERS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# ------------------------------------------------------------------------------
# Description
# -----------
#
# Completion script for ripgrep
#
# ------------------------------------------------------------------------------
# Authors
# -------
#
# * arcizan <ghostrevery@gmail.com>
# * MaskRay <i@maskray.me>
#
# ------------------------------------------------------------------------------
# Local Variables:
# mode: shell-script
# coding: utf-8-unix
# indent-tabs-mode: nil
# sh-indentation: 2
# sh-basic-offset: 2
# End:
# vim: ft=zsh sw=2 ts=2 et
# Roswell Plugin
This plugin adds completions and aliases for [Roswell](https://github.com/roswell/roswell/).
To use it, add `ros` to the plugins array in your zshrc file:
```zsh
plugins=(... ros)
```
#compdef ros
#autoload
# roswell zsh completion, based on gem completion
local -a _1st_arguments
_1st_arguments=(
'run: Run repl'
'install:Install a given implementation or a system for roswell environment'
'update:Update installed systems.'
'build:Make executable from script.'
'use:Change default implementation.'
'init:a new ros script, optionally based on a template.'
'fmt:Indent lisp source.'
'list:Information'
'template:[WIP] Manage templates'
'delete:Delete installed implementations'
'config:Get and set options'
'version:Show the roswell version information'
"help:Use \"ros help [command]\" for more information about a command."$'\n\t\t'"Use \"ros help [topic]\" for more information about the topic."
)
#local expl
_arguments \
'(--version)'--version'[Print version information and quit]' \
'(-w --wrap)'{-w,--wrap}'[\[CODE\] Run roswell with a shell wrapper CODE]' \
'(-m --image)'{-m,--image}'[\[IMAGE\] continue from Lisp image IMAGE]' \
'(-M --module)'{-M,--module}'[\[NAME\] Execute ros script found in ROSWELLPATH. (pythons -m)]' \
'(-L --lisp)'{-L,--lisp}'[\[NAME\] Run roswell with a lisp impl NAME\[/VERSION\].]' \
'(-l --load)'{-l,--load}'[\[FILE\] load lisp FILE while building]' \
'(-S --source-registry)'{-S,--source-registry}'[\[X\] override source registry of asdf systems]' \
'(-s --system --load-system)'{-s,--system,--load-system}'[\[SYSTEM\] load asdf SYSTEM while building]' \
'(-p --package)'{-p,--package}'[\[PACKAGE\] change current package to \[PACKAGE\]]' \
'(-sp --system-package)'{-sp,--system-package}'[\[SP\] combination of -s \[SP\] and -p \[SP\]]' \
'(-e --eval)'{-e,--eval}'[\[FORM\] evaluate \[FORM\] while building]' \
'--require'--require'[\[MODULE\] require \[MODULE\] while building]' \
'(-q --quit)'{-q,--quit}'[quit lisp here]' \
'(-r --restart)'{-r,--restart}'[\[FUNC\] restart from build by calling (\[FUNC\])]' \
'(-E --entry)'{-E,--entry}'[\[FUNC\] restart from build by calling (\[FUNC\] argv)]' \
'(-i --init)'{-i,--init}'[\[FORM\] evaluate \[FORM\] after restart]' \
'(-ip --print)'{-ip,--print}'[\[FORM\] evaluate and princ \[FORM\] after restart]' \
'(-iw --write)'{-iw,--write}'[\[FORM\] evaluate and write \[FORM\] after restart]' \
'(-F --final)'{-F,--final}'[\[FORM\] evaluate \[FORM\] before dumping IMAGE]' \
'(\+R --no-rc)'{\+R,--no-rc}'[skip /etc/rosrc, ~/.roswell/init.lisp]' \
'(-A --asdf)'{-A,--asdf}'[use new asdf]' \
'(\+Q --no-quicklisp)'{\+Q,--no-quicklisp}'[do not use quicklisp]' \
'(-v --verbose)'{-v,--verbose}'[be quite noisy while building]' \
'--quiet'--quiet'[be quite quiet while building default]' \
'--test'--test'[for test purpose]' \
'*:: :->subcmds' && return 0
if (( CURRENT == 1 )); then
_describe -t commands "ros subcommand" _1st_arguments
return
fi
# _files
case "$words[1]" in
-l|--load)
_files
;;
esac
# rsync
This plugin adds aliases for frequent [rsync](https://rsync.samba.org/) commands.
To use it add `rsync` to the plugins array in you zshrc file.
```zsh
plugins=(... rsync)
```
| Alias | Command |
| ------------------- | ------------------------------------------------ |
| *rsync-copy* | `rsync -avz --progress -h` |
| *rsync-move* | `rsync -avz --progress -h --remove-source-files` |
| *rsync-update* | `rsync -avzu --progress -h` |
| *rsync-synchronize* | `rsync -avzu --delete --progress -h` |
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment