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

Merge branch 'master' into master

parents afb02876 ebc700be
......@@ -2,7 +2,8 @@
- adds completion for basic bundler commands
- adds short aliases for common bundler commands
- `be` aliased to `bundle exec`
- `be` aliased to `bundle exec`.
It also supports aliases (if `rs` is `rails server`, `be rs` will bundle-exec `rails server`).
- `bl` aliased to `bundle list`
- `bp` aliased to `bundle package`
- `bo` aliased to `bundle open`
......@@ -13,7 +14,8 @@
- looks for a binstub under `./bin/` and executes it (if present)
- calls `bundle exec <gem executable>` otherwise
For a full list of *common gems* being wrapped by default please look at the `bundler.plugin.zsh` file.
Common gems wrapped by default (by name of the executable):
`annotate`, `cap`, `capify`, `cucumber`, `foodcritic`, `guard`, `hanami`, `irb`, `jekyll`, `kitchen`, `knife`, `middleman`, `nanoc`, `pry`, `puma`, `rackup`, `rainbows`, `rake`, `rspec`, `shotgun`, `sidekiq`, `spec`, `spork`, `spring`, `strainer`, `tailor`, `taps`, `thin`, `thor`, `unicorn` and `unicorn_rails`.
## Configuration
......
......@@ -54,10 +54,14 @@ done
## Functions
bundle_install() {
if _bundler-installed && _within-bundled-project; then
if ! _bundler-installed; then
echo "Bundler is not installed"
elif ! _within-bundled-project; then
echo "Can't 'bundle install' outside a bundled project"
else
local bundler_version=`bundle version | cut -d' ' -f3`
if [[ $bundler_version > '1.4.0' || $bundler_version = '1.4.0' ]]; then
if [[ "$OSTYPE" = darwin* ]]
if [[ "$OSTYPE" = (darwin|freebsd)* ]]
then
local cores_num="$(sysctl -n hw.ncpu)"
else
......@@ -67,8 +71,6 @@ bundle_install() {
else
bundle install $@
fi
else
echo "Can't 'bundle install' outside a bundled project"
fi
}
......
# Bwana
This plugin provides a function to open `man` pages directly with [Bwana](https://www.bruji.com/bwana/).
To use it add bwana to the plugins array in your zshrc file.
```bash
plugins=(... bwana)
```
The `bwana` function opens the man page of the passed argument in the Bwana app.
For example: `bwana ln` opens the man page for `ln` in Bwana.
#
# Requires http://www.bruji.com/bwana/
# Requires https://www.bruji.com/bwana/
#
if [[ -e /Applications/Bwana.app ]] ||
( system_profiler -detailLevel mini SPApplicationsDataType | grep -q Bwana )
then
function man() {
function bwana() {
open "man:$1"
}
else
echo "Bwana lets you read man files in Safari through a man: URI scheme"
echo "To use it within Zsh, install it from http://www.bruji.com/bwana/"
echo "To use it within Zsh, install it from https://www.bruji.com/bwana/"
fi
# Cabal
This plugin provides completion for [Cabal](https://www.haskell.org/cabal/), a build tool for Haskell. It
also provides a function `cabal_sandbox_info` that prints whether the current working directory is in a sandbox.
To use it, add cabal to the plugins array of your zshrc file:
```
plugins=(... cabal)
```
# Cake
This plugin provides completion for [CakePHP](https://cakephp.org/).
To use it add cake to the plugins array in your zshrc file.
```bash
plugins=(... cake)
```
## Note
This plugin generates a cache file of the cake tasks found, named `.cake_task_cache`, in the current working directory.
It is regenerated when the Cakefile is newer than the cache file. It is advised that you add the cake file to your
`.gitignore` files.
# Capistrano
This plugin provides completion for [Capistrano](https://capistranorb.com/).
To use it add capistrano to the plugins array in your zshrc file.
```bash
plugins=(... capistrano)
```
For a working completion use the `capit` command instead of `cap`, because cap is a
[reserved word in zsh](http://zsh.sourceforge.net/Doc/Release/Zsh-Modules.html#The-zsh_002fcap-Module).
`capit` automatically runs cap with bundler if a Gemfile is found.
# Added `shipit` because `cap` is a reserved word. `cap` completion doesn't work.
# Added `capit` because `cap` is a reserved word. `cap` completion doesn't work.
# http://zsh.sourceforge.net/Doc/Release/Zsh-Modules.html#The-zsh_002fcap-Module
func capit() {
function capit() {
if [ -f Gemfile ]
then
bundle exec cap $*
......
# cargo
This plugin adds completion for the Rust build tool [`cargo`](https://github.com/rust-lang/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:
......@@ -8,4 +8,4 @@ To use it, add `cargo` to the plugins array in your zshrc file:
plugins=(... cargo)
```
Updated on October 4th, 2016.
Updated on March 3rd, 2019, from [Cargo 0.34.0](https://github.com/rust-lang/cargo/releases/tag/0.34.0).
#compdef cargo
typeset -A opt_args
autoload -U regexp-replace
zstyle -T ':completion:*:*:cargo:*' tag-order && \
zstyle ':completion:*:*:cargo:*' tag-order 'common-commands'
_cargo() {
local context state state_descr line
typeset -A opt_args
# leading items in parentheses are an exclusion list for the arguments following that arg
# See: http://zsh.sourceforge.net/Doc/Release/Completion-System.html#Completion-Functions
# - => exclude all other options
# 1 => exclude positional arg 1
# * => exclude all other args
# +blah => exclude +blah
_arguments \
'(- 1 *)'{-h,--help}'[show help message]' \
'(- 1 *)--list[list installed commands]' \
'(- 1 *)'{-V,--version}'[show version information]' \
'(- 1 *)'--list'[list installed commands]' \
'(- 1 *)'--explain'[Run `rustc --explain CODE`]' \
'(- 1 *)'{-v,--verbose}'[use verbose output]' \
'(- 1 *)'--color'[colorization option]' \
'(- 1 *)'--frozen'[Require Cargo.lock and cache are up to date]' \
'(- 1 *)'--locked'[Require Cargo.lock is up to date]' \
'1: :_cargo_cmds' \
{-v,--verbose}'[use verbose output]' \
--color'[colorization option]' \
'(+beta +nightly)+stable[use the stable toolchain]' \
'(+stable +nightly)+beta[use the beta toolchain]' \
'(+stable +beta)+nightly[use the nightly toolchain]' \
'1: :->command' \
'*:: :->args'
case $state in
command)
_alternative 'common-commands:common:_cargo_cmds' 'all-commands:all:_cargo_all_cmds'
;;
args)
case $words[1] in
bench)
......@@ -54,6 +68,23 @@ case $state in
'--color=:colorization option:(auto always never)' \
;;
check)
_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 check the default features]' \
'(-p,--package)'{-p=,--package=}'[package to check]:packages:_get_package_names' \
'--release=[check 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]' \
......@@ -105,7 +136,7 @@ case $state in
git-checkout)
_arguments \
'(-h, --help)'{-h,--help}'[show help message]' \
'q(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
'--reference=[REF]' \
'--url=[URL]' \
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
......@@ -142,10 +173,10 @@ case $state in
'(-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]' \
'--path=[local filesystem path to crate to install]: :_files -/' \
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
'--rev=[specific commit to use when installing from git]' \
'--root=[directory to install packages into]' \
'--root=[directory to install packages into]: :_files -/' \
'--tag=[tag to use when installing from git]' \
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
'--vers=[version to install from crates.io]' \
......@@ -270,7 +301,7 @@ case $state in
'--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]' \
'--manifest-path=[path to the manifest to fetch dependencies for]: :_files -/' \
'--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]' \
......@@ -288,7 +319,7 @@ case $state in
'--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]' \
'--manifest-path=[path to the manifest to document]: :_files -/' \
'--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]' \
......@@ -327,6 +358,15 @@ case $state in
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
'--color=:colorization option:(auto always never)' \
'1: :_test_names' \
'(--doc --bin --example --test --bench)--lib[only test library]' \
'(--lib --bin --example --test --bench)--doc[only test documentation]' \
'(--lib --doc --example --test --bench)--bin=[binary name]' \
'(--lib --doc --bin --test --bench)--example=[example name]' \
'(--lib --doc --bin --example --bench)--test=[test name]' \
'(--lib --doc --bin --example --test)--bench=[benchmark name]' \
'--message-format:error format:(human json short)' \
'--frozen[require lock and cache up to date]' \
'--locked[require lock up to date]'
;;
uninstall)
......@@ -335,7 +375,7 @@ case $state in
'--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]' \
'--root=[directory to uninstall packages from]: :_files -/' \
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
;;
......@@ -386,19 +426,20 @@ esac
_cargo_cmds(){
local -a commands;commands=(
'bench:execute all benchmarks of a local package'
'build:compile the current project'
'build:compile the current package'
'check:check the current package without compiling'
'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'
'init:create new package 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'
'metadata:the metadata for a package in json'
'new:create a new package'
'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'
......@@ -415,8 +456,12 @@ local -a commands;commands=(
'version:show version information'
'yank:remove pushed file from index'
)
_describe 'command' commands
_describe -t common-commands 'common commands' commands
}
_cargo_all_cmds(){
local -a commands;commands=($(cargo --list))
_describe -t all-commands 'all commands' commands
}
......@@ -484,7 +529,7 @@ _benchmark_names()
_get_names_from_array "bench"
}
# These flags are mutally exclusive specifiers for the scope of a command; as
# These flags are mutually 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
......@@ -496,5 +541,4 @@ command_scope_spec=(
'(--bench --bin --example --lib)--test=[test name]'
)
_cargo
# catimg
Plugin for displaying images on the terminal using the the `catimg.sh` script provided by [posva](https://github.com/posva/catimg)
## Requirements
- `convert` (ImageMagick)
## Enabling the plugin
1. Open your `.zshrc` file and add `catimg` in the plugins section:
```zsh
plugins=(
# all your enabled plugins
catimg
)
```
2. Reload the source file or restart your Terminal session:
```console
$ source ~/.zshrc
$
```
## Functions
| Function | Description |
| -------- | ---------------------------------------- |
| `catimg` | Displays the given image on the terminal |
## Usage examples
[![asciicast](https://asciinema.org/a/204702.png)](https://asciinema.org/a/204702)
################################################################################
# catimg script by Eduardo San Martin Morote aka Posva #
# http://posva.net #
# https://posva.net #
# #
# Ouput the content of an image to the stdout using the 256 colors of the #
# terminal. #
# Github: https://github.com/posva/catimg #
# GitHub: https://github.com/posva/catimg #
################################################################################
......
################################################################################
# catimg script by Eduardo San Martin Morote aka Posva #
# http://posva.net #
# https://posva.net #
# #
# Ouput the content of an image to the stdout using the 256 colors of the #
# terminal. #
# Github: https://github.com/posva/catimg #
# GitHub: https://github.com/posva/catimg #
################################################################################
function help() {
......
# Celery
This plugin provides completion for [Celery](http://www.celeryproject.org/).
To use it add celery to the plugins array in your zshrc file.
```bash
plugins=(... celery)
```
......@@ -111,5 +111,11 @@ function chruby_prompt_info() {
}
# complete on installed rubies
_chruby() { compadd $(chruby | tr -d '* ') }
_chruby() {
compadd $(chruby | tr -d '* ')
local default_path='/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin'
if PATH=${default_path} type ruby &> /dev/null; then
compadd system
fi
}
compdef _chruby chruby
License: GPL v2
Thanks to http://www.k-lug.org/~kessler/projects.html for the fortune file.
# chucknorris
Chuck Norris fortunes plugin for oh-my-zsh
**Maintainers**: [apjanke](https://github.com/apjanke) [maff](https://github.com/maff)
To use it add `chucknorris` to the plugins array in you zshrc file.
```zsh
plugins=(... chucknorris)
```
Depends on fortune (and cowsay if using chuck_cow) being installed (available via homebrew, apt, ...). Perfectly suitable as MOTD.
| Command | Description |
| ----------- | ------------------------------- |
| `chuck` | Print random Chuck Norris quote |
| `chuck_cow` | Print quote in cowthink |
This diff is collapsed.
#!/bin/zsh
alias cloudapp=$ZSH/plugins/cloudapp/cloudapp.rb
alias cloudapp="${0:a:h}/cloudapp.rb"
# Ensure only the owner can access the credentials file
if [[ -f ~/.cloudapp ]]; then
chmod 600 ~/.cloudapp
fi
# Cloudfoundry Plugin
This plugin is intended to offer a few simple aliases for regular users of the [Cloud Foundry Cli][1]. Most are just simple aliases that will save a bit of typing. Others include mini functions and or accept parameters. Take a look at the table below for details.
| Alias | Command | Description |
|----------|-----------------------------|--------------------------------------------------------------------------|
| cfl | `cf login` | Login to Cloud Foundry |
| cft | `cf target` | Target the cli at a specific Org/Space in Cloud Foundry |
| cfa | `cf apps` | List all applications in the current Org/Space |
| cfs | `cf services` | List all services in the current Org/Space |
| cfm | `cf marketplace` | List the services available in the Marketplace |
| cfp | `cf push` | Push your application code to Cloud Foundry |
| cfcs | `cf create-service` | Create a service based on a Marketplace offering |
| cfbs | `cf bind-service` | Bind an application to a service you created |
| cfus | `cf unbind-service` | Unbind a service from an application |
| cfds | `cf delete-service` | Delete a service you no longer have bound |
| cfup | `cf cups` | Create a "user-provided-service" |
| cflg | `cf logs` | Tail the logs of an application (requires <APP_NAME>) |
| cfr | `cf routes` | List all the routes in the current Space |
| cfe | `cf env` | Show the environment variables for an application (requires <APP_NAME>) |
| cfsh | `cf ssh` | Attach to a running container (requires an <APP_NAME> etc.) |
| cfsc | `cf scale` | Scale an application (requires an <APP_NAME> etc.) |
| cfev | `cf events` | Show the application events (requires <APP_NAME>) |
| cfdor | `cf delete-orphaned-routes` | Delete routes that are no longer bound to applications |
| cfbpk | `cf buildpacks` | List the available buildpacks |
| cfdm | `cf domains` | List the domains associates with this Cloud Foundry foundation |
| cfsp | `cf spaces` | List all the Spaces in the current Org |
| cfap | `cf app` | Show the details of a deployed application (requires <APP_NAME>) |
| cfh. | `export CF_HOME=$PWD/.cf` | Set the current directory as CF_HOME |
| cfh~ | `export CF_HOME=~/.cf` | Set the user's root directory as CF_HOME |
| cfhu | `unset CF_HOME` | Unsets CF_HOME |
| cfpm | `cf push -f` | Push an application using a manifest (requires <MANIFEST_FILE> location) |
| cflr | `cf logs --recent` | Show the recent logs (requires <APP_NAME>) |
| cfsrt | `cf start` | Start an application (requires <APP_NAME>) |
| cfstp | `cf stop` | Stop an application (requires <APP_NAME>) |
| cfstg | `cf restage` | Restage an application (requires <APP_NAME>) |
| cfdel | `cf delete` | Delete an application (requires <APP_NAME>) |
| cfsrtall | - | Start all apps that are currently in the "Stopped" state |
| cfstpall | - | Stop all apps that are currently in the "Started" state |
For help and advice on what any of the commands does, consult the built in `cf` help functions as follows:-
```bash
cf help # List the most popular and commonly used commands
cf help -a # Complete list of all possible commands
cf <COMMAND_NAME> --help # Help on a specific command including arguments and examples
```
Alternatively, seek out the [online documentation][3]. And don't forget, there are loads of great [community plugins for the cf-cli][4] command line tool that can greatly extend its power and usefulness.
## Contributors
Contributed to `oh_my_zsh` by [benwilcock][2].
[1]: https://docs.cloudfoundry.org/cf-cli/install-go-cli.html
[2]: https://github.com/benwilcock
[3]: https://docs.cloudfoundry.org/cf-cli/getting-started.html
[4]: https://plugins.cloudfoundry.org/
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