abra zsh config 2.0

This commit is contained in:
Andrey Anurin
2018-08-12 15:26:21 +03:00
parent 201abd09c4
commit 6b114440e2
1195 changed files with 68948 additions and 10539 deletions

View File

@@ -3,7 +3,9 @@ Modules
Load modules in *zpreztorc*. The order matters.
zstyle ':prezto:load' pmodule 'environment' 'terminal'
```sh
zstyle ':prezto:load' pmodule 'environment' 'terminal'
```
Archive
-------
@@ -18,7 +20,7 @@ Integrates zsh-autosuggestions into Prezto.
Command-Not-Found
-----------------
Loads the command-not-found tool on Debian-based distributions.
Loads the command-not-found tool on macOS or Debian-based distributions.
Completion
----------
@@ -120,7 +122,7 @@ Initializes OCaml package management.
OSX
---
Defines Mac OS X aliases and functions.
Defines macOS aliases and functions.
Pacman
------
@@ -130,7 +132,7 @@ Provides aliases and functions for the Pacman package manager and frontends.
Perl
----
Enables local Perl module installation on Mac OS X and defines alises.
Enables local Perl module installation on macOS and defines alises.
Prompt
------

View File

@@ -1,11 +1,12 @@
Archive
=======
Provides functions to list and extract archives.
Provides functions to create, list, and extract archives.
Functions
---------
- `archive` creates an archive based on the provided archive name.
- `lsarchive` lists the contents of one or more archives.
- `unarchive` extracts the contents of one or more archives.
@@ -15,8 +16,8 @@ Supported Formats
The following archive formats are supported when the required utilities are
installed:
- *.tar.gz*, *.tgz* require `tar`.
- *.tar.bz2*, *.tbz* require `tar`.
- *.tar.gz*, *.tgz* require `tar` (optionally `pigz`).
- *.tar.bz2*, *.tbz* require `tar` (optionally `pbzip2`).
- *.tar.xz*, *.txz* require `tar` with *xz* support.
- *.tar.zma*, *.tlz* require `tar` with *lzma* support.
- *.tar* requires `tar`.
@@ -25,16 +26,27 @@ installed:
- *.xz* requires `unxz`.
- *.lzma* requires `unlzma`.
- *.Z* requires `uncompress`.
- *.zip* requires `unzip`.
- *.rar* requires `unrar` or `rar`.
- *.zip*, *.jar* requires `unzip`.
- *.rar* requires `rar` (needed for `archive` support), `unrar` or `lsar` and `unar`.
- *.7z* requires `7za`.
- *.deb* requires `ar`, `tar`.
Additionally, if `pigz` and/or `pbzip2` are installed, `archive` will use them over
their traditional counterparts, `gzip` and `bzip2` respectively, to take full advantage
of all available CPU cores for compression.
Alternatives
------------
Specifically on macOS, [The Unarchiver][1] provides a similar command line tool
which doesn't depend on a number of other programs being installed.
Authors
-------
*The authors of this module should be contacted via the [issue tracker][1].*
- [Sorin Ionescu](https://github.com/sorin-ionescu)
- [Matt Hamilton](https://github.com/Eriner)
[1]: https://github.com/sorin-ionescu/prezto/issues
[1]: https://theunarchiver.com/command-line

View File

@@ -10,4 +10,4 @@
_arguments \
'(-v --verbose)'{-v,--remove}'[verbose archive listing]' \
"*::archive file:_files -g '(#i)*.(tar|tgz|tbz|tbz2|txz|tlz|gz|bz2|xz|lzma|Z|zip|rar|7z)(-.)'" && return 0
"*::archive file:_files -g '(#i)*.(tar|tgz|tbz|tbz2|txz|tlz|gz|bz2|xz|lzma|Z|zip|jar|rar|7z)(-.)'" && return 0

View File

@@ -10,4 +10,4 @@
_arguments \
'(-r --remove)'{-r,--remove}'[remove archive]' \
"*::archive file:_files -g '(#i)*.(tar|tgz|tbz|tbz2|txz|tlz|gz|bz2|xz|lzma|Z|zip|rar|7z|deb)(-.)'" && return 0
"*::archive file:_files -g '(#i)*.(tar|tgz|tbz|tbz2|txz|tlz|gz|bz2|xz|lzma|Z|zip|jar|rar|7z|deb)(-.)'" && return 0

View File

@@ -0,0 +1,71 @@
#!/usr/bin/env zsh
#
# Creates archive file
#
# Authors:
# Matt Hamilton <m@tthamilton.com>
#
# function archive {
local archive_name dir_to_archive _gzip_bin _bzip2_bin
if (( $# != 2 )); then
cat >&2 <<EOF
usage: $0 [archive_name.zip] [/path/to/include/into/archive]
Where 'archive.zip' uses any of the following extensions:
.tar.gz, .tar.bz2, .tar.xz, .tar.lzma, .tar, .zip, .rar, .7z
There is no '-v' switch; all operations are verbose.
EOF
return 1
fi
# we are quitting (above) if there are not exactly 2 vars,
# so we don't need any argc check here.
# strip the path, just in case one is provided for some reason
archive_name="${1:t}"
# use absolute paths, and follow symlinks
dir_to_archive="${2}"
# if the directory doesn't exist, quit. Nothing to archive
if [[ ! -e "${dir_to_archive}" ]]; then
print "$0: file or directory not valid: ${dir_to_archive}" >&2
return 1
fi
# here, we check for dropin/multi-threaded replacements
# this should eventually be moved to modules/archive/init.zsh
# as a global alias
if (( $+commands[pigz] )); then
_gzip_bin='pigz'
else
_gzip_bin='gzip'
fi
if (( $+commands[pbzip2] )); then
_bzip2_bin='pbzip2'
else
_bzip2_bin='bzip2'
fi
case "${archive_name}" in
(*.tar.gz|*.tgz) tar -cvf "${archive_name}" --use-compress-program="${_gzip_bin}" "${dir_to_archive}" ;;
(*.tar.bz2|*.tbz|*.tbz2) tar -cvf "${archive_name}" --use-compress-program="${_bzip2_bin}" "${dir_to_archive}" ;;
(*.tar.xz|*.txz) tar -cvJf "${archive_name}" "${dir_to_archive}" ;;
(*.tar.lzma|*.tlz) tar -cvf "${archive_name}" --lzma "${dir_to_archive}" ;;
(*.tar) tar -cvf "${archive_name}" "${dir_to_archive}" ;;
(*.zip|*.jar) zip -r "${archive_name}" "${dir_to_archive}" ;;
(*.rar) rar a "${archive_name}" "${dir_to_archive}" ;;
(*.7z) 7za a "${archive_name}" "${dir_to_archive}" ;;
(*.gz) print "\n.gz is only useful for single files, and does not capture permissions. Use .tar.gz" ;;
(*.bz2) print "\n.bzip2 is only useful for single files, and does not capture permissions. Use .tar.bz2" ;;
(*.xz) print "\n.xz is only useful for single files, and does not capture permissions. Use .tar.xz" ;;
(*.lzma) print "\n.lzma is only useful for single files, and does not capture permissions. Use .tar.lzma" ;;
(*) print "\nunknown archive type for archive: ${archive_name}" ;;
esac
# }

View File

@@ -5,6 +5,8 @@
# Sorin Ionescu <sorin.ionescu@gmail.com>
#
# function lsarchive {
local verbose
if (( $# == 0 )); then
@@ -40,10 +42,12 @@ while (( $# > 0 )); do
&& tar --lzma -t${verbose:+v}f "$1" \
|| lzcat "$1" | tar x${verbose:+v}f - ;;
(*.tar) tar t${verbose:+v}f "$1" ;;
(*.zip) unzip -l${verbose:+v} "$1" ;;
(*.rar) unrar &> /dev/null \
&& unrar ${${verbose:+v}:-l} "$1" \
|| rar ${${verbose:+v}:-l} "$1" ;;
(*.zip|*.jar) unzip -l${verbose:+v} "$1" ;;
(*.rar) ( (( $+commands[unrar] )) \
&& unrar ${${verbose:+v}:-l} "$1" ) \
|| ( (( $+commands[rar] )) \
&& rar ${${verbose:+v}:-l} "$1" ) \
|| lsar ${verbose:+-l} "$1" ;;
(*.7z) 7za l "$1" ;;
(*)
print "$0: cannot list: $1" >&2
@@ -53,3 +57,5 @@ while (( $# > 0 )); do
shift
done
# }

View File

@@ -5,6 +5,8 @@
# Sorin Ionescu <sorin.ionescu@gmail.com>
#
# function unarchive {
local remove_archive
local success
local file_name
@@ -54,10 +56,12 @@ while (( $# > 0 )); do
(*.xz) unxz "$1" ;;
(*.lzma) unlzma "$1" ;;
(*.Z) uncompress "$1" ;;
(*.zip) unzip "$1" -d $extract_dir ;;
(*.rar) unrar &> /dev/null \
&& unrar x -ad "$1" \
|| rar x -ad "$1" ;;
(*.zip|*.jar) unzip "$1" -d $extract_dir ;;
(*.rar) ( (( $+commands[unrar] )) \
&& unrar x -ad "$1" ) \
|| ( (( $+commands[rar] )) \
&& rar x -ad "$1" ) \
|| unar -d "$1" ;;
(*.7z) 7za x "$1" ;;
(*.deb)
mkdir -p "$extract_dir/control"
@@ -78,3 +82,5 @@ while (( $# > 0 )); do
(( $success == 0 )) && (( $remove_archive == 0 )) && rm "$1"
shift
done
# }

View File

@@ -11,11 +11,12 @@ Integrates [zsh-autosuggestions][1] into Prezto, which implements the
of a previously entered command and Zsh suggests commands as you type based on
history and completions.
If this module is used in conjuncture with the *syntax-highlighting* module, it
must be loaded **after** it.
If this module is used in conjunction with the *syntax-highlighting* module,
this module must be loaded **after** the *syntax-highlighting* module.
If this module is used in conjuncture with the *history-substring-search*
module, it must be loaded **after** it.
If this module is used in conjunction with the *history-substring-search*
module, this module must be loaded **after** the *history-substring-search*
module.
Contributors
------------
@@ -35,11 +36,23 @@ positive results.
To enable highlighting for this module only, add the following line to
*zpreztorc*:
zstyle ':prezto:module:autosuggestions' color 'yes'
```sh
zstyle ':prezto:module:autosuggestions' color 'yes'
```
To set the query found color, add the following line to *zpreztorc*:
zstyle ':prezto:module:autosuggestions:color' found ''
```sh
zstyle ':prezto:module:autosuggestions:color' found ''
```
Troubleshooting
---------------
### Autosuggestions from previous sessions don't show up
For autosuggestions from previous shell sessions to work, please make sure you
also have the `history` module enabled.
Authors
-------

View File

@@ -0,0 +1,18 @@
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = tab
indent_size = 4
[*.md]
indent_style = space
[*.rb]
indent_style = space
indent_size = 2
[*.yml]
indent_style = space
indent_size = 2

View File

@@ -0,0 +1 @@
gitdir: ../../../.git/modules/modules/autosuggestions/external

View File

@@ -0,0 +1,3 @@
--color
--require spec_helper
--format documentation

View File

@@ -0,0 +1,30 @@
# Rails:
# Enabled: true
AllCops:
TargetRubyVersion: 2.3
Include:
- '**/Rakefile'
- '**/config.ru'
- '**/Gemfile'
Metrics/LineLength:
Max: 120
Style/Documentation:
Enabled: false
Style/DotPosition:
EnforcedStyle: trailing
Style/FrozenStringLiteralComment:
Enabled: false
Style/Lambda:
Enabled: false
Style/MultilineMethodCallIndentation:
EnforcedStyle: indented
Style/TrailingUnderscoreVariable:
Enabled: false

View File

@@ -0,0 +1 @@
2.3.1

View File

@@ -0,0 +1,69 @@
# Changelog
## v0.4.3
- Avoid bell when accepting suggestions with `autosuggest-accept` (#228)
- Don't fetch suggestions after [up,down]-line-or-beginning-search (#227, #241)
- We are now running CI against new 5.5.1 version
- Fix partial-accept in vi mode (#188)
- Fix suggestion disappearing on fast movement after switching to `vicmd` mode (#290)
- Fix issue rotating through kill ring with `yank-pop` (#301)
- Fix issue creating new pty for async mode when previous pty is not properly cleaned up (#249)
## v0.4.2
- Fix bug in zsh versions older than 5.0.8 (#296)
- Officially support back to zsh v4.3.11
## v0.4.1
- Switch to [[ and (( conditionals instead of [ (#257)
- Avoid warnnestedvar warnings with `typeset -g` (#275)
- Replace tabs with spaces in yaml (#268)
- Clean up and fix escaping of special characters (#267)
- Add `emacs-forward-word` to default list of partial accept widgets (#246)
## v0.4.0
- High-level integration tests using RSpec and tmux
- Add continuous integration with Circle CI
- Experimental support for asynchronous suggestions (#170)
- Fix problems with multi-line suggestions (#225)
- Optimize case where manually typing in suggestion
- Avoid wrapping any zle-* widgets (#206)
- Remove support for deprecated options from v0.0.x
- Handle history entries that begin with dashes
- Gracefully handle being sourced multiple times (#126)
- Add enable/disable/toggle widgets to disable/enable suggestions (#219)
## v0.3.3
- Switch from $history array to fc builtin for better performance with large HISTFILEs (#164)
- Fix tilde handling when extended_glob is set (#168)
- Add config option for maximum buffer length to fetch suggestions for (#178)
- Add config option for list of widgets to ignore (#184)
- Don't fetch a new suggestion unless a modification widget actually modifies the buffer (#183)
## v0.3.2
- Test runner now supports running specific tests and choosing zsh binary
- Return code from original widget is now correctly passed through (#135)
- Add `vi-add-eol` to list of accept widgets (#143)
- Escapes widget names within evals to fix problems with irregular widget names (#152)
- Plugin now clears suggestion while within a completion menu (#149)
- .plugin file no longer relies on symbolic link support, fixing issues on Windows (#156)
## v0.3.1
- Fixes issue with `vi-next-char` not accepting suggestion (#137).
- Fixes global variable warning when WARN_CREATE_GLOBAL option enabled (#133).
- Split out a separate test file for each widget.
## v0.3.0
- Adds `autosuggest-execute` widget (PR #124).
- Adds concept of suggestion "strategies" for different ways of fetching suggestions.
- Adds "match_prev_cmd" strategy (PR #131).
- Uses git submodules for testing dependencies.
- Lots of test cleanup.
- Various bug fixes for zsh 5.0.x and `sh_word_split` option.
## v0.2.17
Start of changelog.

View File

@@ -0,0 +1 @@
Fish-like fast/unobtrusive autosuggestions for zsh.

View File

@@ -0,0 +1,5 @@
source 'https://rubygems.org'
gem 'rspec'
gem 'rspec-wait'
gem 'pry-byebug'

View File

@@ -0,0 +1,41 @@
GEM
remote: https://rubygems.org/
specs:
byebug (9.0.5)
coderay (1.1.1)
diff-lcs (1.3)
method_source (0.8.2)
pry (0.10.4)
coderay (~> 1.1.0)
method_source (~> 0.8.1)
slop (~> 3.4)
pry-byebug (3.4.0)
byebug (~> 9.0)
pry (~> 0.10)
rspec (3.5.0)
rspec-core (~> 3.5.0)
rspec-expectations (~> 3.5.0)
rspec-mocks (~> 3.5.0)
rspec-core (3.5.4)
rspec-support (~> 3.5.0)
rspec-expectations (3.5.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.5.0)
rspec-mocks (3.5.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.5.0)
rspec-support (3.5.0)
rspec-wait (0.0.9)
rspec (>= 3, < 4)
slop (3.6.0)
PLATFORMS
ruby
DEPENDENCIES
pry-byebug
rspec
rspec-wait
BUNDLED WITH
1.13.6

View File

@@ -0,0 +1,67 @@
## Installation
### Manual (Git Clone)
1. Clone this repository somewhere on your machine. This guide will assume `~/.zsh/zsh-autosuggestions`.
```sh
git clone https://github.com/zsh-users/zsh-autosuggestions ~/.zsh/zsh-autosuggestions
```
2. Add the following to your `.zshrc`:
```sh
source ~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh
```
3. Start a new terminal session.
### Oh My Zsh
1. Clone this repository into `$ZSH_CUSTOM/plugins` (by default `~/.oh-my-zsh/custom/plugins`)
```sh
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
```
2. Add the plugin to the list of plugins for Oh My Zsh to load:
```sh
plugins=(zsh-autosuggestions)
```
3. Start a new terminal session.
### Arch Linux
1. Install [`zsh-autosuggestions`](https://www.archlinux.org/packages/community/any/zsh-autosuggestions/) from the `community` repository.
```sh
pacman -S zsh-autosuggestions
```
or, to use a package based on the `master` branch, install [`zsh-autosuggestions-git`](https://aur.archlinux.org/packages/zsh-autosuggestions-git/) from the [AUR](https://wiki.archlinux.org/index.php/Arch_User_Repository).
2. Add the following to your `.zshrc`:
```sh
source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
```
3. Start a new terminal session.
### macOS via Homebrew
1. Install the `zsh-autosuggestions` package using [Homebrew](https://brew.sh/).
```sh
brew install zsh-autosuggestions
```
2. Add the following to your `.zshrc`:
```sh
source /usr/local/share/zsh-autosuggestions/zsh-autosuggestions.zsh
```
3. Start a new terminal session.

View File

@@ -0,0 +1,23 @@
Copyright (c) 2013 Thiago de Arruda
Copyright (c) 2016-2018 Eric Freese
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -0,0 +1,36 @@
SRC_DIR := ./src
SRC_FILES := \
$(SRC_DIR)/setup.zsh \
$(SRC_DIR)/config.zsh \
$(SRC_DIR)/util.zsh \
$(SRC_DIR)/features.zsh \
$(SRC_DIR)/bind.zsh \
$(SRC_DIR)/highlight.zsh \
$(SRC_DIR)/widgets.zsh \
$(SRC_DIR)/strategies/*.zsh \
$(SRC_DIR)/async.zsh \
$(SRC_DIR)/start.zsh
HEADER_FILES := \
DESCRIPTION \
URL \
VERSION \
LICENSE
PLUGIN_TARGET := zsh-autosuggestions.zsh
all: $(PLUGIN_TARGET)
$(PLUGIN_TARGET): $(HEADER_FILES) $(SRC_FILES)
cat $(HEADER_FILES) | sed -e 's/^/# /g' > $@
cat $(SRC_FILES) >> $@
.PHONY: clean
clean:
rm $(PLUGIN_TARGET)
.PHONY: test
test: all
@test -n "$$TEST_ZSH_BIN" && echo "Testing zsh binary: $(TEST_ZSH_BIN)" || true
bundle exec rspec $(TESTS)

View File

@@ -0,0 +1,146 @@
# zsh-autosuggestions
_[Fish](http://fishshell.com/)-like fast/unobtrusive autosuggestions for zsh._
It suggests commands as you type, based on command history.
Requirements: Zsh v4.3.11 or later
[![CircleCI](https://circleci.com/gh/zsh-users/zsh-autosuggestions.svg?style=svg)](https://circleci.com/gh/zsh-users/zsh-autosuggestions)
<a href="https://asciinema.org/a/37390" target="_blank"><img src="https://asciinema.org/a/37390.png" width="400" /></a>
## Installation
See [INSTALL.md](INSTALL.md).
## Usage
As you type commands, you will see a completion offered after the cursor in a muted gray color. This color can be changed by setting the `ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE` variable. See [configuration](#configuration).
If you press the <kbd></kbd> key (`forward-char` widget) or <kbd>End</kbd> (`end-of-line` widget) with the cursor at the end of the buffer, it will accept the suggestion, replacing the contents of the command line buffer with the suggestion.
If you invoke the `forward-word` widget, it will partially accept the suggestion up to the point that the cursor moves to.
## Configuration
You may want to override the default global config variables after sourcing the plugin. Default values of these variables can be found [here](src/config.zsh).
**Note:** If you are using Oh My Zsh, you can put this configuration in a file in the `$ZSH_CUSTOM` directory. See their comments on [overriding internals](https://github.com/robbyrussell/oh-my-zsh/wiki/Customization#overriding-internals).
### Suggestion Highlight Style
Set `ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE` to configure the style that the suggestion is shown with. The default is `fg=8`.
### Suggestion Strategy
Set `ZSH_AUTOSUGGEST_STRATEGY` to choose the strategy for generating suggestions. There are currently two to choose from:
- `default`: Chooses the most recent match.
- `match_prev_cmd`: Chooses the most recent match whose preceding history item matches the most recently executed command ([more info](src/strategies/match_prev_cmd.zsh)). Note that this strategy won't work as expected with ZSH options that don't preserve the history order such as `HIST_IGNORE_ALL_DUPS` or `HIST_EXPIRE_DUPS_FIRST`.
### Widget Mapping
This plugin works by triggering custom behavior when certain [zle widgets](http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html#Zle-Widgets) are invoked. You can add and remove widgets from these arrays to change the behavior of this plugin:
- `ZSH_AUTOSUGGEST_CLEAR_WIDGETS`: Widgets in this array will clear the suggestion when invoked.
- `ZSH_AUTOSUGGEST_ACCEPT_WIDGETS`: Widgets in this array will accept the suggestion when invoked.
- `ZSH_AUTOSUGGEST_EXECUTE_WIDGETS`: Widgets in this array will execute the suggestion when invoked.
- `ZSH_AUTOSUGGEST_PARTIAL_ACCEPT_WIDGETS`: Widgets in this array will partially accept the suggestion when invoked.
- `ZSH_AUTOSUGGEST_IGNORE_WIDGETS`: Widgets in this array will not trigger any custom behavior.
Widgets that modify the buffer and are not found in any of these arrays will fetch a new suggestion after they are invoked.
**Note:** A widget shouldn't belong to more than one of the above arrays.
### Disabling suggestion for large buffers
Set `ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE` to an integer value to disable autosuggestion for large buffers. The default is unset, which means that autosuggestion will be tried for any buffer size. Recommended value is 20.
This can be useful when pasting large amount of text in the terminal, to avoid triggering autosuggestion for too long strings.
### Enable Asynchronous Mode
As of `v0.4.0`, suggestions can be fetched asynchronously using the `zsh/zpty` module. To enable this behavior, set the `ZSH_AUTOSUGGEST_USE_ASYNC` variable (it can be set to anything).
### Key Bindings
This plugin provides a few widgets that you can use with `bindkey`:
1. `autosuggest-accept`: Accepts the current suggestion.
2. `autosuggest-execute`: Accepts and executes the current suggestion.
3. `autosuggest-clear`: Clears the current suggestion.
4. `autosuggest-fetch`: Fetches a suggestion (works even when suggestions are disabled).
5. `autosuggest-disable`: Disables suggestions.
6. `autosuggest-enable`: Re-enables suggestions.
7. `autosuggest-toggle`: Toggles between enabled/disabled suggestions.
For example, this would bind <kbd>ctrl</kbd> + <kbd>space</kbd> to accept the current suggestion.
```sh
bindkey '^ ' autosuggest-accept
```
## Troubleshooting
If you have a problem, please search through [the list of issues on GitHub](https://github.com/zsh-users/zsh-autosuggestions/issues) to see if someone else has already reported it.
### Reporting an Issue
Before reporting an issue, please try temporarily disabling sections of your configuration and other plugins that may be conflicting with this plugin to isolate the problem.
When reporting an issue, please include:
- The smallest, simplest `.zshrc` configuration that will reproduce the problem. See [this comment](https://github.com/zsh-users/zsh-autosuggestions/issues/102#issuecomment-180944764) for a good example of what this means.
- The version of zsh you're using (`zsh --version`)
- Which operating system you're running
## Uninstallation
1. Remove the code referencing this plugin from `~/.zshrc`.
2. Remove the git repository from your hard drive
```sh
rm -rf ~/.zsh/zsh-autosuggestions # Or wherever you installed
```
## Development
### Build Process
Edit the source files in `src/`. Run `make` to build `zsh-autosuggestions.zsh` from those source files.
### Pull Requests
Pull requests are welcome! If you send a pull request, please:
- Request to merge into the `develop` branch (*NOT* `master`)
- Match the existing coding conventions.
- Include helpful comments to keep the barrier-to-entry low for people new to the project.
- Write tests that cover your code as much as possible.
### Testing
Tests are written in ruby using the [`rspec`](http://rspec.info/) framework. They use [`tmux`](https://tmux.github.io/) to drive a pseudoterminal, sending simulated keystrokes and making assertions on the terminal content.
Test files live in `spec/`. To run the tests, run `make test`. To run a specific test, run `TESTS=spec/some_spec.rb make test`. You can also specify a `zsh` binary to use by setting the `TEST_ZSH_BIN` environment variable (ex: `TEST_ZSH_BIN=/bin/zsh make test`).
## License
This project is licensed under [MIT license](http://opensource.org/licenses/MIT).
For the full text of the license, see the [LICENSE](LICENSE) file.

View File

@@ -0,0 +1 @@
https://github.com/zsh-users/zsh-autosuggestions

View File

@@ -0,0 +1 @@
v0.4.3

View File

@@ -0,0 +1,12 @@
machine:
environment:
ZSH_VERSIONS: zsh-dev/4.3.11 zsh/5.0.2 zsh/5.0.8 zsh/5.1.1 zsh/5.2 zsh/5.3.1 zsh/5.4.2 zsh/5.5.1
dependencies:
pre:
- for v in $(echo $ZSH_VERSIONS | awk "{ for (i=$((1+CIRCLE_NODE_INDEX));i<=NF;i+=$CIRCLE_NODE_TOTAL) print \$i }"); do wget https://sourceforge.net/projects/zsh/files/$v/zsh-${v#*/}.tar.gz && tar xzf zsh-${v#*/}.tar.gz && pushd zsh-${v#*/} && ./configure && sudo make install && popd || exit 1; done
test:
override:
- for v in $(echo $ZSH_VERSIONS | awk "{ for (i=$((1+CIRCLE_NODE_INDEX));i<=NF;i+=$CIRCLE_NODE_TOTAL) print \$i }"); do TEST_ZSH_BIN=/usr/local/bin/zsh-${v#*/} make test || exit 1; done:
parallel: true

View File

@@ -0,0 +1,41 @@
context 'with asynchronous suggestions enabled' do
let(:options) { ["ZSH_AUTOSUGGEST_USE_ASYNC="] }
describe '`up-line-or-beginning-search`' do
let(:before_sourcing) do
-> do
session.
run_command('autoload -U up-line-or-beginning-search').
run_command('zle -N up-line-or-beginning-search').
send_string('bindkey "').
send_keys('C-v').send_keys('up').
send_string('" up-line-or-beginning-search').
send_keys('enter')
end
end
it 'should show previous history entries' do
with_history(
'echo foo',
'echo bar',
'echo baz'
) do
session.clear_screen
3.times { session.send_keys('up') }
wait_for { session.content }.to eq("echo foo")
end
end
end
describe 'exiting a subshell' do
it 'should not cause error messages to be printed' do
session.run_command('$(exit)')
sleep 1
expect(session.content).to eq('$(exit)')
end
end
end

View File

@@ -0,0 +1,27 @@
describe 'pasting using bracketed-paste-magic' do
let(:before_sourcing) do
-> do
session.
run_command('autoload -Uz bracketed-paste-magic').
run_command('zle -N bracketed-paste bracketed-paste-magic')
end
end
context 'with suggestions disabled while pasting' do
before do
session.
run_command('bpm_init() { zle autosuggest-disable }').
run_command('bpm_finish() { zle autosuggest-enable }').
run_command('zstyle :bracketed-paste-magic paste-init bpm_init').
run_command('zstyle :bracketed-paste-magic paste-finish bpm_finish')
end
it 'does not show an incorrect suggestion' do
with_history('echo hello') do
session.paste_string("echo #{'a' * 60}")
sleep 1
expect(session.content).to eq("echo #{'a' * 60}")
end
end
end
end

View File

@@ -0,0 +1,10 @@
describe 'a running zpty command' do
let(:before_sourcing) { -> { session.run_command('zmodload zsh/zpty && zpty -b kitty cat') } }
it 'is not affected by running zsh-autosuggestions' do
sleep 1 # Give a little time for precmd hooks to run
session.run_command('zpty -t kitty; echo $?')
wait_for { session.content }.to end_with("\n0")
end
end

View File

@@ -0,0 +1,13 @@
describe 'rebinding [' do
context 'initialized before sourcing the plugin' do
before do
session.run_command("function [ { $commands[\\[] \"$@\" }")
session.clear_screen
end
it 'executes the custom behavior and the built-in behavior' do
session.send_string('asdf')
wait_for { session.content }.to eq('asdf')
end
end
end

View File

@@ -0,0 +1,67 @@
describe 'when using vi mode' do
let(:before_sourcing) do
-> do
session.run_command('bindkey -v')
end
end
describe 'moving the cursor after exiting insert mode' do
it 'should not clear the current suggestion' do
with_history('foobar foo') do
session.
send_string('foo').
send_keys('escape').
send_keys('h')
wait_for { session.content }.to eq('foobar foo')
end
end
end
describe '`vi-forward-word-end`' do
it 'should accept through the end of the current word' do
with_history('foobar foo') do
session.
send_string('foo').
send_keys('escape').
send_keys('e'). # vi-forward-word-end
send_keys('a'). # vi-add-next
send_string('baz')
wait_for { session.content }.to eq('foobarbaz')
end
end
end
describe '`vi-forward-word`' do
it 'should accept through the first character of the next word' do
with_history('foobar foo') do
session.
send_string('foo').
send_keys('escape').
send_keys('w'). # vi-forward-word
send_keys('a'). # vi-add-next
send_string('az')
wait_for { session.content }.to eq('foobar faz')
end
end
end
describe '`vi-find-next-char`' do
it 'should accept through the next occurrence of the character' do
with_history('foobar foo') do
session.
send_string('foo').
send_keys('escape').
send_keys('f'). # vi-find-next-char
send_keys('o').
send_keys('a'). # vi-add-next
send_string('b')
wait_for { session.content }.to eq('foobar fob')
end
end
end
end

View File

@@ -0,0 +1,39 @@
describe 'a wrapped widget' do
let(:widget) { 'backward-delete-char' }
context 'initialized before sourcing the plugin' do
let(:before_sourcing) do
-> do
session.
run_command("_orig_#{widget}() { zle .#{widget} }").
run_command("zle -N orig-#{widget} _orig_#{widget}").
run_command("#{widget}-magic() { zle orig-#{widget}; BUFFER+=b }").
run_command("zle -N #{widget} #{widget}-magic")
end
end
it 'executes the custom behavior and the built-in behavior' do
with_history('foobar', 'foodar') do
session.send_string('food').send_keys('C-h')
wait_for { session.content }.to eq('foobar')
end
end
end
context 'initialized after sourcing the plugin' do
before do
session.
run_command("zle -N orig-#{widget} ${widgets[#{widget}]#*:}").
run_command("#{widget}-magic() { zle orig-#{widget}; BUFFER+=b }").
run_command("zle -N #{widget} #{widget}-magic").
clear_screen
end
it 'executes the custom behavior and the built-in behavior' do
with_history('foobar', 'foodar') do
session.send_string('food').send_keys('C-h')
wait_for { session.content }.to eq('foobar')
end
end
end
end

View File

@@ -0,0 +1,24 @@
describe 'using `zle -U`' do
let(:before_sourcing) do
-> do
session.
run_command('_zsh_autosuggest_strategy_test() { sleep 1; _zsh_autosuggest_strategy_default "$1" }').
run_command('foo() { zle -U - "echo hello" }; zle -N foo; bindkey ^B foo')
end
end
let(:options) { ['unset ZSH_AUTOSUGGEST_USE_ASYNC', 'ZSH_AUTOSUGGEST_STRATEGY=test'] }
# TODO: This is only possible with the $KEYS_QUEUED_COUNT widget parameter, coming soon...
xit 'does not fetch a suggestion for every inserted character' do
session.send_keys('C-b')
wait_for { session.content }.to eq('echo hello')
end
it 'shows a suggestion when the widget completes' do
with_history('echo hello world') do
session.send_keys('C-b')
wait_for { session.content(esc_seqs: true) }.to match(/\Aecho hello\e\[[0-9]+m world/)
end
end
end

View File

@@ -0,0 +1,23 @@
context 'with some items in the kill ring' do
before do
session.
send_string('echo foo').
send_keys('C-u').
send_string('echo bar').
send_keys('C-u')
end
describe '`yank-pop`' do
it 'should cycle through all items in the kill ring' do
session.send_keys('C-y')
wait_for { session.content }.to eq('echo bar')
session.send_keys('escape').send_keys('y')
wait_for { session.content }.to eq('echo foo')
session.send_keys('escape').send_keys('y')
wait_for { session.content }.to eq('echo bar')
end
end
end

View File

@@ -0,0 +1,13 @@
describe 'a multi-line suggestion' do
it 'should be displayed on multiple lines' do
with_history(-> {
session.send_string('echo "')
session.send_keys('enter')
session.send_string('"')
session.send_keys('enter')
}) do
session.send_keys('e')
wait_for { session.content }.to eq("echo \"\n\"")
end
end
end

View File

@@ -0,0 +1,19 @@
context 'when async suggestions are enabled' do
let(:options) { ["ZSH_AUTOSUGGEST_USE_ASYNC="] }
describe 'the zpty for async suggestions' do
it 'is created with the default name' do
session.run_command('zpty -t zsh_autosuggest_pty &>/dev/null; echo $?')
wait_for { session.content }.to end_with("\n0")
end
context 'when ZSH_AUTOSUGGEST_ASYNC_PTY_NAME is set' do
let(:options) { super() + ['ZSH_AUTOSUGGEST_ASYNC_PTY_NAME=foo_pty'] }
it 'is created with the specified name' do
session.run_command('zpty -t foo_pty &>/dev/null; echo $?')
wait_for { session.content }.to end_with("\n0")
end
end
end
end

View File

@@ -0,0 +1,30 @@
describe 'a suggestion' do
let(:term_opts) { { width: 200 } }
let(:long_command) { "echo #{'a' * 100}" }
around do |example|
with_history(long_command) { example.run }
end
it 'is provided for any buffer length' do
session.send_string(long_command[0...-1])
wait_for { session.content }.to eq(long_command)
end
context 'when ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE is specified' do
let(:buffer_max_size) { 10 }
let(:options) { ["ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE=#{buffer_max_size}"] }
it 'is provided when the buffer is shorter than the specified length' do
session.send_string(long_command[0...(buffer_max_size - 1)])
wait_for { session.content }.to eq(long_command)
end
it 'is provided when the buffer is equal to the specified length' do
session.send_string(long_command[0...(buffer_max_size)])
wait_for { session.content }.to eq(long_command)
end
it 'is not provided when the buffer is longer than the specified length'
end
end

View File

@@ -0,0 +1,7 @@
describe 'a displayed suggestion' do
it 'is shown in the default style'
describe 'when ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE is set to a zle_highlight string' do
it 'is shown in the specified style'
end
end

View File

@@ -0,0 +1,7 @@
describe 'an original zle widget' do
context 'is accessible with the default prefix'
context 'when ZSH_AUTOSUGGEST_ORIGINAL_WIDGET_PREFIX is set' do
it 'is accessible with the specified prefix'
end
end

View File

@@ -0,0 +1,20 @@
describe 'a suggestion for a given prefix' do
let(:options) { ['_zsh_autosuggest_strategy_default() { suggestion="echo foo" }'] }
it 'is determined by calling the default strategy function' do
session.send_string('e')
wait_for { session.content }.to eq('echo foo')
end
context 'when ZSH_AUTOSUGGEST_STRATEGY is set' do
let(:options) { [
'_zsh_autosuggest_strategy_custom() { suggestion="echo foo" }',
'ZSH_AUTOSUGGEST_STRATEGY=custom'
] }
it 'is determined by calling the specified strategy function' do
session.send_string('e')
wait_for { session.content }.to eq('echo foo')
end
end
end

View File

@@ -0,0 +1,7 @@
describe 'suggestion fetching' do
it 'is performed synchronously'
context 'when ZSH_AUTOSUGGEST_USE_ASYNC is set' do
it 'is performed asynchronously'
end
end

View File

@@ -0,0 +1,97 @@
describe 'a zle widget' do
let(:widget) { 'my-widget' }
let(:before_sourcing) { -> { session.run_command("#{widget}() {}; zle -N #{widget}; bindkey ^B #{widget}") } }
context 'when added to ZSH_AUTOSUGGEST_ACCEPT_WIDGETS' do
let(:options) { ["ZSH_AUTOSUGGEST_ACCEPT_WIDGETS+=(#{widget})"] }
it 'accepts the suggestion when invoked' do
with_history('echo hello') do
session.send_string('e')
wait_for { session.content }.to eq('echo hello')
session.send_keys('C-b')
wait_for { session.content(esc_seqs: true) }.to eq('echo hello')
end
end
end
context 'when added to ZSH_AUTOSUGGEST_CLEAR_WIDGETS' do
let(:options) { ["ZSH_AUTOSUGGEST_CLEAR_WIDGETS+=(#{widget})"] }
it 'clears the suggestion when invoked' do
with_history('echo hello') do
session.send_string('e')
wait_for { session.content }.to eq('echo hello')
session.send_keys('C-b')
wait_for { session.content }.to eq('e')
end
end
end
context 'when added to ZSH_AUTOSUGGEST_EXECUTE_WIDGETS' do
let(:options) { ["ZSH_AUTOSUGGEST_EXECUTE_WIDGETS+=(#{widget})"] }
it 'executes the suggestion when invoked' do
with_history('echo hello') do
session.send_string('e')
wait_for { session.content }.to eq('echo hello')
session.send_keys('C-b')
wait_for { session.content }.to end_with("\nhello")
end
end
end
context 'when added to ZSH_AUTOSUGGEST_IGNORE_WIDGETS' do
let(:options) { ["ZSH_AUTOSUGGEST_IGNORE_WIDGETS=(#{widget})"] }
it 'should not be wrapped with an autosuggest widget' do
session.run_command("echo $widgets[#{widget}]")
wait_for { session.content }.to end_with("\nuser:#{widget}")
end
end
context 'that moves the cursor forward' do
before { session.run_command("#{widget}() { zle forward-char }") }
context 'when added to ZSH_AUTOSUGGEST_PARTIAL_ACCEPT_WIDGETS' do
let(:options) { ["ZSH_AUTOSUGGEST_PARTIAL_ACCEPT_WIDGETS=(#{widget})"] }
it 'accepts the suggestion as far as the cursor is moved when invoked' do
with_history('echo hello') do
session.send_string('e')
wait_for { session.content }.to start_with('echo hello')
session.send_keys('C-b')
wait_for { session.content(esc_seqs: true) }.to match(/\Aec\e\[[0-9]+mho hello/)
end
end
end
end
context 'that modifies the buffer' do
before { session.run_command("#{widget}() { BUFFER=\"foo\" }") }
context 'when not added to any of the widget lists' do
it 'modifies the buffer and fetches a new suggestion' do
with_history('foobar') do
session.send_keys('C-b')
wait_for { session.content }.to eq('foobar')
end
end
end
end
end
describe 'a modification to the widget lists' do
let(:widget) { 'my-widget' }
let(:before_sourcing) { -> { session.run_command("#{widget}() {}; zle -N #{widget}; bindkey ^B #{widget}") } }
before { session.run_command("ZSH_AUTOSUGGEST_ACCEPT_WIDGETS+=(#{widget})") }
it 'takes effect on the next cmd line' do
with_history('echo hello') do
session.send_string('e')
wait_for { session.content }.to eq('echo hello')
session.send_keys('C-b')
wait_for { session.content(esc_seqs: true) }.to eq('echo hello')
end
end
end

View File

@@ -0,0 +1,50 @@
require 'pry'
require 'rspec/wait'
require 'terminal_session'
RSpec.shared_context 'terminal session' do
let(:term_opts) { {} }
let(:session) { TerminalSession.new(term_opts) }
let(:before_sourcing) { -> {} }
let(:options) { [] }
around do |example|
before_sourcing.call
session.run_command((['source zsh-autosuggestions.zsh'] + options).join('; '))
session.clear_screen
example.run
session.destroy
end
def with_history(*commands, &block)
session.run_command('fc -p')
commands.each do |c|
c.respond_to?(:call) ? c.call : session.run_command(c)
end
session.clear_screen
yield block
session.send_keys('C-c')
session.run_command('fc -P')
end
end
RSpec.configure do |config|
config.expect_with :rspec do |expectations|
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
end
config.mock_with :rspec do |mocks|
mocks.verify_partial_doubles = true
end
config.wait_timeout = 2
config.include_context 'terminal session'
end

View File

@@ -0,0 +1,12 @@
require 'strategies/special_characters_helper'
describe 'the default suggestion strategy' do
it 'suggests the last matching history entry' do
with_history('ls foo', 'ls bar', 'echo baz') do
session.send_string('ls')
wait_for { session.content }.to eq('ls bar')
end
end
include_examples 'special characters'
end

View File

@@ -0,0 +1,21 @@
require 'strategies/special_characters_helper'
describe 'the match_prev_cmd strategy' do
let(:options) { ['ZSH_AUTOSUGGEST_STRATEGY=match_prev_cmd'] }
it 'suggests the last matching history entry after the previous command' do
with_history(
'echo what',
'ls foo',
'echo what',
'ls bar',
'ls baz',
'echo what'
) do
session.send_string('ls')
wait_for { session.content }.to eq('ls bar')
end
end
include_examples 'special characters'
end

View File

@@ -0,0 +1,62 @@
shared_examples 'special characters' do
describe 'a special character in the buffer' do
it 'should be treated like any other character' do
with_history('echo "hello*"', 'echo "hello."') do
session.send_string('echo "hello*')
wait_for { session.content }.to eq('echo "hello*"')
end
with_history('echo "hello?"', 'echo "hello."') do
session.send_string('echo "hello?')
wait_for { session.content }.to eq('echo "hello?"')
end
with_history('echo "hello\nworld"') do
session.send_string('echo "hello\\')
wait_for { session.content }.to eq('echo "hello\nworld"')
end
with_history('echo "\\\\"') do
session.send_string('echo "\\\\')
wait_for { session.content }.to eq('echo "\\\\"')
end
with_history('echo ~/foo') do
session.send_string('echo ~')
wait_for { session.content }.to eq('echo ~/foo')
end
with_history('echo "$(ls foo)"') do
session.send_string('echo "$(')
wait_for { session.content }.to eq('echo "$(ls foo)"')
end
with_history('echo "$history[123]"') do
session.send_string('echo "$history[')
wait_for { session.content }.to eq('echo "$history[123]"')
session.send_string('123]')
wait_for { session.content }.to eq('echo "$history[123]"')
end
with_history('echo "#yolo"') do
session.send_string('echo "#')
wait_for { session.content }.to eq('echo "#yolo"')
end
with_history('echo "#foo"', 'echo $#abc') do
session.send_string('echo "#')
wait_for { session.content }.to eq('echo "#foo"')
end
with_history('echo "^A"', 'echo "^B"') do
session.send_string('echo "^A')
wait_for { session.content }.to eq('echo "^A"')
end
with_history('-foo() {}') do
session.send_string('-')
wait_for { session.content }.to eq('-foo() {}')
end
end
end
end

View File

@@ -0,0 +1,95 @@
require 'securerandom'
class TerminalSession
ZSH_BIN = ENV['TEST_ZSH_BIN'] || 'zsh'
def initialize(opts = {})
opts = {
width: 80,
height: 24,
prompt: '',
term: 'xterm-256color',
zsh_bin: ZSH_BIN
}.merge(opts)
@opts = opts
cmd="PS1=\"#{opts[:prompt]}\" TERM=#{opts[:term]} #{ZSH_BIN} -f"
tmux_command("new-session -d -x #{opts[:width]} -y #{opts[:height]} '#{cmd}'")
end
def tmux_socket_name
@tmux_socket_name ||= SecureRandom.hex(6)
end
def run_command(command)
send_string(command)
send_keys('enter')
self
end
def send_string(str)
tmux_command("send-keys -t 0 -l -- '#{str.gsub("'", "\\'")}'")
self
end
def send_keys(*keys)
tmux_command("send-keys -t 0 #{keys.join(' ')}")
self
end
def paste_string(str)
tmux_command("set-buffer -- '#{str}'")
tmux_command("paste-buffer -dpr -t 0")
self
end
def content(esc_seqs: false)
cmd = 'capture-pane -p -t 0'
cmd += ' -e' if esc_seqs
tmux_command(cmd).strip
end
def clear_screen
send_keys('C-l')
i = 0
until content == opts[:prompt] || i > 20 do
sleep(0.1)
i = i + 1
end
self
end
def destroy
tmux_command('kill-session')
end
def cursor
tmux_command("display-message -t 0 -p '\#{cursor_x},\#{cursor_y}'").
strip.
split(',').
map(&:to_i)
end
def attach!
tmux_command('attach-session')
end
private
attr_reader :opts
def tmux_command(cmd)
out = `tmux -u -L #{tmux_socket_name} #{cmd}`
raise("tmux error running: '#{cmd}'") unless $?.success?
out
end
end

View File

@@ -0,0 +1,19 @@
describe 'the `autosuggest-disable` widget' do
before do
session.run_command('bindkey ^B autosuggest-disable')
end
it 'disables suggestions and clears the suggestion' do
with_history('echo hello') do
session.send_string('echo')
wait_for { session.content }.to eq('echo hello')
session.send_keys('C-b')
wait_for { session.content }.to eq('echo')
session.send_string(' h')
sleep 1
expect(session.content).to eq('echo h')
end
end
end

View File

@@ -0,0 +1,42 @@
describe 'the `autosuggest-enable` widget' do
before do
session.
run_command('typeset -g _ZSH_AUTOSUGGEST_DISABLED').
run_command('bindkey ^B autosuggest-enable')
end
it 'enables suggestions and fetches a suggestion' do
with_history('echo hello') do
session.send_string('e')
sleep 1
expect(session.content).to eq('e')
session.send_keys('C-b')
session.send_string('c')
wait_for { session.content }.to eq('echo hello')
end
end
context 'invoked on an empty buffer' do
it 'does not fetch a suggestion' do
with_history('echo hello') do
session.send_keys('C-b')
sleep 1
expect(session.content).to eq('')
end
end
end
context 'invoked on a non-empty buffer' do
it 'fetches a suggestion' do
with_history('echo hello') do
session.send_string('e')
sleep 1
expect(session.content).to eq('e')
session.send_keys('C-b')
wait_for { session.content }.to eq('echo hello')
end
end
end
end

View File

@@ -0,0 +1,24 @@
describe 'the `autosuggest-fetch` widget' do
context 'when suggestions are disabled' do
before do
session.
run_command('bindkey ^B autosuggest-disable').
run_command('bindkey ^F autosuggest-fetch').
send_keys('C-b')
end
it 'will fetch and display a suggestion' do
with_history('echo hello') do
session.send_string('echo h')
sleep 1
expect(session.content).to eq('echo h')
session.send_keys('C-f')
wait_for { session.content }.to eq('echo hello')
session.send_string('e')
wait_for { session.content }.to eq('echo hello')
end
end
end
end

View File

@@ -0,0 +1,26 @@
describe 'the `autosuggest-toggle` widget' do
before do
session.run_command('bindkey ^B autosuggest-toggle')
end
it 'toggles suggestions' do
with_history('echo world', 'echo hello') do
session.send_string('echo')
wait_for { session.content }.to eq('echo hello')
session.send_keys('C-b')
wait_for { session.content }.to eq('echo')
session.send_string(' h')
sleep 1
expect(session.content).to eq('echo h')
session.send_keys('C-b')
wait_for { session.content }.to eq('echo hello')
session.send_keys('C-h')
session.send_string('w')
wait_for { session.content }.to eq('echo world')
end
end
end

View File

@@ -0,0 +1,106 @@
#--------------------------------------------------------------------#
# Async #
#--------------------------------------------------------------------#
# Zpty process is spawned running this function
_zsh_autosuggest_async_server() {
emulate -R zsh
# There is a bug in zpty module (fixed in zsh/master) by which a
# zpty that exits will kill all zpty processes that were forked
# before it. Here we set up a zsh exit hook to SIGKILL the zpty
# process immediately, before it has a chance to kill any other
# zpty processes.
zshexit() {
kill -KILL $$
sleep 1 # Block for long enough for the signal to come through
}
# Output only newlines (not carriage return + newline)
stty -onlcr
# Silence any error messages
exec 2>/dev/null
local last_pid
while IFS='' read -r -d $'\0' query; do
# Kill last bg process
kill -KILL $last_pid &>/dev/null
# Run suggestion search in the background
(
local suggestion
_zsh_autosuggest_strategy_$ZSH_AUTOSUGGEST_STRATEGY "$query"
echo -n -E "$suggestion"$'\0'
) &
last_pid=$!
done
}
_zsh_autosuggest_async_request() {
# Write the query to the zpty process to fetch a suggestion
zpty -w -n $ZSH_AUTOSUGGEST_ASYNC_PTY_NAME "${1}"$'\0'
}
# Called when new data is ready to be read from the pty
# First arg will be fd ready for reading
# Second arg will be passed in case of error
_zsh_autosuggest_async_response() {
setopt LOCAL_OPTIONS EXTENDED_GLOB
local suggestion
zpty -rt $ZSH_AUTOSUGGEST_ASYNC_PTY_NAME suggestion '*'$'\0' 2>/dev/null
zle autosuggest-suggest -- "${suggestion%%$'\0'##}"
}
_zsh_autosuggest_async_pty_create() {
# With newer versions of zsh, REPLY stores the fd to read from
typeset -h REPLY
# If we won't get a fd back from zpty, try to guess it
if (( ! $_ZSH_AUTOSUGGEST_ZPTY_RETURNS_FD )); then
integer -l zptyfd
exec {zptyfd}>&1 # Open a new file descriptor (above 10).
exec {zptyfd}>&- # Close it so it's free to be used by zpty.
fi
# Fork a zpty process running the server function
zpty -b $ZSH_AUTOSUGGEST_ASYNC_PTY_NAME _zsh_autosuggest_async_server
# Store the fd so we can remove the handler later
if (( REPLY )); then
_ZSH_AUTOSUGGEST_PTY_FD=$REPLY
else
_ZSH_AUTOSUGGEST_PTY_FD=$zptyfd
fi
# Set up input handler from the zpty
zle -F $_ZSH_AUTOSUGGEST_PTY_FD _zsh_autosuggest_async_response
}
_zsh_autosuggest_async_pty_destroy() {
# Remove the input handler
zle -F $_ZSH_AUTOSUGGEST_PTY_FD &>/dev/null
# Destroy the zpty
zpty -d $ZSH_AUTOSUGGEST_ASYNC_PTY_NAME &>/dev/null
}
_zsh_autosuggest_async_pty_recreate() {
_zsh_autosuggest_async_pty_destroy
_zsh_autosuggest_async_pty_create
}
_zsh_autosuggest_async_start() {
typeset -g _ZSH_AUTOSUGGEST_PTY_FD
_zsh_autosuggest_feature_detect_zpty_returns_fd
_zsh_autosuggest_async_pty_recreate
# We recreate the pty to get a fresh list of history events
add-zsh-hook precmd _zsh_autosuggest_async_pty_recreate
}

View File

@@ -0,0 +1,118 @@
#--------------------------------------------------------------------#
# Widget Helpers #
#--------------------------------------------------------------------#
_zsh_autosuggest_incr_bind_count() {
if ((${+_ZSH_AUTOSUGGEST_BIND_COUNTS[$1]})); then
((_ZSH_AUTOSUGGEST_BIND_COUNTS[$1]++))
else
_ZSH_AUTOSUGGEST_BIND_COUNTS[$1]=1
fi
typeset -gi bind_count=$_ZSH_AUTOSUGGEST_BIND_COUNTS[$1]
}
_zsh_autosuggest_get_bind_count() {
if ((${+_ZSH_AUTOSUGGEST_BIND_COUNTS[$1]})); then
typeset -gi bind_count=$_ZSH_AUTOSUGGEST_BIND_COUNTS[$1]
else
typeset -gi bind_count=0
fi
}
# Bind a single widget to an autosuggest widget, saving a reference to the original widget
_zsh_autosuggest_bind_widget() {
typeset -gA _ZSH_AUTOSUGGEST_BIND_COUNTS
local widget=$1
local autosuggest_action=$2
local prefix=$ZSH_AUTOSUGGEST_ORIGINAL_WIDGET_PREFIX
local -i bind_count
# Save a reference to the original widget
case $widgets[$widget] in
# Already bound
user:_zsh_autosuggest_(bound|orig)_*);;
# User-defined widget
user:*)
_zsh_autosuggest_incr_bind_count $widget
zle -N $prefix${bind_count}-$widget ${widgets[$widget]#*:}
;;
# Built-in widget
builtin)
_zsh_autosuggest_incr_bind_count $widget
eval "_zsh_autosuggest_orig_${(q)widget}() { zle .${(q)widget} }"
zle -N $prefix${bind_count}-$widget _zsh_autosuggest_orig_$widget
;;
# Completion widget
completion:*)
_zsh_autosuggest_incr_bind_count $widget
eval "zle -C $prefix${bind_count}-${(q)widget} ${${(s.:.)widgets[$widget]}[2,3]}"
;;
esac
_zsh_autosuggest_get_bind_count $widget
# Pass the original widget's name explicitly into the autosuggest
# function. Use this passed in widget name to call the original
# widget instead of relying on the $WIDGET variable being set
# correctly. $WIDGET cannot be trusted because other plugins call
# zle without the `-w` flag (e.g. `zle self-insert` instead of
# `zle self-insert -w`).
eval "_zsh_autosuggest_bound_${bind_count}_${(q)widget}() {
_zsh_autosuggest_widget_$autosuggest_action $prefix$bind_count-${(q)widget} \$@
}"
# Create the bound widget
zle -N $widget _zsh_autosuggest_bound_${bind_count}_$widget
}
# Map all configured widgets to the right autosuggest widgets
_zsh_autosuggest_bind_widgets() {
local widget
local ignore_widgets
ignore_widgets=(
.\*
_\*
zle-\*
autosuggest-\*
$ZSH_AUTOSUGGEST_ORIGINAL_WIDGET_PREFIX\*
$ZSH_AUTOSUGGEST_IGNORE_WIDGETS
)
# Find every widget we might want to bind and bind it appropriately
for widget in ${${(f)"$(builtin zle -la)"}:#${(j:|:)~ignore_widgets}}; do
if [[ -n ${ZSH_AUTOSUGGEST_CLEAR_WIDGETS[(r)$widget]} ]]; then
_zsh_autosuggest_bind_widget $widget clear
elif [[ -n ${ZSH_AUTOSUGGEST_ACCEPT_WIDGETS[(r)$widget]} ]]; then
_zsh_autosuggest_bind_widget $widget accept
elif [[ -n ${ZSH_AUTOSUGGEST_EXECUTE_WIDGETS[(r)$widget]} ]]; then
_zsh_autosuggest_bind_widget $widget execute
elif [[ -n ${ZSH_AUTOSUGGEST_PARTIAL_ACCEPT_WIDGETS[(r)$widget]} ]]; then
_zsh_autosuggest_bind_widget $widget partial_accept
else
# Assume any unspecified widget might modify the buffer
_zsh_autosuggest_bind_widget $widget modify
fi
done
}
# Given the name of an original widget and args, invoke it, if it exists
_zsh_autosuggest_invoke_original_widget() {
# Do nothing unless called with at least one arg
(( $# )) || return 0
local original_widget_name="$1"
shift
if (( ${+widgets[$original_widget_name]} )); then
zle $original_widget_name -- $@
fi
}

View File

@@ -0,0 +1,71 @@
#--------------------------------------------------------------------#
# Global Configuration Variables #
#--------------------------------------------------------------------#
# Color to use when highlighting suggestion
# Uses format of `region_highlight`
# More info: http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html#Zle-Widgets
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=8'
# Prefix to use when saving original versions of bound widgets
ZSH_AUTOSUGGEST_ORIGINAL_WIDGET_PREFIX=autosuggest-orig-
ZSH_AUTOSUGGEST_STRATEGY=default
# Widgets that clear the suggestion
ZSH_AUTOSUGGEST_CLEAR_WIDGETS=(
history-search-forward
history-search-backward
history-beginning-search-forward
history-beginning-search-backward
history-substring-search-up
history-substring-search-down
up-line-or-beginning-search
down-line-or-beginning-search
up-line-or-history
down-line-or-history
accept-line
)
# Widgets that accept the entire suggestion
ZSH_AUTOSUGGEST_ACCEPT_WIDGETS=(
forward-char
end-of-line
vi-forward-char
vi-end-of-line
vi-add-eol
)
# Widgets that accept the entire suggestion and execute it
ZSH_AUTOSUGGEST_EXECUTE_WIDGETS=(
)
# Widgets that accept the suggestion as far as the cursor moves
ZSH_AUTOSUGGEST_PARTIAL_ACCEPT_WIDGETS=(
forward-word
emacs-forward-word
vi-forward-word
vi-forward-word-end
vi-forward-blank-word
vi-forward-blank-word-end
vi-find-next-char
vi-find-next-char-skip
)
# Widgets that should be ignored (globbing supported but must be escaped)
ZSH_AUTOSUGGEST_IGNORE_WIDGETS=(
orig-\*
beep
run-help
set-local-history
which-command
yank
yank-pop
)
# Max size of buffer to trigger autosuggestion. Leave undefined for no upper bound.
ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE=
# Pty name for calculating autosuggestions asynchronously
ZSH_AUTOSUGGEST_ASYNC_PTY_NAME=zsh_autosuggest_pty

View File

@@ -0,0 +1,19 @@
#--------------------------------------------------------------------#
# Feature Detection #
#--------------------------------------------------------------------#
_zsh_autosuggest_feature_detect_zpty_returns_fd() {
typeset -g _ZSH_AUTOSUGGEST_ZPTY_RETURNS_FD
typeset -h REPLY
zpty zsh_autosuggest_feature_detect '{ zshexit() { kill -KILL $$; sleep 1 } }'
if (( REPLY )); then
_ZSH_AUTOSUGGEST_ZPTY_RETURNS_FD=1
else
_ZSH_AUTOSUGGEST_ZPTY_RETURNS_FD=0
fi
zpty -d zsh_autosuggest_feature_detect
}

View File

@@ -0,0 +1,26 @@
#--------------------------------------------------------------------#
# Highlighting #
#--------------------------------------------------------------------#
# If there was a highlight, remove it
_zsh_autosuggest_highlight_reset() {
typeset -g _ZSH_AUTOSUGGEST_LAST_HIGHLIGHT
if [[ -n "$_ZSH_AUTOSUGGEST_LAST_HIGHLIGHT" ]]; then
region_highlight=("${(@)region_highlight:#$_ZSH_AUTOSUGGEST_LAST_HIGHLIGHT}")
unset _ZSH_AUTOSUGGEST_LAST_HIGHLIGHT
fi
}
# If there's a suggestion, highlight it
_zsh_autosuggest_highlight_apply() {
typeset -g _ZSH_AUTOSUGGEST_LAST_HIGHLIGHT
if (( $#POSTDISPLAY )); then
typeset -g _ZSH_AUTOSUGGEST_LAST_HIGHLIGHT="$#BUFFER $(($#BUFFER + $#POSTDISPLAY)) $ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE"
region_highlight+=("$_ZSH_AUTOSUGGEST_LAST_HIGHLIGHT")
else
unset _ZSH_AUTOSUGGEST_LAST_HIGHLIGHT
fi
}

View File

@@ -0,0 +1,10 @@
#--------------------------------------------------------------------#
# Setup #
#--------------------------------------------------------------------#
# Precmd hooks for initializing the library and starting pty's
autoload -Uz add-zsh-hook
# Asynchronous suggestions are generated in a pty
zmodload zsh/zpty

View File

@@ -0,0 +1,24 @@
#--------------------------------------------------------------------#
# Start #
#--------------------------------------------------------------------#
# Start the autosuggestion widgets
_zsh_autosuggest_start() {
add-zsh-hook -d precmd _zsh_autosuggest_start
_zsh_autosuggest_bind_widgets
# Re-bind widgets on every precmd to ensure we wrap other wrappers.
# Specifically, highlighting breaks if our widgets are wrapped by
# zsh-syntax-highlighting widgets. This also allows modifications
# to the widget list variables to take effect on the next precmd.
add-zsh-hook precmd _zsh_autosuggest_bind_widgets
if [[ -n "${ZSH_AUTOSUGGEST_USE_ASYNC+x}" ]]; then
_zsh_autosuggest_async_start
fi
}
# Start the autosuggestion widgets on the next precmd
add-zsh-hook precmd _zsh_autosuggest_start

View File

@@ -0,0 +1,25 @@
#--------------------------------------------------------------------#
# Default Suggestion Strategy #
#--------------------------------------------------------------------#
# Suggests the most recent history item that matches the given
# prefix.
#
_zsh_autosuggest_strategy_default() {
# Reset options to defaults and enable LOCAL_OPTIONS
emulate -L zsh
# Enable globbing flags so that we can use (#m)
setopt EXTENDED_GLOB
# Escape backslashes and all of the glob operators so we can use
# this string as a pattern to search the $history associative array.
# - (#m) globbing flag enables setting references for match data
# TODO: Use (b) flag when we can drop support for zsh older than v5.0.8
local prefix="${1//(#m)[\\*?[\]<>()|^~#]/\\$MATCH}"
# Get the history items that match
# - (r) subscript flag makes the pattern match on values
typeset -g suggestion="${history[(r)${prefix}*]}"
}

View File

@@ -0,0 +1,59 @@
#--------------------------------------------------------------------#
# Match Previous Command Suggestion Strategy #
#--------------------------------------------------------------------#
# Suggests the most recent history item that matches the given
# prefix and whose preceding history item also matches the most
# recently executed command.
#
# For example, suppose your history has the following entries:
# - pwd
# - ls foo
# - ls bar
# - pwd
#
# Given the history list above, when you type 'ls', the suggestion
# will be 'ls foo' rather than 'ls bar' because your most recently
# executed command (pwd) was previously followed by 'ls foo'.
#
# Note that this strategy won't work as expected with ZSH options that don't
# preserve the history order such as `HIST_IGNORE_ALL_DUPS` or
# `HIST_EXPIRE_DUPS_FIRST`.
_zsh_autosuggest_strategy_match_prev_cmd() {
# Reset options to defaults and enable LOCAL_OPTIONS
emulate -L zsh
# Enable globbing flags so that we can use (#m)
setopt EXTENDED_GLOB
# TODO: Use (b) flag when we can drop support for zsh older than v5.0.8
local prefix="${1//(#m)[\\*?[\]<>()|^~#]/\\$MATCH}"
# Get all history event numbers that correspond to history
# entries that match pattern $prefix*
local history_match_keys
history_match_keys=(${(k)history[(R)$prefix*]})
# By default we use the first history number (most recent history entry)
local histkey="${history_match_keys[1]}"
# Get the previously executed command
local prev_cmd="$(_zsh_autosuggest_escape_command "${history[$((HISTCMD-1))]}")"
# Iterate up to the first 200 history event numbers that match $prefix
for key in "${(@)history_match_keys[1,200]}"; do
# Stop if we ran out of history
[[ $key -gt 1 ]] || break
# See if the history entry preceding the suggestion matches the
# previous command, and use it if it does
if [[ "${history[$((key - 1))]}" == "$prev_cmd" ]]; then
histkey="$key"
break
fi
done
# Give back the matched history entry
typeset -g suggestion="$history[$histkey]"
}

View File

@@ -0,0 +1,11 @@
#--------------------------------------------------------------------#
# Utility Functions #
#--------------------------------------------------------------------#
_zsh_autosuggest_escape_command() {
setopt localoptions EXTENDED_GLOB
# Escape special chars in the string (requires EXTENDED_GLOB)
echo -E "${1//(#m)[\"\'\\()\[\]|*?~]/\\$MATCH}"
}

View File

@@ -0,0 +1,213 @@
#--------------------------------------------------------------------#
# Autosuggest Widget Implementations #
#--------------------------------------------------------------------#
# Disable suggestions
_zsh_autosuggest_disable() {
typeset -g _ZSH_AUTOSUGGEST_DISABLED
_zsh_autosuggest_clear
}
# Enable suggestions
_zsh_autosuggest_enable() {
unset _ZSH_AUTOSUGGEST_DISABLED
if (( $#BUFFER )); then
_zsh_autosuggest_fetch
fi
}
# Toggle suggestions (enable/disable)
_zsh_autosuggest_toggle() {
if [[ -n "${_ZSH_AUTOSUGGEST_DISABLED+x}" ]]; then
_zsh_autosuggest_enable
else
_zsh_autosuggest_disable
fi
}
# Clear the suggestion
_zsh_autosuggest_clear() {
# Remove the suggestion
unset POSTDISPLAY
_zsh_autosuggest_invoke_original_widget $@
}
# Modify the buffer and get a new suggestion
_zsh_autosuggest_modify() {
local -i retval
# Only available in zsh >= 5.4
local -i KEYS_QUEUED_COUNT
# Save the contents of the buffer/postdisplay
local orig_buffer="$BUFFER"
local orig_postdisplay="$POSTDISPLAY"
# Clear suggestion while waiting for next one
unset POSTDISPLAY
# Original widget may modify the buffer
_zsh_autosuggest_invoke_original_widget $@
retval=$?
# Don't fetch a new suggestion if there's more input to be read immediately
if (( $PENDING > 0 )) || (( $KEYS_QUEUED_COUNT > 0 )); then
POSTDISPLAY="$orig_postdisplay"
return $retval
fi
# Optimize if manually typing in the suggestion
if (( $#BUFFER > $#orig_buffer )); then
local added=${BUFFER#$orig_buffer}
# If the string added matches the beginning of the postdisplay
if [[ "$added" = "${orig_postdisplay:0:$#added}" ]]; then
POSTDISPLAY="${orig_postdisplay:$#added}"
return $retval
fi
fi
# Don't fetch a new suggestion if the buffer hasn't changed
if [[ "$BUFFER" = "$orig_buffer" ]]; then
POSTDISPLAY="$orig_postdisplay"
return $retval
fi
# Bail out if suggestions are disabled
if [[ -n "${_ZSH_AUTOSUGGEST_DISABLED+x}" ]]; then
return $?
fi
# Get a new suggestion if the buffer is not empty after modification
if (( $#BUFFER > 0 )); then
if [[ -z "$ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE" ]] || (( $#BUFFER <= $ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE )); then
_zsh_autosuggest_fetch
fi
fi
return $retval
}
# Fetch a new suggestion based on what's currently in the buffer
_zsh_autosuggest_fetch() {
if zpty -t "$ZSH_AUTOSUGGEST_ASYNC_PTY_NAME" &>/dev/null; then
_zsh_autosuggest_async_request "$BUFFER"
else
local suggestion
_zsh_autosuggest_strategy_$ZSH_AUTOSUGGEST_STRATEGY "$BUFFER"
_zsh_autosuggest_suggest "$suggestion"
fi
}
# Offer a suggestion
_zsh_autosuggest_suggest() {
local suggestion="$1"
if [[ -n "$suggestion" ]] && (( $#BUFFER )); then
POSTDISPLAY="${suggestion#$BUFFER}"
else
unset POSTDISPLAY
fi
}
# Accept the entire suggestion
_zsh_autosuggest_accept() {
local -i max_cursor_pos=$#BUFFER
# When vicmd keymap is active, the cursor can't move all the way
# to the end of the buffer
if [[ "$KEYMAP" = "vicmd" ]]; then
max_cursor_pos=$((max_cursor_pos - 1))
fi
# Only accept if the cursor is at the end of the buffer
if [[ $CURSOR = $max_cursor_pos ]]; then
# Add the suggestion to the buffer
BUFFER="$BUFFER$POSTDISPLAY"
# Remove the suggestion
unset POSTDISPLAY
# Move the cursor to the end of the buffer
CURSOR=${#BUFFER}
fi
_zsh_autosuggest_invoke_original_widget $@
}
# Accept the entire suggestion and execute it
_zsh_autosuggest_execute() {
# Add the suggestion to the buffer
BUFFER="$BUFFER$POSTDISPLAY"
# Remove the suggestion
unset POSTDISPLAY
# Call the original `accept-line` to handle syntax highlighting or
# other potential custom behavior
_zsh_autosuggest_invoke_original_widget "accept-line"
}
# Partially accept the suggestion
_zsh_autosuggest_partial_accept() {
local -i retval cursor_loc
# Save the contents of the buffer so we can restore later if needed
local original_buffer="$BUFFER"
# Temporarily accept the suggestion.
BUFFER="$BUFFER$POSTDISPLAY"
# Original widget moves the cursor
_zsh_autosuggest_invoke_original_widget $@
retval=$?
# Normalize cursor location across vi/emacs modes
cursor_loc=$CURSOR
if [[ "$KEYMAP" = "vicmd" ]]; then
cursor_loc=$((cursor_loc + 1))
fi
# If we've moved past the end of the original buffer
if (( $cursor_loc > $#original_buffer )); then
# Set POSTDISPLAY to text right of the cursor
POSTDISPLAY="${BUFFER[$(($cursor_loc + 1)),$#BUFFER]}"
# Clip the buffer at the cursor
BUFFER="${BUFFER[1,$cursor_loc]}"
else
# Restore the original buffer
BUFFER="$original_buffer"
fi
return $retval
}
for action in clear modify fetch suggest accept partial_accept execute enable disable toggle; do
eval "_zsh_autosuggest_widget_$action() {
local -i retval
_zsh_autosuggest_highlight_reset
_zsh_autosuggest_$action \$@
retval=\$?
_zsh_autosuggest_highlight_apply
zle -R
return \$retval
}"
done
zle -N autosuggest-fetch _zsh_autosuggest_widget_fetch
zle -N autosuggest-suggest _zsh_autosuggest_widget_suggest
zle -N autosuggest-accept _zsh_autosuggest_widget_accept
zle -N autosuggest-clear _zsh_autosuggest_widget_clear
zle -N autosuggest-execute _zsh_autosuggest_widget_execute
zle -N autosuggest-enable _zsh_autosuggest_widget_enable
zle -N autosuggest-disable _zsh_autosuggest_widget_disable
zle -N autosuggest-toggle _zsh_autosuggest_widget_toggle

View File

@@ -0,0 +1 @@
source ${0:A:h}/zsh-autosuggestions.zsh

View File

@@ -0,0 +1,708 @@
# Fish-like fast/unobtrusive autosuggestions for zsh.
# https://github.com/zsh-users/zsh-autosuggestions
# v0.4.3
# Copyright (c) 2013 Thiago de Arruda
# Copyright (c) 2016-2018 Eric Freese
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
# files (the "Software"), to deal in the Software without
# restriction, including without limitation the rights to use,
# copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following
# conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
#--------------------------------------------------------------------#
# Setup #
#--------------------------------------------------------------------#
# Precmd hooks for initializing the library and starting pty's
autoload -Uz add-zsh-hook
# Asynchronous suggestions are generated in a pty
zmodload zsh/zpty
#--------------------------------------------------------------------#
# Global Configuration Variables #
#--------------------------------------------------------------------#
# Color to use when highlighting suggestion
# Uses format of `region_highlight`
# More info: http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html#Zle-Widgets
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=8'
# Prefix to use when saving original versions of bound widgets
ZSH_AUTOSUGGEST_ORIGINAL_WIDGET_PREFIX=autosuggest-orig-
ZSH_AUTOSUGGEST_STRATEGY=default
# Widgets that clear the suggestion
ZSH_AUTOSUGGEST_CLEAR_WIDGETS=(
history-search-forward
history-search-backward
history-beginning-search-forward
history-beginning-search-backward
history-substring-search-up
history-substring-search-down
up-line-or-beginning-search
down-line-or-beginning-search
up-line-or-history
down-line-or-history
accept-line
)
# Widgets that accept the entire suggestion
ZSH_AUTOSUGGEST_ACCEPT_WIDGETS=(
forward-char
end-of-line
vi-forward-char
vi-end-of-line
vi-add-eol
)
# Widgets that accept the entire suggestion and execute it
ZSH_AUTOSUGGEST_EXECUTE_WIDGETS=(
)
# Widgets that accept the suggestion as far as the cursor moves
ZSH_AUTOSUGGEST_PARTIAL_ACCEPT_WIDGETS=(
forward-word
emacs-forward-word
vi-forward-word
vi-forward-word-end
vi-forward-blank-word
vi-forward-blank-word-end
vi-find-next-char
vi-find-next-char-skip
)
# Widgets that should be ignored (globbing supported but must be escaped)
ZSH_AUTOSUGGEST_IGNORE_WIDGETS=(
orig-\*
beep
run-help
set-local-history
which-command
yank
yank-pop
)
# Max size of buffer to trigger autosuggestion. Leave undefined for no upper bound.
ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE=
# Pty name for calculating autosuggestions asynchronously
ZSH_AUTOSUGGEST_ASYNC_PTY_NAME=zsh_autosuggest_pty
#--------------------------------------------------------------------#
# Utility Functions #
#--------------------------------------------------------------------#
_zsh_autosuggest_escape_command() {
setopt localoptions EXTENDED_GLOB
# Escape special chars in the string (requires EXTENDED_GLOB)
echo -E "${1//(#m)[\"\'\\()\[\]|*?~]/\\$MATCH}"
}
#--------------------------------------------------------------------#
# Feature Detection #
#--------------------------------------------------------------------#
_zsh_autosuggest_feature_detect_zpty_returns_fd() {
typeset -g _ZSH_AUTOSUGGEST_ZPTY_RETURNS_FD
typeset -h REPLY
zpty zsh_autosuggest_feature_detect '{ zshexit() { kill -KILL $$; sleep 1 } }'
if (( REPLY )); then
_ZSH_AUTOSUGGEST_ZPTY_RETURNS_FD=1
else
_ZSH_AUTOSUGGEST_ZPTY_RETURNS_FD=0
fi
zpty -d zsh_autosuggest_feature_detect
}
#--------------------------------------------------------------------#
# Widget Helpers #
#--------------------------------------------------------------------#
_zsh_autosuggest_incr_bind_count() {
if ((${+_ZSH_AUTOSUGGEST_BIND_COUNTS[$1]})); then
((_ZSH_AUTOSUGGEST_BIND_COUNTS[$1]++))
else
_ZSH_AUTOSUGGEST_BIND_COUNTS[$1]=1
fi
typeset -gi bind_count=$_ZSH_AUTOSUGGEST_BIND_COUNTS[$1]
}
_zsh_autosuggest_get_bind_count() {
if ((${+_ZSH_AUTOSUGGEST_BIND_COUNTS[$1]})); then
typeset -gi bind_count=$_ZSH_AUTOSUGGEST_BIND_COUNTS[$1]
else
typeset -gi bind_count=0
fi
}
# Bind a single widget to an autosuggest widget, saving a reference to the original widget
_zsh_autosuggest_bind_widget() {
typeset -gA _ZSH_AUTOSUGGEST_BIND_COUNTS
local widget=$1
local autosuggest_action=$2
local prefix=$ZSH_AUTOSUGGEST_ORIGINAL_WIDGET_PREFIX
local -i bind_count
# Save a reference to the original widget
case $widgets[$widget] in
# Already bound
user:_zsh_autosuggest_(bound|orig)_*);;
# User-defined widget
user:*)
_zsh_autosuggest_incr_bind_count $widget
zle -N $prefix${bind_count}-$widget ${widgets[$widget]#*:}
;;
# Built-in widget
builtin)
_zsh_autosuggest_incr_bind_count $widget
eval "_zsh_autosuggest_orig_${(q)widget}() { zle .${(q)widget} }"
zle -N $prefix${bind_count}-$widget _zsh_autosuggest_orig_$widget
;;
# Completion widget
completion:*)
_zsh_autosuggest_incr_bind_count $widget
eval "zle -C $prefix${bind_count}-${(q)widget} ${${(s.:.)widgets[$widget]}[2,3]}"
;;
esac
_zsh_autosuggest_get_bind_count $widget
# Pass the original widget's name explicitly into the autosuggest
# function. Use this passed in widget name to call the original
# widget instead of relying on the $WIDGET variable being set
# correctly. $WIDGET cannot be trusted because other plugins call
# zle without the `-w` flag (e.g. `zle self-insert` instead of
# `zle self-insert -w`).
eval "_zsh_autosuggest_bound_${bind_count}_${(q)widget}() {
_zsh_autosuggest_widget_$autosuggest_action $prefix$bind_count-${(q)widget} \$@
}"
# Create the bound widget
zle -N $widget _zsh_autosuggest_bound_${bind_count}_$widget
}
# Map all configured widgets to the right autosuggest widgets
_zsh_autosuggest_bind_widgets() {
local widget
local ignore_widgets
ignore_widgets=(
.\*
_\*
zle-\*
autosuggest-\*
$ZSH_AUTOSUGGEST_ORIGINAL_WIDGET_PREFIX\*
$ZSH_AUTOSUGGEST_IGNORE_WIDGETS
)
# Find every widget we might want to bind and bind it appropriately
for widget in ${${(f)"$(builtin zle -la)"}:#${(j:|:)~ignore_widgets}}; do
if [[ -n ${ZSH_AUTOSUGGEST_CLEAR_WIDGETS[(r)$widget]} ]]; then
_zsh_autosuggest_bind_widget $widget clear
elif [[ -n ${ZSH_AUTOSUGGEST_ACCEPT_WIDGETS[(r)$widget]} ]]; then
_zsh_autosuggest_bind_widget $widget accept
elif [[ -n ${ZSH_AUTOSUGGEST_EXECUTE_WIDGETS[(r)$widget]} ]]; then
_zsh_autosuggest_bind_widget $widget execute
elif [[ -n ${ZSH_AUTOSUGGEST_PARTIAL_ACCEPT_WIDGETS[(r)$widget]} ]]; then
_zsh_autosuggest_bind_widget $widget partial_accept
else
# Assume any unspecified widget might modify the buffer
_zsh_autosuggest_bind_widget $widget modify
fi
done
}
# Given the name of an original widget and args, invoke it, if it exists
_zsh_autosuggest_invoke_original_widget() {
# Do nothing unless called with at least one arg
(( $# )) || return 0
local original_widget_name="$1"
shift
if (( ${+widgets[$original_widget_name]} )); then
zle $original_widget_name -- $@
fi
}
#--------------------------------------------------------------------#
# Highlighting #
#--------------------------------------------------------------------#
# If there was a highlight, remove it
_zsh_autosuggest_highlight_reset() {
typeset -g _ZSH_AUTOSUGGEST_LAST_HIGHLIGHT
if [[ -n "$_ZSH_AUTOSUGGEST_LAST_HIGHLIGHT" ]]; then
region_highlight=("${(@)region_highlight:#$_ZSH_AUTOSUGGEST_LAST_HIGHLIGHT}")
unset _ZSH_AUTOSUGGEST_LAST_HIGHLIGHT
fi
}
# If there's a suggestion, highlight it
_zsh_autosuggest_highlight_apply() {
typeset -g _ZSH_AUTOSUGGEST_LAST_HIGHLIGHT
if (( $#POSTDISPLAY )); then
typeset -g _ZSH_AUTOSUGGEST_LAST_HIGHLIGHT="$#BUFFER $(($#BUFFER + $#POSTDISPLAY)) $ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE"
region_highlight+=("$_ZSH_AUTOSUGGEST_LAST_HIGHLIGHT")
else
unset _ZSH_AUTOSUGGEST_LAST_HIGHLIGHT
fi
}
#--------------------------------------------------------------------#
# Autosuggest Widget Implementations #
#--------------------------------------------------------------------#
# Disable suggestions
_zsh_autosuggest_disable() {
typeset -g _ZSH_AUTOSUGGEST_DISABLED
_zsh_autosuggest_clear
}
# Enable suggestions
_zsh_autosuggest_enable() {
unset _ZSH_AUTOSUGGEST_DISABLED
if (( $#BUFFER )); then
_zsh_autosuggest_fetch
fi
}
# Toggle suggestions (enable/disable)
_zsh_autosuggest_toggle() {
if [[ -n "${_ZSH_AUTOSUGGEST_DISABLED+x}" ]]; then
_zsh_autosuggest_enable
else
_zsh_autosuggest_disable
fi
}
# Clear the suggestion
_zsh_autosuggest_clear() {
# Remove the suggestion
unset POSTDISPLAY
_zsh_autosuggest_invoke_original_widget $@
}
# Modify the buffer and get a new suggestion
_zsh_autosuggest_modify() {
local -i retval
# Only available in zsh >= 5.4
local -i KEYS_QUEUED_COUNT
# Save the contents of the buffer/postdisplay
local orig_buffer="$BUFFER"
local orig_postdisplay="$POSTDISPLAY"
# Clear suggestion while waiting for next one
unset POSTDISPLAY
# Original widget may modify the buffer
_zsh_autosuggest_invoke_original_widget $@
retval=$?
# Don't fetch a new suggestion if there's more input to be read immediately
if (( $PENDING > 0 )) || (( $KEYS_QUEUED_COUNT > 0 )); then
POSTDISPLAY="$orig_postdisplay"
return $retval
fi
# Optimize if manually typing in the suggestion
if (( $#BUFFER > $#orig_buffer )); then
local added=${BUFFER#$orig_buffer}
# If the string added matches the beginning of the postdisplay
if [[ "$added" = "${orig_postdisplay:0:$#added}" ]]; then
POSTDISPLAY="${orig_postdisplay:$#added}"
return $retval
fi
fi
# Don't fetch a new suggestion if the buffer hasn't changed
if [[ "$BUFFER" = "$orig_buffer" ]]; then
POSTDISPLAY="$orig_postdisplay"
return $retval
fi
# Bail out if suggestions are disabled
if [[ -n "${_ZSH_AUTOSUGGEST_DISABLED+x}" ]]; then
return $?
fi
# Get a new suggestion if the buffer is not empty after modification
if (( $#BUFFER > 0 )); then
if [[ -z "$ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE" ]] || (( $#BUFFER <= $ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE )); then
_zsh_autosuggest_fetch
fi
fi
return $retval
}
# Fetch a new suggestion based on what's currently in the buffer
_zsh_autosuggest_fetch() {
if zpty -t "$ZSH_AUTOSUGGEST_ASYNC_PTY_NAME" &>/dev/null; then
_zsh_autosuggest_async_request "$BUFFER"
else
local suggestion
_zsh_autosuggest_strategy_$ZSH_AUTOSUGGEST_STRATEGY "$BUFFER"
_zsh_autosuggest_suggest "$suggestion"
fi
}
# Offer a suggestion
_zsh_autosuggest_suggest() {
local suggestion="$1"
if [[ -n "$suggestion" ]] && (( $#BUFFER )); then
POSTDISPLAY="${suggestion#$BUFFER}"
else
unset POSTDISPLAY
fi
}
# Accept the entire suggestion
_zsh_autosuggest_accept() {
local -i max_cursor_pos=$#BUFFER
# When vicmd keymap is active, the cursor can't move all the way
# to the end of the buffer
if [[ "$KEYMAP" = "vicmd" ]]; then
max_cursor_pos=$((max_cursor_pos - 1))
fi
# Only accept if the cursor is at the end of the buffer
if [[ $CURSOR = $max_cursor_pos ]]; then
# Add the suggestion to the buffer
BUFFER="$BUFFER$POSTDISPLAY"
# Remove the suggestion
unset POSTDISPLAY
# Move the cursor to the end of the buffer
CURSOR=${#BUFFER}
fi
_zsh_autosuggest_invoke_original_widget $@
}
# Accept the entire suggestion and execute it
_zsh_autosuggest_execute() {
# Add the suggestion to the buffer
BUFFER="$BUFFER$POSTDISPLAY"
# Remove the suggestion
unset POSTDISPLAY
# Call the original `accept-line` to handle syntax highlighting or
# other potential custom behavior
_zsh_autosuggest_invoke_original_widget "accept-line"
}
# Partially accept the suggestion
_zsh_autosuggest_partial_accept() {
local -i retval cursor_loc
# Save the contents of the buffer so we can restore later if needed
local original_buffer="$BUFFER"
# Temporarily accept the suggestion.
BUFFER="$BUFFER$POSTDISPLAY"
# Original widget moves the cursor
_zsh_autosuggest_invoke_original_widget $@
retval=$?
# Normalize cursor location across vi/emacs modes
cursor_loc=$CURSOR
if [[ "$KEYMAP" = "vicmd" ]]; then
cursor_loc=$((cursor_loc + 1))
fi
# If we've moved past the end of the original buffer
if (( $cursor_loc > $#original_buffer )); then
# Set POSTDISPLAY to text right of the cursor
POSTDISPLAY="${BUFFER[$(($cursor_loc + 1)),$#BUFFER]}"
# Clip the buffer at the cursor
BUFFER="${BUFFER[1,$cursor_loc]}"
else
# Restore the original buffer
BUFFER="$original_buffer"
fi
return $retval
}
for action in clear modify fetch suggest accept partial_accept execute enable disable toggle; do
eval "_zsh_autosuggest_widget_$action() {
local -i retval
_zsh_autosuggest_highlight_reset
_zsh_autosuggest_$action \$@
retval=\$?
_zsh_autosuggest_highlight_apply
zle -R
return \$retval
}"
done
zle -N autosuggest-fetch _zsh_autosuggest_widget_fetch
zle -N autosuggest-suggest _zsh_autosuggest_widget_suggest
zle -N autosuggest-accept _zsh_autosuggest_widget_accept
zle -N autosuggest-clear _zsh_autosuggest_widget_clear
zle -N autosuggest-execute _zsh_autosuggest_widget_execute
zle -N autosuggest-enable _zsh_autosuggest_widget_enable
zle -N autosuggest-disable _zsh_autosuggest_widget_disable
zle -N autosuggest-toggle _zsh_autosuggest_widget_toggle
#--------------------------------------------------------------------#
# Default Suggestion Strategy #
#--------------------------------------------------------------------#
# Suggests the most recent history item that matches the given
# prefix.
#
_zsh_autosuggest_strategy_default() {
# Reset options to defaults and enable LOCAL_OPTIONS
emulate -L zsh
# Enable globbing flags so that we can use (#m)
setopt EXTENDED_GLOB
# Escape backslashes and all of the glob operators so we can use
# this string as a pattern to search the $history associative array.
# - (#m) globbing flag enables setting references for match data
# TODO: Use (b) flag when we can drop support for zsh older than v5.0.8
local prefix="${1//(#m)[\\*?[\]<>()|^~#]/\\$MATCH}"
# Get the history items that match
# - (r) subscript flag makes the pattern match on values
typeset -g suggestion="${history[(r)${prefix}*]}"
}
#--------------------------------------------------------------------#
# Match Previous Command Suggestion Strategy #
#--------------------------------------------------------------------#
# Suggests the most recent history item that matches the given
# prefix and whose preceding history item also matches the most
# recently executed command.
#
# For example, suppose your history has the following entries:
# - pwd
# - ls foo
# - ls bar
# - pwd
#
# Given the history list above, when you type 'ls', the suggestion
# will be 'ls foo' rather than 'ls bar' because your most recently
# executed command (pwd) was previously followed by 'ls foo'.
#
# Note that this strategy won't work as expected with ZSH options that don't
# preserve the history order such as `HIST_IGNORE_ALL_DUPS` or
# `HIST_EXPIRE_DUPS_FIRST`.
_zsh_autosuggest_strategy_match_prev_cmd() {
# Reset options to defaults and enable LOCAL_OPTIONS
emulate -L zsh
# Enable globbing flags so that we can use (#m)
setopt EXTENDED_GLOB
# TODO: Use (b) flag when we can drop support for zsh older than v5.0.8
local prefix="${1//(#m)[\\*?[\]<>()|^~#]/\\$MATCH}"
# Get all history event numbers that correspond to history
# entries that match pattern $prefix*
local history_match_keys
history_match_keys=(${(k)history[(R)$prefix*]})
# By default we use the first history number (most recent history entry)
local histkey="${history_match_keys[1]}"
# Get the previously executed command
local prev_cmd="$(_zsh_autosuggest_escape_command "${history[$((HISTCMD-1))]}")"
# Iterate up to the first 200 history event numbers that match $prefix
for key in "${(@)history_match_keys[1,200]}"; do
# Stop if we ran out of history
[[ $key -gt 1 ]] || break
# See if the history entry preceding the suggestion matches the
# previous command, and use it if it does
if [[ "${history[$((key - 1))]}" == "$prev_cmd" ]]; then
histkey="$key"
break
fi
done
# Give back the matched history entry
typeset -g suggestion="$history[$histkey]"
}
#--------------------------------------------------------------------#
# Async #
#--------------------------------------------------------------------#
# Zpty process is spawned running this function
_zsh_autosuggest_async_server() {
emulate -R zsh
# There is a bug in zpty module (fixed in zsh/master) by which a
# zpty that exits will kill all zpty processes that were forked
# before it. Here we set up a zsh exit hook to SIGKILL the zpty
# process immediately, before it has a chance to kill any other
# zpty processes.
zshexit() {
kill -KILL $$
sleep 1 # Block for long enough for the signal to come through
}
# Output only newlines (not carriage return + newline)
stty -onlcr
# Silence any error messages
exec 2>/dev/null
local last_pid
while IFS='' read -r -d $'\0' query; do
# Kill last bg process
kill -KILL $last_pid &>/dev/null
# Run suggestion search in the background
(
local suggestion
_zsh_autosuggest_strategy_$ZSH_AUTOSUGGEST_STRATEGY "$query"
echo -n -E "$suggestion"$'\0'
) &
last_pid=$!
done
}
_zsh_autosuggest_async_request() {
# Write the query to the zpty process to fetch a suggestion
zpty -w -n $ZSH_AUTOSUGGEST_ASYNC_PTY_NAME "${1}"$'\0'
}
# Called when new data is ready to be read from the pty
# First arg will be fd ready for reading
# Second arg will be passed in case of error
_zsh_autosuggest_async_response() {
setopt LOCAL_OPTIONS EXTENDED_GLOB
local suggestion
zpty -rt $ZSH_AUTOSUGGEST_ASYNC_PTY_NAME suggestion '*'$'\0' 2>/dev/null
zle autosuggest-suggest -- "${suggestion%%$'\0'##}"
}
_zsh_autosuggest_async_pty_create() {
# With newer versions of zsh, REPLY stores the fd to read from
typeset -h REPLY
# If we won't get a fd back from zpty, try to guess it
if (( ! $_ZSH_AUTOSUGGEST_ZPTY_RETURNS_FD )); then
integer -l zptyfd
exec {zptyfd}>&1 # Open a new file descriptor (above 10).
exec {zptyfd}>&- # Close it so it's free to be used by zpty.
fi
# Fork a zpty process running the server function
zpty -b $ZSH_AUTOSUGGEST_ASYNC_PTY_NAME _zsh_autosuggest_async_server
# Store the fd so we can remove the handler later
if (( REPLY )); then
_ZSH_AUTOSUGGEST_PTY_FD=$REPLY
else
_ZSH_AUTOSUGGEST_PTY_FD=$zptyfd
fi
# Set up input handler from the zpty
zle -F $_ZSH_AUTOSUGGEST_PTY_FD _zsh_autosuggest_async_response
}
_zsh_autosuggest_async_pty_destroy() {
# Remove the input handler
zle -F $_ZSH_AUTOSUGGEST_PTY_FD &>/dev/null
# Destroy the zpty
zpty -d $ZSH_AUTOSUGGEST_ASYNC_PTY_NAME &>/dev/null
}
_zsh_autosuggest_async_pty_recreate() {
_zsh_autosuggest_async_pty_destroy
_zsh_autosuggest_async_pty_create
}
_zsh_autosuggest_async_start() {
typeset -g _ZSH_AUTOSUGGEST_PTY_FD
_zsh_autosuggest_feature_detect_zpty_returns_fd
_zsh_autosuggest_async_pty_recreate
# We recreate the pty to get a fresh list of history events
add-zsh-hook precmd _zsh_autosuggest_async_pty_recreate
}
#--------------------------------------------------------------------#
# Start #
#--------------------------------------------------------------------#
# Start the autosuggestion widgets
_zsh_autosuggest_start() {
add-zsh-hook -d precmd _zsh_autosuggest_start
_zsh_autosuggest_bind_widgets
# Re-bind widgets on every precmd to ensure we wrap other wrappers.
# Specifically, highlighting breaks if our widgets are wrapped by
# zsh-syntax-highlighting widgets. This also allows modifications
# to the widget list variables to take effect on the next precmd.
add-zsh-hook precmd _zsh_autosuggest_bind_widgets
if [[ -n "${ZSH_AUTOSUGGEST_USE_ASYNC+x}" ]]; then
_zsh_autosuggest_async_start
fi
}
# Start the autosuggestion widgets on the next precmd
add-zsh-hook precmd _zsh_autosuggest_start

View File

@@ -1,15 +1,23 @@
Command-Not-Found
=================
Displays installation information for not found commands by loading the
[command-not-found][1] tool on Debian-based and Arch Linux-based distributions.
When you try to use a command that is not available locally, searches
the package manager for a package offering that command and suggests
the proper install command.
Debian-based and Arch Linux-based distributions use the [`command-not-found`][1] tool.
macOS uses Homebrew's [`command-not-found` clone][2]. Note that you also need to [follow the instructions to tap the `command-not-found` homebrew repository][3].
Authors
-------
*The authors of this module should be contacted via the [issue tracker][2].*
*The authors of this module should be contacted via the [issue tracker][4].*
- [Joseph Booker](https://github.com/sargas)
[1]: https://code.launchpad.net/command-not-found
[2]: https://github.com/sorin-ionescu/prezto/issues
[2]: https://github.com/Homebrew/homebrew-command-not-found
[3]: https://github.com/Homebrew/homebrew-command-not-found#install
[4]: https://github.com/sorin-ionescu/prezto/issues

View File

@@ -3,6 +3,7 @@
#
# Authors:
# Joseph Jon Booker <joe@neoturbine.net>
# Indrajit Raychaudhuri <irc+code@indrajit.com>
#
# Load command-not-found on Debian-based distributions.
@@ -11,6 +12,9 @@ if [[ -s '/etc/zsh_command_not_found' ]]; then
# Load command-not-found on Arch Linux-based distributions.
elif [[ -s '/usr/share/doc/pkgfile/command-not-found.zsh' ]]; then
source '/usr/share/doc/pkgfile/command-not-found.zsh'
# Load command-not-found on macOS when homebrew tap is configured.
elif [[ -s '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-command-not-found/handler.sh' ]]; then
source '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-command-not-found/handler.sh'
# Return if requirements are not found.
else
return 1

View File

@@ -6,6 +6,23 @@ the [zsh-completions][1] project.
This module must be loaded **after** the *utility* module.
Settings
--------
### Ignore */etc/hosts* Entries
To ignore certain entries from static */etc/hosts* for host completion, add the
following lines in *zpreztorc* with the IP addresses of the hosts as they
appear in */etc/hosts*. Both IP address and the corresponding hostname will be
ignored during host completion. However, some of the entries ignored from
*/etc/hosts* still might appear during completion because of their presence in
*ssh* configuration or history).
```sh
zstyle ':prezto:module:completion:*:hosts' etc-host-ignores \
'0.0.0.0' '127.0.0.1'
```
Contributors
------------

View File

@@ -0,0 +1 @@
gitdir: ../../../.git/modules/modules/completion/external

View File

@@ -0,0 +1,25 @@
The Z Shell is copyright (c) 1992-2017 Paul Falstad, Richard Coleman,
Zoltán Hidvégi, Andrew Main, Peter Stephenson, Sven Wischnowsky, and
others. All rights reserved. Individual authors, whether or not
specifically named, retain copyright in all changes; in what follows, they
are referred to as `the Zsh Development Group'. This is for convenience
only and this body has no legal status. The Z shell is distributed under
the following licence; any provisions made in individual files take
precedence.
Permission is hereby granted, without written agreement and without
licence or royalty fees, to use, copy, modify, and distribute this
software and to distribute modified versions of this software for any
purpose, provided that the above copyright notice and the following
two paragraphs appear in all copies of this software.
In no event shall the Zsh Development Group be liable to any party for
direct, indirect, special, incidental, or consequential damages arising out
of the use of this software and its documentation, even if the Zsh
Development Group have been advised of the possibility of such damage.
The Zsh Development Group specifically disclaim any warranties, including,
but not limited to, the implied warranties of merchantability and fitness
for a particular purpose. The software provided hereunder is on an "as is"
basis, and the Zsh Development Group have no obligation to provide
maintenance, support, updates, enhancements, or modifications.

View File

@@ -1,34 +1,49 @@
zsh-completions
===============
zsh-completions ![GitHub release](https://img.shields.io/github/release/zsh-users/zsh-completions.svg) ![GitHub contributors](https://img.shields.io/github/contributors/zsh-users/zsh-completions.svg) [![IRC](https://img.shields.io/badge/IRC-%23zsh--completions-yellow.svg)](irc://irc.freenode.net/#zsh-completions) [![Gitter](https://badges.gitter.im/zsh-users/zsh-completions.svg)](https://gitter.im/zsh-users/zsh-completions?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
=============
**Additional completion definitions for [Zsh](http://www.zsh.org).**
*This projects aims at gathering/developing new completion scripts that are not available in Zsh yet. The scripts are meant to be contributed to the Zsh project when stable enough.*
*This projects aims at gathering/developing new completion scripts that are not available in Zsh yet. The scripts may be contributed to the Zsh project when stable enough.*
Status
------
## Status
See [issues](https://github.com/zsh-users/zsh-completions/issues) for details on each completion definition.
Gentoo's completions have been removed, as they are maintained upstream. See: [Gentoo zsh-completions](https://github.com/radhermit/gentoo-zsh-completions)
Usage
-----
## Usage
#### Using packages
### Using packages
* Arch Linux: [community/zsh-completions](https://www.archlinux.org/packages/zsh-completions) / [AUR/zsh-completions-git](https://aur.archlinux.org/packages/zsh-completions-git/)
* [Gentoo](http://packages.gentoo.org/package/app-shells/zsh-completions)
* Mac OS: [Homebrew](https://github.com/mxcl/homebrew/blob/master/Library/Formula/zsh-completions.rb)
* Debian based distributions (Debian/Ubuntu/Linux Mint...): Packager needed, please get in touch !
* RPM based distributions (Fedora/RHEL/CentOS...): Packager needed, please get in touch !
| System | Package |
| ------------- | ------------- |
| Debian / Ubuntu | [zsh-completions OBS repository](https://software.opensuse.org/download.html?project=shells%3Azsh-users%3Azsh-completions&package=zsh-completions) |
| Fedora / CentOS / RHEL / Scientific Linux | [zsh-completions OBS repository](https://software.opensuse.org/download.html?project=shells%3Azsh-users%3Azsh-completions&package=zsh-completions) |
| OpenSUSE / SLE | [zsh-completions OBS repository](https://software.opensuse.org/download.html?project=shells%3Azsh-users%3Azsh-completions&package=zsh-completions) |
| Arch Linux | [zsh-completions](https://www.archlinux.org/packages/zsh-completions), [zsh-completions-git](https://aur.archlinux.org/packages/zsh-completions-git) |
| Gentoo | [app-shells/zsh-completions](http://packages.gentoo.org/package/app-shells/zsh-completions) |
| NixOS | [zsh-completions](https://github.com/NixOS/nixpkgs/blob/master/pkgs/shells/zsh-completions/default.nix) |
| Void Linux | [zsh-completions](https://github.com/voidlinux/void-packages/tree/master/srcpkgs/zsh-completions) |
| Mac OS | [homebrew](https://github.com/Homebrew/homebrew-core/blob/master/Formula/zsh-completions.rb) |
#### Using frameworks
### Using zsh frameworks
* If you're using [antigen](https://github.com/zsh-users/antigen), just add `antigen bundle zsh-users/zsh-completions src` to your .zshrc where you're loading your other zsh plugins.
#### [antigen](https://github.com/zsh-users/antigen)
Add `antigen bundle zsh-users/zsh-completions` to your `~/.zshrc`.
#### Manual installation
#### [oh-my-zsh](http://github.com/robbyrussell/oh-my-zsh)
* Clone the repository inside your oh-my-zsh repo:
git clone https://github.com/zsh-users/zsh-completions ~/.oh-my-zsh/custom/plugins/zsh-completions
* Enable it in your `.zshrc` by adding it to your plugin list and reloading the completion:
plugins=(… zsh-completions)
autoload -U compinit && compinit
### Manual installation
* Clone the repository:
@@ -42,36 +57,20 @@ Usage
rm -f ~/.zcompdump; compinit
#### oh-my-zsh
If you use [oh-my-zsh][] then just clone the repository inside your oh-my-zsh repo:
```Shell
git clone https://github.com/zsh-users/zsh-completions ~/.oh-my-zsh/custom/plugins/zsh-completions
```
and enable it in your `.zshrc`:
```zsh
plugins+=(zsh-completions)
autoload -U compinit && compinit
```
[oh-my-zsh]: http://github.com/robbyrussell/oh-my-zsh
Contributing
------------
### Contributing
Contributions are welcome, just make sure you follow the guidelines:
* Completions are not accepted when already available in zsh.
* Completions are not accepted when already available in their original project.
* Please do not just copy/paste someone else completion, ask before.
* Completions only partially implemented are not accepted.
* Please add a header containing authors, license info, status and origin of the script (example [here](src/_ack)).
* Please add a header containing authors, status and origin of the script and license header if you do not wish to use the Zsh license (example [here](src/_ack)).
* Please try to follow [Zsh completion style guide](https://github.com/zsh-users/zsh/blob/master/Etc/completion-style-guide).
* Please send one separate pull request per file.
* Send a pull request or ask for committer access.
License
-------
See each file for license details.
## License
Completions use the Zsh license, unless explicitely mentionned in the file header.
See [LICENSE](https://github.com/zsh-users/zsh-completions/blob/master/LICENSE) for more information.

View File

@@ -1,30 +1,5 @@
#compdef ack ack2 ack-grep ack-standalone
# ------------------------------------------------------------------------------
# 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
# -----------
#

View File

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

View File

@@ -0,0 +1,72 @@
#compdef afew
# ------------------------------------------------------------------------------
# Copyright (c) 2016 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 afew an initial tagging script for notmuch mail. (https://github.com/teythoon/afew)
#
# ------------------------------------------------------------------------------
# Authors
# -------
#
# * Jindřich Pilař (https://github.com/JindrichPilar)
#
# ------------------------------------------------------------------------------
_afew() {
_arguments -C \
'(- 1 *)'-h"[Show help and exit]" \
"(-c --classify -l --learn= -t --tag -u --update -U --update-reference -m --move-mails)"{-w,--watch}"[Continuously monitor the mailbox for new messages matching the given query]" \
"(-c --classify -l --learn= -u --update -U --update-reference -m --move-mails -w --watch)"{-t,--tag}"[Run the tag filters]" \
"(-c --classify -t --tag -u --update -U --update-reference -m --move-mails -w --watch)"{-l,--learn=}"[Train category with the messages matching query]" \
"(-c --classify -l --learn= -t --tag -U --update-reference -m --move-mails -w --watch)"{-u,--update}"[Update the categories (requires no query)]" \
"(-c --classify -l --learn= -t --tag -u --update -m --move-mails -w --watch)"{-U,--update-reference}"[Update the reference category (takes quite some time) (requires no query)]" \
"(-l --learn= -t --tag -u --update -U --update-reference -m --move-mails -w --watch)"{-c,--classify}"[Classify each message matching the iven query]" \
"(-c --classify -l --learn= -t --tag -u --update -U --update-reference -w --watch)"{-m,--move-mails}"[Move mail files between maildir folders]" \
"(-n --all)"{-a,--all}"[Operate on all email]" \
"(-a --new)"{-n,--new}"[Operate on all new email]" \
{-C,--notmuch-config=}"[Path to notmuch configuration file]:files:_files" \
{-e,--enable-filters=}"[Flter classes to use]:filters" \
{-d,--dry-run}"[Dont change the DB]" \
{-R,--reference-set-size=}"[Size of the reference set (default: 1000)]:size:" \
{-T,--reference-set-timeframe-days=}"[Do not use emails older than DAYS days (default: 30)]:days:" \
{--verbose,-v}"[Be more verbose]" \
'*:Query:' \
}
_afew
# Local Variables:
# mode: Shell-Script
# sh-indentation: 2
# indent-tabs-mode: nil
# sh-basic-offset: 2
# End:
# vim: ft=zsh sw=2 ts=2 et

View File

@@ -1,217 +0,0 @@
#compdef ag
# ------------------------------------------------------------------------------
# Copyright (c) 2015 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 ag (https://github.com/ggreer/the_silver_searcher)
#
# ------------------------------------------------------------------------------
# Authors
# -------
#
# * Akira Maeda <https://github.com/glidenote>
#
# ------------------------------------------------------------------------------
# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
# vim: ft=zsh sw=2 ts=2 et
# ------------------------------------------------------------------------------
_ag_version() {
local version
version=( $($words[1] --version) )
version=${version[@]:2:1}
version=( "${(@s/./)version}" )
echo "${version[2]}"
}
# Dynamically build the file type completion
# Modifies the global $AG_OPTS array
_ag_add_file_types() {
local typ exts
for i in $($words[1] --list-file-types); do
if [[ "${i:0:2}" = '--' ]]; then
if [[ "${typ}x" != "x" ]]; then
AG_OPTS+="${typ}[${exts}]"
fi
typ=$i
exts=
else
exts+=$i
fi
done
AG_OPTS+="${typ}[${exts}]"
}
# Add version appropriate options above base
# Modifies the global $AG_OPTS array
_ag_add_version_opts() {
local minor=$(_ag_version)
if [[ $minor -gt 21 ]];then
_ag_add_file_types
AG_OPTS+=(
'(- 1 *)--list-file-types[list supported filetypes to search]'
'--silent[suppress all log messages, including errors]'
)
fi
if [[ $minor -gt 22 ]];then
AG_OPTS+=(
'(-z --search-zip)'{-z,--search-zip}'[search contents of compressed files]'
)
fi
if [[ $minor -le 24 ]];then
AG_OPTS+=(
'(-s --case-sensitive)'{-s,--case-sensitive}'[match case sensitively]'
'(--noheading --heading)'{--noheading,--heading}'[print file names above matching contents]'
)
fi
if [[ $minor -gt 24 ]];then
AG_OPTS+=(
'(-s --case-sensitive)'{-s,--case-sensitive}'[Match case sensitively. Default on.]'
'(-H --noheading --heading)'{-H,--noheading,--heading}'[print file names above matching contents]'
'--vimgrep[output results like vim''s, :vimgrep /pattern/g would (report every match on the line)]'
)
fi
if [[ $minor -gt 26 ]];then
AG_OPTS+=(
'(-0 --null --print0)'{-0,--null,--print0}'[separate the filenames with \\0, rather than \\n]'
)
fi
if [[ $minor -le 27 ]];then
AG_OPTS+=(
'--depth[Search up to NUM directories deep. Default is 25.]:number'
)
fi
if [[ $minor -gt 27 ]];then
AG_OPTS+=(
'(-c --count)'{-c,--count}'[only print the number of matches in each file]'
'--depth[Search up to NUM directories deep, -1 for unlimited. Default is 25.]:number'
'(-F --fixed-strings)'{-F,--fixed-strings}'[alias for --literal for compatibility with grep]'
)
fi
if [[ $minor -le 28 ]];then
AG_OPTS+=(
'(--no-numbers)--no-numbers[don´t show line numbers]'
)
fi
if [[ $minor -gt 28 ]];then
AG_OPTS+=(
'(--nofilename --filename)'{--nofilename,--filename}'[Print file names. Default on, except when searching a single file.]'
'(--nonumbers --numbers)'{--nonumbers,--numbers}'[Print line numbers. Default is to omit line numbers when searching streams]'
'(-o --only-matching)'{-o,--only-matching}'[print only the matching part of the lines]'
)
fi
}
_ag() {
local curcontext="$curcontext" state line cmds update_policy ret=1
zstyle -s ":completion:${curcontext}:" cache-policy update_policy
[[ -z "$update_policy" ]] && zstyle ":completion:${curcontext}:" cache-policy _ag_types_caching_policy
# Don't complete if command doesn't exist
[[ ${+commands[${words[1]}]} -eq 0 ]] && return 0
if ( [[ ${+AG_OPTS} -eq 0 ]] || _cache_invalid "_AG_OPTS" ) && ! _retrieve_cache "_AG_OPTS"; then
# Base opts starts at ag version 0.20
AG_OPTS=(
'(- 1 *)--help[print a short help statement]'
'(- 1 *)--man[print the manual page]'
'(- 1 *)--version[display version and copyright information]'
'--ackmate[output results in a format parseable by AckMate]'
'(-A --after)'{-A,--after}'[Print NUM lines before match. Default is 2]:number'
'(-t --all-text -a --all-types -u --unrestricted)'{-t,--all-text}"[search all text files, excluding hidden ones]"
'(-a --all-types -t --all-text -u --unrestricted)'{-a,--all-types}"[search all text files, excluding hidden ones and not obeying ignore files (.agignore, .gitignore...)]"
'(-B --before)'{-B,--before}'[Print NUM lines after match. Defaults is 2]:number'
'(--nobreak --break)'{--nobreak,--break}'[Print a newline between matches in different files. Default on.]'
'(--color --nocolor)--color[Print color codes in results. Default on.]'
'(--nocolor --color --color-line-number --color-match --color-path)--nocolor[Do not print color codes in results. Default on.]'
'(--nocolor)--color-line-number[Color codes for line numbers. Default is 1;33.]'
'(--nocolor)--color-match[Color codes for result match numbers. Default is 30;43.]'
'(--nocolor)--color-path[Color codes for path names. Default is 1;32.]'
'--column[print column numbers in results]'
'(-C --context)'{-C,--context}'[Print NUM lines before and after matches. Default is 2.]:number'
'(-D --debug)'{-D,--debug}'[enable debug logging]'
'(-G --file-search-regex)'{-G,--file-search-regex}'[only search file names matching PATTERN]:pattern'
'(-l --files-with-matches)'{-l,--files-with-matches}'[only print filenames containing matches, not matching lines]'
'(-L --files-without-matches)'{-L,--files-without-matches}"[only print filenames that don't contain matches]"
'(-f --follow)'{-f,--follow}'[follow symlinks]'
'(-g)-g[print filenames that match PATTERN]:pattern'
'(--nogroup --group)'{--nogroup,--group}'[same as --\[no\]break --\[no\]heading]'
'--hidden[search hidden files, still obeys ignore files.]'
'*--ignore[Ignore files/directories matching this pattern. Literal file and directory names are also allowed.]:files:_files'
'(-i --ignore-case)'{-i,--ignore-case}'[match case insensitively]:pattern'
'*--ignore-dir[alias for --ignore for compatibility with ack]:files:_files'
'(-v --invert-match)'{-v,--invert-match}'[invert match]'
'(-Q --literal)'{-Q,--literal}'[match PATTERN literally, no regular expression]'
'(-m --max-count)'{-m,--max-count}'[Skip the rest of a file after NUM matches. Default is 10,000.]:number'
'(--pager --nopager)'{--pager,--nopager}'[Display results with PAGER. Disabled by default.]:pager program:_command_names'
'(--passthrough)--passthrough[when searching a stream, print all lines even if they don''t match]'
'(-p --path-to-agignore)'{-p,--path-to-agignore}'[provide a path to a specific .agignore file]:files:_files'
'--print-long-lines[print matches on very long lines, > 2k characters by default]'
'--search-binary[search binary files]'
'(-U --skip-vcs-ignores)'{-U,--skip-vcs-ignores}'[ignore VCS ignore files (.gitigore, .hgignore, svn:ignore), but still use .agignore]'
'(-S --smart-case)'{-S,--smart-case}'[match case sensitively if PATTERN contains any uppercase letters, else match case insensitively]'
'--stats[print stats (files scanned, time taken, etc)]'
'(-u --unrestricted -t --all-text -a --all-types)'{-u,--unrestricted}'[search ALL files, includes: hidden, binary & ignored files (.agignore, .gitignore...)]'
'(-w --word-regexp)'{-w,--word-regexp}'[only match whole words]'
)
_ag_add_version_opts
AG_OPTS+=(
'*: :_files'
)
[[ $#AG_OPTS -gt 0 ]] && _store_cache '_AG_OPTS' AG_OPTS
fi
_arguments -C -s -S ${AG_OPTS} && ret=0
unset AG_OPTS
case $state in
# placeholder
esac
return ret
}
_ag_types_caching_policy() {
# Rebuild if .agignore more recent than cache.
[[ -f $HOME/.agignore && $$HOME/.agignore -nt "$1" ]] && return 0
# Rebuild if cache is older than one week.
local -a oldp
oldp=( "$1"(Nmw+1) )
(( $#oldp )) && return 0
return 1
}
_ag "$@"

View File

@@ -1,30 +1,5 @@
#compdef android
# ------------------------------------------------------------------------------
# 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
# -----------
#
@@ -238,6 +213,8 @@ _android_cmds() {
'update:update a virtual device, project, SDK or adb'
'move:move a virtual device'
'delete:delete a virtual device'
'avd:displays the AVD Manager window'
'sdk:displays the SDK Manager window'
'display:display manager windows'
)
_describe -t commands 'command' commands "$@"

View File

@@ -28,13 +28,14 @@
# Description
# -----------
#
# Completion script for ansible v1.8.4 (http://ansible.org)
# Completion script for ansible v2.0.0.2 (http://ansible.org)
#
# ------------------------------------------------------------------------------
# Authors
# -------
#
# * Romain Bossart (https://github.com/bosr)
# * Adam Stevko (https://github.com/xen0l)
#
# ------------------------------------------------------------------------------
#
@@ -61,6 +62,7 @@ __host_file_location () {
[[ "$OSTYPE" == darwin* ]] && FALLBACK="/usr/local/etc/ansible/hosts"
[[ "$OSTYPE" == linux* ]] && FALLBACK="/etc/ansible/hosts"
HOST_FILE=${ANSIBLE_HOSTS:=${FALLBACK}}
[[ -f ${HOST_FILE} ]] || HOST_FILE="$PWD/ansible/inventory/hosts"
[[ -f ${HOST_FILE} ]] || HOST_FILE=/dev/null
echo ${HOST_FILE}
@@ -91,7 +93,7 @@ __host_list ()
local -a mixed_host_list
mixed_host_list=$(command \
cat ${HOST_FILE} \
| awk 'NF && $1 !~ /[\[:=]/ { print $1 }' \
| awk 'NF && $1 !~ /^[[:space:]]*#|[\[:=]/ { print $1 }' \
| sort | uniq)
# compute set difference h1 - h2
@@ -120,15 +122,16 @@ __group_list ()
_modules=(
'a10_server:(E) Manage A10 Networks AX/SoftAX/Thunder/vThunder devices'
'a10_service_group:(E) Manage A10 Networks AX/SoftAX/Thunder/vThunder devices'
'a10_virtual_server:(E) Manage A10 Networks AX/SoftAX/Thunder/vThunder devices'
'a10_server:Manage A10 Networks AX/SoftAX/Thunder/vThunder devices'
'a10_service_group:Manage A10 Networks devices service groups'
'a10_virtual_server:Manage A10 Networks devices virtual servers'
'accelerate:Enable accelerated mode on remote node'
'acl:Sets and retrieves file ACL information.'
'add_host:add a host (and alternatively a group) to the ansible-playbook in-memory inventory'
'airbrake_deployment:(E) Notify airbrake about app deployments'
'alternatives:(E) Manages alternative programs for common commands'
'airbrake_deployment:Notify airbrake about app deployments'
'alternatives:Manages alternative programs for common commands'
'apache2_module:enables/disables a module of the Apache2 webserver'
'apk:Manages apk packages'
'apt:Manages apt-packages'
'apt_key:Add or remove an apt key'
'apt_repository:Add and remove APT repositories'
@@ -136,165 +139,334 @@ _modules=(
'assemble:Assembles a configuration file from fragments'
'assert:Fail with custom message'
'async_status:Obtain status of asynchronous task'
'at:(E) Schedule the execution of a command or script file via the at command.'
'at:Schedule the execution of a command or script file via the at command.'
'authorized_key:Adds or removes an SSH authorized key'
'azure:create or terminate a virtual machine in azure'
'bigip_facts:(E) Collect facts from F5 BIG-IP devices'
'bigip_monitor_http:(E) Manages F5 BIG-IP LTM http monitors'
'bigip_monitor_tcp:(E) Manages F5 BIG-IP LTM tcp monitors'
'bigip_node:(E) Manages F5 BIG-IP LTM nodes'
'bigip_pool:(E) Manages F5 BIG-IP LTM pools'
'bigip_pool_member:(E) Manages F5 BIG-IP LTM pool members'
'bigpanda:(E) Notify BigPanda about deployments'
'boundary_meter:(E) Manage boundary meters'
'bower:(E) Manage bower packages with bower'
'bzr:(E) Deploy software (or files) from bzr branches'
'campfire:(E) Send a message to Campfire'
'capabilities:(E) Manage Linux capabilities'
'cloudformation:create a AWS CloudFormation stack'
'bigip_facts:Collect facts from F5 BIG-IP devices'
'bigip_gtm_wide_ip:Manages F5 BIG-IP GTM wide ip'
'bigip_monitor_http:Manages F5 BIG-IP LTM http monitors'
'bigip_monitor_tcp:Manages F5 BIG-IP LTM tcp monitors'
'bigip_node:Manages F5 BIG-IP LTM nodes'
'bigip_pool:Manages F5 BIG-IP LTM pools'
'bigip_pool_member:Manages F5 BIG-IP LTM pool members'
'bigip_virtual_server:Manages F5 BIG-IP LTM virtual servers'
'bigpanda:Notify BigPanda about deployments'
'blockinfile:Insert/update/remove a text block surrounded by marker lines.'
'boundary_meter:Manage boundary meters'
'bower:Manage bower packages with bower'
'bundler:Manage Ruby Gem dependencies with Bundler'
'bzr:Deploy software (or files) from bzr branches'
'campfire:Send a message to Campfire'
'capabilities:Manage Linux capabilities'
'circonus_annotation:create an annotation in circonus'
'cl_bond:Configures a bond port on Cumulus Linux'
'cl_bridge:Configures a bridge port on Cumulus Linux'
'cl_img_install:Install a different Cumulus Linux version.'
'cl_interface:Configures a front panel port, loopback or management port on Cumulus Linux.'
'cl_interface_policy:Configure interface enforcement policy on Cumulus Linux'
'cl_license:Install Cumulus Linux license'
'cl_ports:Configure Cumulus Switch port attributes (ports.conf)'
'clc_aa_policy:Create or Delete Anti Affinity Policies at CenturyLink Cloud.'
'clc_alert_policy:Create or Delete Alert Policies at CenturyLink Cloud.'
'clc_blueprint_package:deploys a blue print package on a set of servers in CenturyLink Cloud.'
'clc_firewall_policy:Create/delete/update firewall policies'
'clc_group:Create/delete Server Groups at Centurylink Cloud'
'clc_loadbalancer:Create, Delete shared loadbalancers in CenturyLink Cloud.'
'clc_modify_server:modify servers in CenturyLink Cloud.'
'clc_publicip:Add and Delete public ips on servers in CenturyLink Cloud.'
'clc_server:Create, Delete, Start and Stop servers in CenturyLink Cloud.'
'clc_server_snapshot:Create, Delete and Restore server snapshots in CenturyLink Cloud.'
'cloudflare_dns:manage Cloudflare DNS records'
'cloudformation:Create or delete an AWS CloudFormation stack'
'cloudtrail:manage CloudTrail creation and deletion'
'command:Executes a command on a remote node'
'composer:(E) Dependency Manager for PHP'
'composer:Dependency Manager for PHP'
'consul:Add, modify & delete services within a consul cluster.'
'consul_acl:manipulate consul acl keys and rules'
'consul_kv:Manipulate entries in the key/value store of a consul cluster.'
'consul_session:manipulate consul sessions'
'copy:Copies files to remote locations.'
'cpanm:(E) Manages Perl library dependencies.'
'cpanm:Manages Perl library dependencies.'
'cron:Manage cron.d and crontab entries.'
'crypttab:(E) Encrypted Linux block devices'
'datadog_event:(E) Posts events to DataDog service'
'debconf:(E) Configure a .deb package'
'cronvar:Manage variables in crontabs'
'crypttab:Encrypted Linux block devices'
'cs_account:Manages accounts on Apache CloudStack based clouds.'
'cs_affinitygroup:Manages affinity groups on Apache CloudStack based clouds.'
'cs_cluster:Manages host clusters on Apache CloudStack based clouds.'
'cs_configuration:Manages configuration on Apache CloudStack based clouds.'
'cs_domain:Manages domains on Apache CloudStack based clouds.'
'cs_facts:Gather facts on instances of Apache CloudStack based clouds.'
'cs_firewall:Manages firewall rules on Apache CloudStack based clouds.'
'cs_instance:Manages instances and virtual machines on Apache CloudStack based clouds.'
'cs_instance_facts:Gathering facts from the API of instances from Apache CloudStack based clouds.'
'cs_instancegroup:Manages instance groups on Apache CloudStack based clouds.'
'cs_ip_address:Manages public IP address associations on Apache CloudStack based clouds.'
'cs_iso:Manages ISO images on Apache CloudStack based clouds.'
'cs_loadbalancer_rule:Manages load balancer rules on Apache CloudStack based clouds.'
'cs_loadbalancer_rule_member:Manages load balancer rule members on Apache CloudStack based clouds.'
'cs_network:Manages networks on Apache CloudStack based clouds.'
'cs_pod:Manages pods on Apache CloudStack based clouds.'
'cs_portforward:Manages port forwarding rules on Apache CloudStack based clouds.'
'cs_project:Manages projects on Apache CloudStack based clouds.'
'cs_resourcelimit:Manages resource limits on Apache CloudStack based clouds.'
'cs_securitygroup:Manages security groups on Apache CloudStack based clouds.'
'cs_securitygroup_rule:Manages security group rules on Apache CloudStack based clouds.'
'cs_sshkeypair:Manages SSH keys on Apache CloudStack based clouds.'
'cs_staticnat:Manages static NATs on Apache CloudStack based clouds.'
'cs_template:Manages templates on Apache CloudStack based clouds.'
'cs_user:Manages users on Apache CloudStack based clouds.'
'cs_vmsnapshot:Manages VM snapshots on Apache CloudStack based clouds.'
'cs_volume:Manages volumes on Apache CloudStack based clouds.'
'cs_zone:Manages zones on Apache CloudStack based clouds.'
'cs_zone_facts:Gathering facts of zones from Apache CloudStack based clouds.'
'datadog_event:Posts events to DataDog service'
'datadog_monitor:Manages Datadog monitors'
'debconf:Configure a .deb package'
'debug:Print statements during execution'
'deploy_helper:Manages some of the steps common in deploying projects.'
'digital_ocean:Create/delete a droplet/SSH_key in DigitalOcean'
'digital_ocean_domain:Create/delete a DNS record in DigitalOcean'
'digital_ocean_sshkey:Create/delete an SSH key in DigitalOcean'
'django_manage:Manages a Django application.'
'dnf:(E) Manages packages with the I(dnf) package manager'
'dnsimple:(E) Interface with dnsimple.com (a DNS hosting service).'
'dnsmadeeasy:(E) Interface with dnsmadeeasy.com (a DNS hosting service).'
'dnf:Manages packages with the *dnf* package manager'
'dnsimple:Interface with dnsimple.com (a DNS hosting service).'
'dnsmadeeasy:Interface with dnsmadeeasy.com (a DNS hosting service).'
'docker:manage docker containers'
'docker_image (D):manage docker images'
'docker_image:manage docker images'
'docker_login:Manage Docker registry logins'
'dpkg_selections:Dpkg package selection selections'
'dynamodb_table:Create, update or delete AWS Dynamo DB tables.'
'easy_install:Installs Python libraries'
'ec2:create, terminate, start or stop an instance in ec2'
'ec2_ami:create or destroy an image in ec2'
'ec2_ami_search:Retrieve AWS AMI information for a given operating system.'
'ec2_ami_copy:copies AMI between AWS regions, return new image id'
'ec2_ami_find:Searches for AMIs to obtain the AMI ID and other information'
'ec2_ami_search(D):Retrieve AWS AMI information for a given operating system.'
'ec2_asg:Create or delete AWS Autoscaling Groups'
'ec2_eip:associate an EC2 elastic IP with an instance.'
'ec2_elb:De-registers or registers instances from EC2 ELBs'
'ec2_elb_facts:Gather facts about EC2 Elastic Load Balancers in AWS'
'ec2_elb_lb:Creates or destroys Amazon ELB.'
'ec2_eni:Create and optionally attach an Elastic Network Interface (ENI) to an instance'
'ec2_eni_facts:Gather facts about ec2 ENI interfaces in AWS'
'ec2_facts:Gathers facts about remote hosts within ec2 (aws)'
'ec2_group:maintain an ec2 VPC security group.'
'ec2_key:maintain an ec2 key pair.'
'ec2_lc:Create or delete AWS Autoscaling Launch Configurations'
'ec2_metric_alarm:Create/update or delete AWS Cloudwatch metric alarms'
'ec2_remote_facts:Gather facts about ec2 instances in AWS'
'ec2_scaling_policy:Create or delete AWS scaling policies for Autoscaling groups'
'ec2_snapshot:creates a snapshot from an existing volume'
'ec2_tag:create and remove tag(s) to ec2 resources.'
'ec2_vol:create and attach a volume, return volume id and device map'
'ec2_vol_facts:Gather facts about ec2 volumes in AWS'
'ec2_vpc:configure AWS virtual private clouds'
'ejabberd_user:(E) Manages users for ejabberd servers'
'ec2_vpc_dhcp_options:Manages DHCP Options, and can ensure the DHCP options for the given VPC match whats requested'
'ec2_vpc_igw:Manage an AWS VPC Internet gateway'
'ec2_vpc_net:Configure AWS virtual private clouds'
'ec2_vpc_net_facts:Gather facts about ec2 VPCs in AWS'
'ec2_vpc_route_table:Manage route tables for AWS virtual private clouds'
'ec2_vpc_route_table_facts:Gather facts about ec2 VPC route tables in AWS'
'ec2_vpc_subnet:Manage subnets in AWS virtual private clouds'
'ec2_vpc_subnet_facts:Gather facts about ec2 VPC subnets in AWS'
'ec2_win_password:gets the default administrator password for ec2 windows instances'
'ecs_cluster:create or terminate ecs clusters'
'ecs_service:create, terminate, start or stop a service in ecs'
'ecs_service_facts:list or describe services in ecs'
'ecs_task:run, start or stop a task in ecs'
'ecs_taskdefinition:register a task definition in ecs'
'ejabberd_user:Manages users for ejabberd servers'
'elasticache:Manage cache clusters in Amazon Elasticache.'
'facter:(E) Runs the discovery program I(facter) on the remote system'
'elasticache_subnet_group:manage Elasticache subnet groups'
'elasticsearch_plugin:Manage Elasticsearch plugins'
'eos_command:Run arbitrary command on EOS device'
'eos_config:Manage Arista EOS configuration sections'
'eos_eapi:Manage and configure EAPI. Requires EOS v4.12 or greater.'
'eos_template:Manage Arista EOS device configurations'
'expect:Executes a command and responds to prompts'
'facter:Runs the discovery program *facter* on the remote system'
'fail:Fail with custom message'
'fetch:Fetches a file from remote nodes'
'file:Sets attributes of files'
'filesystem:(E) Makes file system on block device'
'fireball:Enable fireball mode on remote node'
'firewalld:(E) Manage arbitrary ports/services with firewalld'
'flowdock:(E) Send a message to a flowdock'
'filesystem:Makes file system on block device'
'find:return a list of files based on specific criteria'
'fireball(D):Enable fireball mode on remote node'
'firewalld:Manage arbitrary ports/services with firewalld'
'flowdock:Send a message to a flowdock'
'gc_storage:This module manages objects/buckets in Google Cloud Storage.'
'gce:create or terminate GCE instances'
'gce_img:(E) utilize GCE image resources'
'gce_img:utilize GCE image resources'
'gce_lb:create/destroy GCE load-balancer resources'
'gce_net:create/destroy GCE networks and firewall rules'
'gce_pd:utilize GCE persistent disk resources'
'gce_tag:add or remove tag(s) to/from GCE instance'
'gem:Manage Ruby gems'
'get_url:Downloads files from HTTP, HTTPS, or FTP to node'
'getent:(E) a wrapper to the unix getent utility'
'getent:a wrapper to the unix getent utility'
'git:Deploy software (or files) from git checkouts'
'github_hooks:(E) Manages github service hooks.'
'glance_image:Add/Delete images from glance'
'gluster_volume:(E) Manage GlusterFS volumes'
'github_hooks:Manages github service hooks.'
'glance_image(D):Add/Delete images from glance'
'gluster_volume:Manage GlusterFS volumes'
'group:Add or remove groups'
'group_by:Create Ansible groups based on facts'
'grove:(E) Sends a notification to a grove.io channel'
'haproxy:(E) An Ansible module to handle states enable/disable server and set weight to backend host in haproxy using socket commands.'
'grove:Sends a notification to a grove.io channel'
'hall:Send notification to Hall'
'haproxy:Enable, disable, and set weights for HAProxy backend servers using socket commands.'
'hg:Manages Mercurial (hg) repositories.'
'hipchat:(E) Send a message to hipchat'
'homebrew:(E) Package manager for Homebrew'
'homebrew_cask:(E) Install/uninstall homebrew casks.'
'homebrew_tap:(E) Tap a Homebrew repository.'
'hipchat:Send a message to hipchat.'
'homebrew:Package manager for Homebrew'
'homebrew_cask:Install/uninstall homebrew casks.'
'homebrew_tap:Tap a Homebrew repository.'
'hostname:Manage hostname'
'htpasswd:manage user files for basic authentication'
'iam:Manage IAM users, groups, roles and keys'
'iam_cert:Manage server certificates for use on ELBs and CloudFront'
'iam_policy:Manage IAM policies for users, groups, and roles'
'include_vars:Load variables from files, dynamically within a task.'
'ini_file:Tweak settings in INI files'
'irc:(E) Send a message to an IRC channel'
'jabber:(E) Send a message to jabber user or chat room'
'jboss:(E) deploy applications to JBoss'
'jira:(E) create and modify issues in a JIRA instance'
'kernel_blacklist:(E) Blacklist kernel modules'
'keystone_user:Manage OpenStack Identity (keystone) users, tenants and roles'
'layman:(E) Manage Gentoo overlays'
'librato_annotation:(E) create an annotation in librato'
'ios_command:Run arbitrary commands on ios devices.'
'ios_config:Manage Cisco IOS configuration sections'
'ios_template:Manage Cisco IOS device configurations over SSH'
'iosxr_command:Run arbitrary commands on ios devices.'
'iosxr_config:Manage Cisco IOS XR configuration sections'
'iosxr_template:Manage Cisco IOS device configurations over SSH'
'ipify_facts:Retrieve the public IP of your internet gateway.'
'iptables:Modify the systems iptables'
'irc:Send a message to an IRC channel'
'jabber:Send a message to jabber user or chat room'
'jboss:deploy applications to JBoss'
'jira:create and modify issues in a JIRA instance'
'junos_command:Execute arbitrary commands on Juniper JUNOS devices'
'junos_config:Manage Juniper JUNOS configuration sections'
'junos_template:Manage Juniper JUNOS device configurations'
'kernel_blacklist:Blacklist kernel modules'
'keystone_user(D):Manage OpenStack Identity (keystone) users, tenants and roles'
'known_hosts:Add or remove a host from the ``known_hosts`` file'
'layman:Manage Gentoo overlays'
'librato_annotation:create an annotation in librato'
'lineinfile:Ensure a particular line is in a file, or replace an existing line using a back-referenced regular expression.'
'linode:create / delete / stop / restart an instance in Linode Public Cloud'
'lldp:(E) get details reported by lldp'
'locale_gen:(E) Creates or removes locales.'
'logentries:(E) Module for tracking logs via logentries.com'
'lvg:(E) Configure LVM volume groups'
'lvol:(E) Configure LVM logical volumes'
'macports:(E) Package manager for MacPorts'
'mail:(E) Send an email'
'modprobe:(E) Add or remove kernel modules'
'mongodb_user:(E) Adds or removes a user from a MongoDB database.'
'monit:(E) Manage the state of a program monitored via Monit'
'lldp:get details reported by lldp'
'locale_gen:Creates or removes locales.'
'logentries:Module for tracking logs via logentries.com'
'lvg:Configure LVM volume groups'
'lvol:Configure LVM logical volumes'
'lxc_container:Manage LXC Containers'
'macports:Package manager for MacPorts'
'mail:Send an email'
'maven_artifact:Downloads an Artifact from a Maven Repository'
'modprobe:Add or remove kernel modules'
'mongodb_user:Adds or removes a user from a MongoDB database.'
'monit:Manage the state of a program monitored via Monit'
'mount:Control active and configured mount points'
'mqtt:(E) Publish a message on an MQTT topic for the IoT'
'mqtt:Publish a message on an MQTT topic for the IoT'
'mysql_db:Add or remove MySQL databases from a remote host.'
'mysql_replication:(E) Manage MySQL replication'
'mysql_replication:Manage MySQL replication'
'mysql_user:Adds or removes a user from a MySQL database.'
'mysql_variables:Manage MySQL global variables'
'nagios:(E) Perform common tasks in Nagios related to downtime and notifications.'
'netscaler:(E) Manages Citrix NetScaler entities'
'newrelic_deployment:(E) Notify newrelic about app deployments'
'nexmo:(E) Send a SMS via nexmo'
'nova_compute:Create/Delete VMs from OpenStack'
'nova_keypair:Add/Delete key pair from nova'
'npm:(E) Manage node.js packages with npm'
'ohai:(E) Returns inventory data from I(Ohai)'
'open_iscsi:(E) Manage iscsi targets with open-iscsi'
'openbsd_pkg:(E) Manage packages on OpenBSD.'
'openvswitch_bridge:(E) Manage Open vSwitch bridges'
'openvswitch_port:(E) Manage Open vSwitch ports'
'opkg:(E) Package manager for OpenWrt'
'osx_say:(E) Makes an OSX computer to speak.'
'ovirt:(E) oVirt/RHEV platform management'
'pacman:(E) Manage packages with I(pacman)'
'pagerduty:(E) Create PagerDuty maintenance windows'
'patch:(E) Apply patch files using the GNU patch tool.'
'nagios:Perform common tasks in Nagios related to downtime and notifications.'
'netscaler:Manages Citrix NetScaler entities'
'newrelic_deployment:Notify newrelic about app deployments'
'nexmo:Send a SMS via nexmo'
'nmcli:Manage Networking'
'nova_compute(D):Create/Delete VMs from OpenStack'
'nova_keypair(D):Add/Delete key pair from nova'
'npm:Manage node.js packages with npm'
'nxos_command:Run arbitrary command on Cisco NXOS devices'
'nxos_config:Manage Cisco NXOS configuration sections'
'nxos_nxapi:Manage NXAPI configuration on an NXOS device.'
'nxos_template:Manage Cisco NXOS device configurations'
'ohai:Returns inventory data from *Ohai*'
'open_iscsi:Manage iscsi targets with open-iscsi'
'openbsd_pkg:Manage packages on OpenBSD.'
'openvswitch_bridge:Manage Open vSwitch bridges'
'openvswitch_db:Configure open vswitch database.'
'openvswitch_port:Manage Open vSwitch ports'
'opkg:Package manager for OpenWrt'
'ops_command:Run arbitrary commands on OpenSwitch devices.'
'ops_config:Manage OpenSwitch configuration using CLI'
'ops_template:Push configuration to OpenSwitch'
'os_auth:Retrieve an auth token'
'os_client_config:Get OpenStack Client config'
'os_flavor_facts:Retrieve facts about one or more flavors'
'os_floating_ip:Add/Remove floating IP from an instance'
'os_group:Manage OpenStack Identity Groups'
'os_image:Add/Delete images from OpenStack Cloud'
'os_image_facts:Retrieve facts about an image within OpenStack.'
'os_ironic:Create/Delete Bare Metal Resources from OpenStack'
'os_ironic_node:Activate/Deactivate Bare Metal Resources from OpenStack'
'os_keypair:Add/Delete a keypair from OpenStack'
'os_keystone_domain:Manage OpenStack Identity Domains'
'os_keystone_role:Manage OpenStack Identity Roles'
'os_network:Creates/removes networks from OpenStack'
'os_networks_facts:Retrieve facts about one or more OpenStack networks.'
'os_nova_flavor:Manage OpenStack compute flavors'
'os_object:Create or Delete objects and containers from OpenStack'
'os_port:Add/Update/Delete ports from an OpenStack cloud.'
'os_project:Manage OpenStack Projects'
'os_router:Create or delete routers from OpenStack'
'os_security_group:Add/Delete security groups from an OpenStack cloud.'
'os_security_group_rule:Add/Delete rule from an existing security group'
'os_server:Create/Delete Compute Instances from OpenStack'
'os_server_actions:Perform actions on Compute Instances from OpenStack'
'os_server_facts:Retrieve facts about one or more compute instances'
'os_server_volume:Attach/Detach Volumes from OpenStack VMs'
'os_subnet:Add/Remove subnet to an OpenStack network'
'os_subnets_facts:Retrieve facts about one or more OpenStack subnets.'
'os_user:Manage OpenStack Identity Users'
'os_user_group:Associate OpenStack Identity users and groups'
'os_volume:Create/Delete Cinder Volumes'
'osx_defaults:osx_defaults allows users to read, write, and delete Mac OS X user defaults from Ansible'
'osx_say:Makes an OSX computer to speak.'
'ovirt:oVirt/RHEV platform management'
'package:Generic OS package manager'
'pacman:Manage packages with *pacman*'
'pagerduty:Create PagerDuty maintenance windows'
'pagerduty_alert:Trigger, acknowledge or resolve PagerDuty incidents'
'pam_limits:Modify Linux PAM limits'
'patch:Apply patch files using the GNU patch tool.'
'pause:Pause playbook execution'
'ping:Try to connect to host and return C(pong) on success.'
'pingdom:(E) Pause/unpause Pingdom alerts'
'pear:Manage pear/pecl packages'
'ping:Try to connect to host, verify a usable python and return ``pong`` on success.'
'pingdom:Pause/unpause Pingdom alerts'
'pip:Manages Python library dependencies.'
'pkg5:(E) Manages packages with the Solaris 11 Image Packaging System'
'pkg5_publisher:(E) Manages Solaris 11 Image Packaging System publishers'
'pkgin:(E) Package manager for SmartOS'
'pkgng:(E) Package manager for FreeBSD >= 9.0'
'pkgutil:(E) Manage CSW-Packages on Solaris'
'portage:(E) Package manager for Gentoo'
'portinstall:(E) Installing packages from FreeBSDs ports system'
'pkg5:Manages packages with the Solaris 11 Image Packaging System'
'pkg5_publisher:Manages Solaris 11 Image Packaging System publishers'
'pkgin:Package manager for SmartOS, NetBSD, et al.'
'pkgng:Package manager for FreeBSD >= 9.0'
'pkgutil:Manage CSW-Packages on Solaris'
'portage:Package manager for Gentoo'
'portinstall:Installing packages from FreeBSDs ports system'
'postgresql_db:Add or remove PostgreSQL databases from a remote host.'
'postgresql_lang:(E) Adds, removes or changes procedural languages with a PostgreSQL database.'
'postgresql_ext:Add or remove PostgreSQL extensions from a database.'
'postgresql_lang:Adds, removes or changes procedural languages with a PostgreSQL database.'
'postgresql_privs:Grant or revoke privileges on PostgreSQL database objects.'
'postgresql_user:Adds or removes a users (roles) from a PostgreSQL database.'
'quantum_floating_ip:Add/Remove floating IP from an instance'
'quantum_floating_ip_associate:Associate or disassociate a particular floating IP with an instance'
'quantum_network:Creates/Removes networks from OpenStack'
'quantum_router:Create or Remove router from openstack'
'quantum_router_gateway:set/unset a gateway interface for the router with the specified external network'
'quantum_router_interface:Attach/Dettach a subnets interface to a router'
'quantum_subnet:Add/remove subnet from a network'
'rabbitmq_parameter:(E) Adds or removes parameters to RabbitMQ'
'rabbitmq_plugin:(E) Adds or removes plugins to RabbitMQ'
'rabbitmq_policy:(E) Manage the state of policies in RabbitMQ.'
'rabbitmq_user:(E) Adds or removes users to RabbitMQ'
'rabbitmq_vhost:(E) Manage the state of a virtual host in RabbitMQ'
'profitbricks:Create, destroy, start, stop, and reboot a ProfitBricks virtual machine.'
'profitbricks_datacenter:Create or destroy a ProfitBricks Virtual Datacenter.'
'profitbricks_nic:Create or Remove a NIC.'
'profitbricks_volume:Create or destroy a volume.'
'profitbricks_volume_attachments:Attach or detach a volume.'
'proxmox:management of instances in Proxmox VE cluster'
'proxmox_template:management of OS templates in Proxmox VE cluster'
'puppet:Runs puppet'
'pushbullet:Sends notifications to Pushbullet'
'pushover:Send notifications via https'
'quantum_floating_ip(D):Add/Remove floating IP from an instance'
'quantum_floating_ip_associate(D):Associate or disassociate a particular floating IP with an instance'
'quantum_network(D):Creates/Removes networks from OpenStack'
'quantum_router(D):Create or Remove router from openstack'
'quantum_router_gateway(D):set/unset a gateway interface for the router with the specified external network'
'quantum_router_interface(D):Attach/Dettach a subnets interface to a router'
'quantum_subnet(D):Add/remove subnet from a network'
'rabbitmq_binding:This module manages rabbitMQ bindings'
'rabbitmq_exchange:This module manages rabbitMQ exchanges'
'rabbitmq_parameter:Adds or removes parameters to RabbitMQ'
'rabbitmq_plugin:Adds or removes plugins to RabbitMQ'
'rabbitmq_policy:Manage the state of policies in RabbitMQ.'
'rabbitmq_queue:This module manages rabbitMQ queues'
'rabbitmq_user:Adds or removes users to RabbitMQ'
'rabbitmq_vhost:Manage the state of a virtual host in RabbitMQ'
'raw:Executes a low-down and dirty SSH command'
'rax:create / delete an instance in Rackspace Public Cloud'
'rax_cbs:Manipulate Rackspace Cloud Block Storage Volumes'
@@ -304,6 +476,7 @@ _modules=(
'rax_cdb_user:create / delete a Rackspace Cloud Database'
'rax_clb:create / delete a load balancer in Rackspace Public Cloud'
'rax_clb_nodes:add, modify and remove nodes from a Rackspace Cloud Load Balancer'
'rax_clb_ssl:Manage SSL termination for a Rackspace Cloud Load Balancer.'
'rax_dns:Manage domains on Rackspace Cloud DNS'
'rax_dns_record:Manage DNS records on Rackspace Cloud DNS'
'rax_facts:Gather facts for Rackspace Cloud Servers'
@@ -312,6 +485,11 @@ _modules=(
'rax_identity:Load Rackspace Cloud Identity'
'rax_keypair:Create a keypair for use with Rackspace Cloud Servers'
'rax_meta:Manipulate metadata for Rackspace Cloud Servers'
'rax_mon_alarm:Create or delete a Rackspace Cloud Monitoring alarm.'
'rax_mon_check:Create or delete a Rackspace Cloud Monitoring check for an existing entity.'
'rax_mon_entity:Create or delete a Rackspace Cloud Monitoring entity'
'rax_mon_notification:Create or delete a Rackspace Cloud Monitoring notification.'
'rax_mon_notification_plan:Create or delete a Rackspace Cloud Monitoring notification plan.'
'rax_network:create / delete an isolated network in Rackspace Public Cloud'
'rax_queue:create / delete a queue in Rackspace Public Cloud'
'rax_scaling_group:Manipulate Rackspace Cloud Autoscale Groups'
@@ -319,65 +497,144 @@ _modules=(
'rds:create, delete, or modify an Amazon rds instance'
'rds_param_group:manage RDS parameter groups'
'rds_subnet_group:manage RDS database subnet groups'
'redhat_subscription:Manage Red Hat Network registration and subscriptions using the C(subscription-manager) command'
'redis:(E) Various redis commands, slave and flush'
'redhat_subscription:Manage Red Hat Network registration and subscriptions using the ``subscription-manager`` command'
'redis:Various redis commands, slave and flush'
'replace:Replace all instances of a particular string in a file using a back-referenced regular expression.'
'rhn_channel:Adds or removes Red Hat software channels'
'rhn_register:Manage Red Hat Network registration using the C(rhnreg_ks) command'
'riak:(E) This module handles some common Riak operations'
'rollbar_deployment:(E) Notify Rollbar about app deployments'
'rhn_register:Manage Red Hat Network registration using the ``rhnreg_ks`` command'
'riak:This module handles some common Riak operations'
'rollbar_deployment:Notify Rollbar about app deployments'
'route53:add or delete entries in Amazons Route53 DNS service'
'route53_facts:Retrieves route53 details using AWS methods'
'route53_health_check:add or delete health-checks in Amazons Route53 DNS service'
'route53_zone:add or delete Route53 zones'
'rpm_key:Adds or removes a gpg key from the rpm db'
's3:S3 module putting a file into S3.'
's3:manage objects in S3.'
's3_bucket:Manage s3 buckets in AWS'
's3_lifecycle:Manage s3 bucket lifecycle rules in AWS'
's3_logging:Manage logging facility of an s3 bucket in AWS'
'script:Runs a local script on a remote node after transferring it'
'seboolean:Toggles SELinux booleans.'
'selinux:Change policy and state of SELinux'
'selinux_permissive:Change permissive domain in SELinux policy'
'sendgrid:Sends an email with the SendGrid API'
'sensu_check:Manage Sensu checks'
'seport:Manages SELinux network port type definitions'
'service:Manage services.'
'set_fact:Set host facts from a task'
'setup:Gathers facts about remote hosts'
'shell:Execute commands in nodes.'
'slack:(E) Send Slack notifications'
'slack:Send Slack notifications'
'slackpkg:Package manager for Slackware >= 12.2'
'slurp:Slurps a file from remote nodes'
'snmp_facts:(E) Retrieve facts for a device using SNMP.'
'sns:(E) Send Amazon Simple Notification Service (SNS) messages'
'stackdriver:(E) Send code deploy and annotation events to stackdriver'
'snmp_facts:Retrieve facts for a device using SNMP.'
'sns:Send Amazon Simple Notification Service (SNS) messages'
'sns_topic:Manages AWS SNS topics and subscriptions'
'solaris_zone:Manage Solaris zones'
'sqs_queue:Creates or deletes AWS SQS queues.'
'stackdriver:Send code deploy and annotation events to stackdriver'
'stat:retrieve file or file system status'
'sts_assume_role:Assume a role using AWS Security Token Service and obtain temporary credentials'
'subversion:Deploys a subversion repository.'
'supervisorctl:Manage the state of a program or group of programs running via supervisord'
'svc:(E) Manage daemontools services.'
'svr4pkg:(E) Manage Solaris SVR4 packages'
'swdepot:(E) Manage packages with swdepot package manager (HP-UX)'
'svc:Manage daemontools services.'
'svr4pkg:Manage Solaris SVR4 packages'
'swdepot:Manage packages with swdepot package manager (HP-UX)'
'synchronize:Uses rsync to make synchronizing file paths in your playbooks quick and easy.'
'sysctl:Manage entries in sysctl.conf.'
'taiga_issue:Creates/deletes an issue in a Taiga Project Management Platform'
'template:Templates a file out to a remote server.'
'twilio:(E) Sends a text message to a mobile phone through Twilio.'
'typetalk:(E) Send a message to typetalk'
'ufw:(E) Manage firewall with UFW'
'unarchive:Copies an archive to a remote location and unpack it'
'uptimerobot:(E) Pause and start Uptime Robot monitoring'
'twilio:Sends a text message to a mobile phone through Twilio.'
'typetalk:Send a message to typetalk'
'ufw:Manage firewall with UFW'
'unarchive:Unpacks an archive after (optionally) copying it from the local machine.'
'uptimerobot:Pause and start Uptime Robot monitoring'
'uri:Interacts with webservices'
'urpmi:(E) Urpmi manager'
'urpmi:Urpmi manager'
'user:Manage user accounts'
'virt:(E) Manages virtual machines supported by libvirt'
'vca_fw:add remove firewall rules in a gateway in a vca'
'vca_nat:add remove nat rules in a gateway in a vca'
'vca_vapp:Manages vCloud Air vApp instances.'
'vertica_configuration:Updates Vertica configuration parameters.'
'vertica_facts:Gathers Vertica database facts.'
'vertica_role:Adds or removes Vertica database roles and assigns roles to them.'
'vertica_schema:Adds or removes Vertica database schema and roles.'
'vertica_user:Adds or removes Vertica database users and assigns roles.'
'virt:Manages virtual machines supported by libvirt'
'virt_net:Manage libvirt network configuration'
'virt_pool:Manage libvirt storage pools'
'vmware_cluster:Create VMware vSphere Cluster'
'vmware_datacenter:Manage VMware vSphere Datacenters'
'vmware_dns_config:Manage VMware ESXi DNS Configuration'
'vmware_dvs_host:Add or remove a host from distributed virtual switch'
'vmware_dvs_portgroup:Create or remove a Distributed vSwitch portgroup'
'vmware_dvswitch:Create or remove a distributed vSwitch'
'vmware_host:Add/remove ESXi host to/from vCenter'
'vmware_migrate_vmk:Migrate a VMK interface from VSS to VDS'
'vmware_portgroup:Create a VMware portgroup'
'vmware_target_canonical_facts:Return canonical (NAA) from an ESXi host'
'vmware_vm_facts:Return basic facts pertaining to a vSphere virtual machine guest'
'vmware_vm_shell:Execute a process in VM'
'vmware_vm_vss_dvs_migrate:Migrates a virtual machine from a standard vswitch to distributed'
'vmware_vmkernel:Create a VMware VMkernel Interface'
'vmware_vmkernel_ip_config:Configure the VMkernel IP Address'
'vmware_vsan_cluster:Configure VSAN clustering on an ESXi host'
'vmware_vswitch:Add a VMware Standard Switch to an ESXi host'
'vsphere_copy:Copy a file to a vCenter datastore'
'vsphere_guest:Create/delete/manage a guest VM through VMware vSphere.'
'wait_for:Waits for a condition before continuing.'
'win_chocolatey:(E) Installs packages using chocolatey'
'webfaction_app:Add or remove applications on a Webfaction host'
'webfaction_db:Add or remove a database on Webfaction'
'webfaction_domain:Add or remove domains and subdomains on Webfaction'
'webfaction_mailbox:Add or remove mailboxes on Webfaction'
'webfaction_site:Add or remove a website on a Webfaction host'
'win_acl:Set file/directory permissions for a system user or group.'
'win_chocolatey:Installs packages using chocolatey'
'win_copy:Copies files to remote locations on windows hosts.'
'win_dotnet_ngen:Runs ngen to recompile DLLs after .NET updates'
'win_environment:Modifies environment variables on windows hosts.'
'win_feature:Installs and uninstalls Windows Features'
'win_file:Creates, touches or removes files or directories.'
'win_file_version:Get DLL or EXE file build version'
'win_firewall_rule:Windows firewall automation'
'win_get_url:Fetches a file from a given URL'
'win_group:Add and remove local groups'
'win_iis_virtualdirectory:Configures a virtual directory in IIS.'
'win_iis_webapplication:Configures a IIS Web application.'
'win_iis_webapppool:Configures a IIS Web Application Pool.'
'win_iis_webbinding:Configures a IIS Web site.'
'win_iis_website:Configures a IIS Web site.'
'win_lineinfile:Ensure a particular line is in a file, or replace an existing line using a back-referenced regular expression.'
'win_msi:Installs and uninstalls Windows MSI files'
'win_nssm:NSSM '
'win_package:Installs/Uninstalls a installable package, either from local file system or url'
'win_ping:A windows version of the classic ping module.'
'win_regedit:Add, Edit, or Remove Registry Keys and Values'
'win_regmerge:Merges the contents of a registry file into the windows registry'
'win_scheduled_task:Manage scheduled tasks'
'win_service:Manages Windows services'
'win_share:Manage Windows shares'
'win_stat:returns information about a Windows file'
'win_updates:(E) Lists / Installs windows updates'
'win_template:Templates a file out to a remote server.'
'win_timezone:Sets Windows machine timezone'
'win_unzip:Unzips compressed files and archives on the Windows node'
'win_updates:Download and install Windows updates'
'win_uri:Interacts with webservices.'
'win_user:Manages local Windows user accounts'
'win_webpicmd:Installs packages using Web Platform Installer command-line'
'xattr:set/retrieve extended attributes'
'yum:Manages packages with the I(yum) package manager'
'zabbix_group:(E) Add or remove a host group to Zabbix.'
'zabbix_maintenance:(E) Create Zabbix maintenance windows'
'zfs:(E) Manage zfs'
'zypper:(E) Manage packages on SUSE and openSUSE'
'zypper_repository:(E) Add and remove Zypper repositories'
'xenserver_facts:get facts reported on xenserver'
'yum:Manages packages with the *yum* package manager'
'yum_repository:Add and remove YUM repositories'
'zabbix_group:Zabbix host groups creates/deletes'
'zabbix_host:Zabbix host creates/updates/deletes'
'zabbix_hostmacro:Zabbix host macro creates/updates/deletes'
'zabbix_maintenance:Create Zabbix maintenance windows'
'zabbix_screen:Zabbix screen creates/updates/deletes'
'zfs:Manage zfs'
'znode:Create, delete, retrieve, and update znodes using ZooKeeper.'
'zypper:Manage packages on SUSE and openSUSE'
'zypper_repository:Add and remove Zypper repositories'
)
@@ -389,13 +646,19 @@ _ansible ()
_arguments -C -W \
'1:pattern:->pattern'\
"(-a --args)"{-a,--args}"[ARGS module arguments]:arguments:(ARG)"\
"(-k --ask-pass)"{-k,--ask-pass}"[ask for SSH password]"\
'--ask-su-pass[ask for su password]'\
"(-K --ask-sudo-pass)"{-K,--ask-sudo-pass}"[ask for sudo password]"\
'--ask-become-pass[ask for privilege escalation password]'\
"(-k --ask-pass)"{-k,--ask-pass}"[ask for connection password]"\
'--ask-su-pass[ask for su password (deprecated, use become)]'\
"(-K --ask-sudo-pass)"{-K,--ask-sudo-pass}"[ask for sudo password (deprecated, use become)]"\
'--ask-vault-pass[ask for vault password]'\
"(-B --background)"{-B,--background}"[DURATION run asynchronously for DURATION (s)]:duration:(DURATION)"\
"(-b --become)"{-b,--become}"[run operations with become (nopasswd implied)]"\
'--become-method[privilege escalation method to use (default=sudo)]:method:(sudo su pbrun pfexec runas doas)'\
'--become-user[run operations as this user (default=root)]:user:(USER)'\
"(-C --check)"{-C,--check}"[don't make any changes]"\
"(-c --connection)"{-c,--connection}"[CONNECTION connection type to use (default=smart)]:connection type:(smart ssh local chroot)"\
"(-D --diff)"{-D,--diff}"[show differences when changing (small) files and templates]"\
"(-e --extra-vars)"{-e,--extra-vars}"[set additional variables as key=value or YAML/JSON]"\
"(-f --forks)"{-f,--forks}"[FORKS number of parallel processes to use (default=5)]:forks:(5)"\
"(-h --help)"{-h,--help}"[help message]"\
"(-i --inventory-file)"{-i,--inventory-file}"[INVENTORY specify inventory host file]:inventory file:_files"\
@@ -403,13 +666,20 @@ _ansible ()
'--list-hosts[outputs a list of matching hosts. Does not execute anything else]'\
"(-m --module-name)"{-m,--module-name}"[MODULE_NAME module name (default=command)]:module name:->module"\
"(-M --module-path)"{-M,--module-path}"[MODULE_PATH specify path to module library (default=None)]:module path:_files -/"\
'--new-vault-password-file[new vault password file for rekey]:new vault password file:_files'\
"(-o --one-line)"{-o,--one-line}"[condense output]"\
'--output[output file name for encrypt or decrypt; use - for stdout]:output file:_files'\
"(-P --poll)"{-P,--poll}"[POLL_INTERVAL set the poll interval (s) if using -B (default=15)]:poll interval:(15)"\
"--private-key[PRIVATE_KEY_FILE use this file to authenticate the connection]:private key file:_files"\
"(-S --su)"{-S,--su}"[run operations with su]"\
"(-R --su-user)"{-R,--su-user}"[SU_USER run operations with su as this user (default=root)]:su user:(root)"\
"(-s --sudo)"{-s,--sudo}"[run operations with sudo (nopasswd)]"\
"(-U --sudo-user)"{-U,--sudo-user}"[SUDO_USER desired sudo user (default=root)]:su user:(root)"\
'--private-key[PRIVATE_KEY_FILE use this file to authenticate the connection]:private key file:_files'\
'--scp-extra-args[specify extra arguments to pass to scp only]'\
'--sftp-extra-args[specify extra arguments to pass to sftp only]'\
'--ssh-common-args[specify common arguments to pass to sftp/scp/ssh]'\
'--ssh-extra-args[specify extra arguments to pass to ssh only]'\
"(-S --su)"{-S,--su}"[run operations with su (deprecated, use become)]"\
"(-R --su-user)"{-R,--su-user}"[SU_USER run operations with su as this user (default=root) (deprecated, use become)]:su user:(root)"\
"(-s --sudo)"{-s,--sudo}"[run operations with sudo (nopasswd) (deprecated, use become)]"\
"(-U --sudo-user)"{-U,--sudo-user}"[SUDO_USER desired sudo user (default=root) (deprecated, use become)]:su user:(root)"\
'--syntax-check[perform a syntax check on the playbook, but do not execute it]'\
"(-T --timeout)"{-T,--timeout}"[TIMEOUT override the SSH timeout (s) (default=10)]:ssh timeout:(10)"\
"(-t --tree)"{-t,--tree}"[OUTPUT_DIRECTORY log output to this directory]:output directory:_files -/"\
"(-u --user)"{-u,--user}"[REMOTE_USER connect as this user (default=${USER})]:connect as user:(${USER})"\

View File

@@ -28,13 +28,14 @@
# Description
# -----------
#
# Completion script for ansible-galaxy v1.8.4 (http://ansible.org)
# Completion script for ansible-galaxy v2.0.0.2 (http://ansible.org)
#
# ------------------------------------------------------------------------------
# Authors
# -------
#
# * Romain Bossart (https://github.com/bosr)
# * Adam Stevko (https://github.com/xen0l)
#
# ------------------------------------------------------------------------------
#
@@ -50,51 +51,122 @@ _ansible-galaxy ()
typeset -A opt_args
_arguments -C \
"1:command:(init info install list remove)" \
"1:command:(delete import info init install list login remove search setup)" \
"*::option:->option"
case $state in
option)
case $line[1] in
init)
_arguments \
delete)
_arguments \
"(-h --help)"{-h,--help}"[help message]" \
"(-p --init-path)"{-p,--init-path}"[INIT_PATH path in which the skeleton role will be created (default=./)]:init path:(./)" \
"(--offline)--offline[Don't query the galaxy API when creating roles]" \
"(-c --ignore-certs)"{-c,--ignore-certs}"[Ignore SSL certificate validation errors.]" \
"(-s --server)"{-s,--server}"[API_SERVER The API server destination]:api server:(http://apiserver)" \
"(-f --force)"{-f,--force}"[Force overwriting an existing role]" \
":role name:(ROLE)"
"(-v --verbose)"{-v,--verbose}"[verbose mode (-vvv for more, -vvvv to enable connection debugging)]" \
"--version[show program's version number and exit]" \
":github_user:(GITHUB_USER)" \
":github_repo:(GITHUB_REPO)"
;;
import)
_arguments \
"--branch[REFERENCE The name of a branch to import.]:reference:(master)" \
"(-h --help)"{-h,--help}"[help message]" \
"(-c --ignore-certs)"{-c,--ignore-certs}"[Ignore SSL certificate validation errors.]" \
"--no-wait[Don't wait for import results.]" \
"(-s --server)"{-s,--server}"[API_SERVER The API server destination]:api server:(http://apiserver)" \
"--status[Check the status of the most recent import request forgiven github_user/github_repo.]" \
"(-v --verbose)"{-v,--verbose}"[verbose mode (-vvv for more, -vvvv to enable connection debugging)]" \
"--version[show program's version number and exit]" \
":github_user:(GITHUB_USER)" \
":github_repo:(GITHUB_REPO)"
;;
info)
_arguments \
"(-h --help)"{-h,--help}"[help message]" \
"(-c --ignore-certs)"{-c,--ignore-certs}"[Ignore SSL certificate validation errors.]" \
"(-p --roles-path)"{-p,--roles-path}"[ROLES_PATH The path to the directory containing your roles (default: from ansible.cfg)]:roles path:_files -/" \
"(-s --server)"{-s,--server}"[API_SERVER The API server destination]:api server:(http://apiserver)" \
"(-v --verbose)"{-v,--verbose}"[verbose mode (-vvv for more, -vvvv to enable connection debugging)]" \
"--version[show program's version number and exit]" \
":role name:(ROLE,version)"
;;
init)
_arguments \
"(-f --force)"{-f,--force}"[ Force overwriting an existing role]" \
"(-h --help)"{-h,--help}"[help message]" \
"(-c --ignore-certs)"{-c,--ignore-certs}"[Ignore SSL certificate validation errors.]" \
"(-p --init-path)"{-p,--init-path}"[INIT_PATH path in which the skeleton role will be created (default=./)]:init path:(./)" \
"(--offline)--offline[Don't query the galaxy API when creating roles]" \
"(-s --server)"{-s,--server}"[API_SERVER The API server destination]:api server:(http://apiserver)" \
"(-v --verbose)"{-v,--verbose}"[verbose mode (-vvv for more, -vvvv to enable connection debugging)]" \
"--version[show program's version number and exit]" \
":role name:(ROLE)"
;;
install)
_arguments \
"(-f --force)"{-f,--force}"[Force overwriting an existing role]" \
"(-h --help)"{-h,--help}"[help message]" \
"(-c --ignore-certs)"{-c,--ignore-certs}"[Ignore SSL certificate validation errors.]" \
"(-i --ignore-errors)"{-i,--ignore-errors}"[Ignore errors and continue with the next specified role]" \
"(-n --no-deps)"{-n,--no-deps}"[Don't download roles listed as dependencies]" \
"(-r --role-file)"{-r,--role-file}"[ROLE_FILE A file containing a list of roles to be imported]:role file:_files" \
"(-p --roles-path)"{-p,--roles-path}"[ROLES_PATH The path to the directory containing your roles (default: from ansible.cfg)]:roles path:_files -/" \
"(-s --server)"{-s,--server}"[API_SERVER The API server destination]:api server:(http://apiserver)" \
"(-f --force)"{-f,--force}"[Force overwriting an existing role]" \
"(-v --verbose)"{-v,--verbose}"[verbose mode (-vvv for more, -vvvv to enable connection debugging)]" \
"--version[show program's version number and exit]" \
":role name:(ROLE)"
;;
list)
_arguments \
"(-h --help)"{-h,--help}"[help message]" \
"(-p --roles-path)"{-p,--roles-path}"[ROLES_PATH The path to the directory containing your roles (default: from ansible.cfg)]:roles path:_files -/" \
"(-v --verbose)"{-v,--verbose}"[verbose mode (-vvv for more, -vvvv to enable connection debugging)]" \
"--version[show program's version number and exit]" \
":role name:(ROLE)"
;;
login)
_arguments \
"--github_token[TOKEN Identify with github token rather than username and password.]:token:(TOKEN)" \
"(-h --help)"{-h,--help}"[help message]" \
"(-c --ignore-certs)"{-c,--ignore-certs}"[Ignore SSL certificate validation errors.]" \
"(-s --server)"{-s,--server}"[API_SERVER The API server destination]:api server:(http://apiserver)" \
"(-v --verbose)"{-v,--verbose}"[verbose mode (-vvv for more, -vvvv to enable connection debugging)]" \
"--version[show program's version number and exit]"
;;
remove)
_arguments \
"(-h --help)"{-h,--help}"[help message]" \
"(-p --roles-path)"{-p,--roles-path}"[ROLES_PATH The path to the directory containing your roles (default: from ansible.cfg)]:roles path:_files -/" \
"(-v --verbose)"{-v,--verbose}"[verbose mode (-vvv for more, -vvvv to enable connection debugging)]" \
"--version[show program's version number and exit]" \
"*:role name:(ROLE)"
;;
search)
_arguments \
"--author[AUTHOR GitHub username]:author:(AUTHOR)" \
"--galaxy-tags[TAGS list of galaxy tags to filter by]:tags:(TAGS)" \
"(-h --help)"{-h,--help}"[help message]" \
"(-c --ignore-certs)"{-c,--ignore-certs}"[Ignore SSL certificate validation errors.]" \
"--platforms[PLATFORMS list of OS platforms to filter by" \
"(-p --roles-path)"{-p,--roles-path}"[ROLES_PATH The path to the directory containing your roles (default: from ansible.cfg)]:roles path:_files -/" \
"(-s --server)"{-s,--server}"[API_SERVER The API server destination]:api server:(http://apiserver)" \
"(-v --verbose)"{-v,--verbose}"[verbose mode (-vvv for more, -vvvv to enable connection debugging)]" \
"--version[show program's version number and exit]"
;;
setup)
_arguments \
"(-h --help)"{-h,--help}"[help message]" \
"(-c --ignore-certs)"{-c,--ignore-certs}"[Ignore SSL certificate validation errors.]" \
"--list[List all of your integrations.]" \
"--remove[REMOVE_ID Remove the integration matching the provided ID value.]:id:(REMOVE_ID)" \
"(-s --server)"{-s,--server}"[API_SERVER The API server destination]:api server:(http://apiserver)" \
"(-v --verbose)"{-v,--verbose}"[verbose mode (-vvv for more, -vvvv to enable connection debugging)]" \
"--version[show program's version number and exit]" \
":source:(travis)" \
":github_user:(GITHUB_USER)" \
":github_repo:(GITHUB_REPO)" \
":secret:(SECRET)"
;;
esac
;;
esac

View File

@@ -28,13 +28,14 @@
# Description
# -----------
#
# Completion script for ansible-playbook v1.8.4 (http://ansible.org)
# Completion script for ansible-playbook v2.0.0.2 (http://ansible.org)
#
# ------------------------------------------------------------------------------
# Authors
# -------
#
# * Romain Bossart (https://github.com/bosr)
# * Adam Stevko (https://github.com/xen0l)
#
# ------------------------------------------------------------------------------
#
@@ -60,6 +61,7 @@ __host_file_location () {
[[ "$OSTYPE" == darwin* ]] && FALLBACK="/usr/local/etc/ansible/hosts"
[[ "$OSTYPE" == linux* ]] && FALLBACK="/etc/ansible/hosts"
HOST_FILE=${ANSIBLE_HOSTS:=${FALLBACK}}
[[ -f ${HOST_FILE} ]] || HOST_FILE="$PWD/ansible/inventory/hosts"
[[ -f ${HOST_FILE} ]] || HOST_FILE=/dev/null
echo ${HOST_FILE}
@@ -125,11 +127,15 @@ _ansible-playbook ()
typeset -A opt_args
_arguments -C -W \
"1:playbook yml file:_files -g '*.yml'"\
"(-k --ask-pass)"{-k,--ask-pass}"[ask for SSH password]"\
'--ask-su-pass[ask for su password]'\
"(-K --ask-sudo-pass)"{-K,--ask-sudo-pass}"[ask for sudo password]"\
"1:playbook yml file:_files -g '*.yml|*.yaml'"\
'--ask-become-pass[ask for privilege escalation password]'\
"(-k --ask-pass)"{-k,--ask-pass}"[ask for connection password]"\
'--ask-su-pass[ask for su password (deprecated, use become)]'\
"(-K --ask-sudo-pass)"{-K,--ask-sudo-pass}"[ask for sudo password (deprecated, use become)]"\
'--ask-vault-pass[ask for vault password]'\
"(-b --become)"{-b,--become}"[run operations with become (nopasswd implied)]"\
'--become-method[privilege escalation method to use (default=sudo)]:method:(sudo su pbrun pfexec runas doas)'\
'--become-user[run operations as this user (default=root)]:user:(USER)'\
"(-C --check)"{-C,--check}"[don't make any changes]"\
"(-c --connection)"{-c,--connection}"[CONNECTION connection type to use (default=smart)]:connection type:(smart ssh local chroot)"\
"(-D --diff)"{-D,--diff}"[when changing (small files and templates, show the diff in those. Works great with --check)]"\
@@ -141,15 +147,23 @@ _ansible-playbook ()
"(-i --inventory-file)"{-i,--inventory-file}"[INVENTORY specify inventory host file]:inventory file:_files"\
"(-l --limit)"{-l,--limit}"[SUBSET further limit selected hosts to an additional pattern]:subset pattern:->pattern"\
'--list-hosts[outputs a list of matching hosts. Does not execute anything else]'\
'--list-tags[list all available tags]'\
'--list-tasks[list all tasks that would be executed]'\
"(-M --module-path)"{-M,--module-path}"[MODULE_PATH specify path to module library (default=None)]:module path:_files -/"\
"--private-key[PRIVATE_KEY_FILE use this file to authenticate the connection]:private key file:_files"\
'--new-vault-password-file[new vault password file for rekey]:new vault password file:_files'\
'--output[output file name for encrypt or decrypt; use - for stdout]:output file:_files'\
'--private-key[PRIVATE_KEY_FILE use this file to authenticate the connection]:private key file:_files'\
'--scp-extra-args[specify extra arguments to pass to scp only]'\
'--sftp-extra-args[specify extra arguments to pass to sftp only]'\
"--skip-tags[SKIP_TAGS only run plays and tasks whose tags do not match these values]:skip tags:(SKIP_TAGS)"\
'--ssh-common-args[specify common arguments to pass to sftp/scp/ssh]'\
'--ssh-extra-args[specify extra arguments to pass to ssh only]'\
"--start-at-task[START_AT start the playbook at the task matching this name]:name:(TASK_NAME)"\
'--step[one-step-at-a-time: confirm each task before running]'\
"(-S --su)"{-S,--su}"[run operations with su]"\
"(-R --su-user)"{-R,--su-user}"[SU_USER run operations with su as this user (default=root)]:su user:(root)"\
"(-s --sudo)"{-s,--sudo}"[run operations with sudo (nopasswd)]"\
"(-U --sudo-user)"{-U,--sudo-user}"[SUDO_USER desired sudo user (default=root)]:su user:(root)"\
"(-S --su)"{-S,--su}"[run operations with su (deprecated, use become)]"\
"(-R --su-user)"{-R,--su-user}"[SU_USER run operations with su as this user (default=root) (deprecated, use become)]:su user:(root)"\
"(-s --sudo)"{-s,--sudo}"[run operations with sudo (nopasswd) (deprecated, use become)]"\
"(-U --sudo-user)"{-U,--sudo-user}"[SUDO_USER desired sudo user (default=root) (deprecated, use become)]:su user:(root)"\
'--syntax-check[perform a syntax check on the playbook, but do not execute it]'\
"(-t --tags)"{-t,--tags}"[TAGS only run plays and tasks gagged with these values]:task tags:(TAGS)"\
"(-T --timeout)"{-T,--timeout}"[TIMEOUT override the SSH timeout (s) (default=10)]:ssh timeout:(10)"\

View File

@@ -0,0 +1,94 @@
#compdef ansible-vault
# ------------------------------------------------------------------------------
# Copyright (c) 2016 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 ansible v1.9.2 (http://ansible.org)
#
# ------------------------------------------------------------------------------
# Authors
# -------
#
# * Rick van Hattem (https://github.com/wolph)
#
# ------------------------------------------------------------------------------
#
_ansible-vault-commands() {
local -a commands
commands=(
'create:Create new encrypted file'
'decrypt:Decrypt encrypted file'
'edit:Edit encrypted file'
'encrypt:Encrypt unencrypted file'
'rekey:Change password for encrypted file'
'view:View encrypted file'
)
_arguments -s : $nul_args && ret=0
_describe -t commands 'ansible-vault command' commands && ret=0
}
_ansible-vault-command(){
args=(
'--debug[enable debugging]' \
'--vault-password-file[vault password file]:password_file:_files'
$nul_args
"1::file_name:_files"
)
_arguments -s : $args && ret=0
}
_ansible-vault() {
local -a nul_args
nul_args=(
'(-h --help)'{-h,--help}'[show help message and exit.]'
)
local curcontext=$curcontext ret=1
if ((CURRENT == 2)); then
_ansible-vault-commands
else
shift words
(( CURRENT -- ))
curcontext="${curcontext%:*:*}:ansible-vault-$words[1]:"
_call_function ret _ansible-vault-command
fi
}
_ansible-vault "$@"
# Local Variables:
# mode: Shell-Script
# sh-indentation: 2
# indent-tabs-mode: nil
# sh-basic-offset: 2
# End:
# vim: ft=zsh sw=2 ts=2 et

View File

@@ -0,0 +1,85 @@
#compdef archlinux-java
# ------------------------------------------------------------------------------
# Copyright (c) 2016 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 archlinux-java a tool for selecting default Java runtime (https://wiki.archlinux.org/index.php/java).
#
# ------------------------------------------------------------------------------
# Authors
# -------
#
# * Jindřich Pilař (https://github.com/JindrichPilar)
#
# ------------------------------------------------------------------------------
_archlinux-java_command_arguments() {
case $words[1] in
(set)
local java_versions=("${(@f)$(archlinux-java status | tail -n +2 | tr -s ' ' | cut -d ' ' -f2)}")
_describe -t output 'Downloads to delete' java_versions
;;
esac
}
_archlinux-java() {
local -a commands
commands=(
"status:List installed Java environments and enabled one"
"get:Return the short name of the Java environment set as default"
"set:Force <JAVA_ENV> as default"
"unset:Unset current default Java environment"
"fix:Fix an invalid/broken default Java environment configuration"
"help:Show help"
)
_arguments -C \
'1:cmd:->cmds' \
'*:: :->args' \
case "$state" in
(cmds)
_describe -t commands 'commands' commands
;;
(*)
_archlinux-java_command_arguments
;;
esac
}
_archlinux-java
# Local Variables:
# mode: Shell-Script
# sh-indentation: 2
# indent-tabs-mode: nil
# sh-basic-offset: 2
# End:
# vim: ft=zsh sw=2 ts=2 et

View File

@@ -35,17 +35,27 @@
# -------
#
# * loranger (https://github.com/loranger)
# * Yohan Tambè (https://github.com/Cronos87)
#
# ------------------------------------------------------------------------------
_artisan_get_command_list () {
php artisan --no-ansi | sed "1,/Available commands/d" | awk '/ [a-z]+/ { print $1 }'
IFS=" "
php artisan --no-ansi | \
sed "1,/Available commands/d" | \
awk '/ [a-z]+/ { print $1 }' | \
sed -E 's/^[ ]+//g' | \
sed -E 's/[:]+/\\:/g' | \
sed -E 's/[ ]{2,}/\:/g'
}
_artisan () {
if [ -f artisan ]; then
compadd `_artisan_get_command_list`
local -a commands
IFS=$'\n'
commands=(`_artisan_get_command_list`)
_describe 'commands' commands
fi
}

View File

@@ -1,5 +1,26 @@
#compdef atach
# ------------------------------------------------------------------------------
# Copyright (c) 2016 Github zsh-users - http://github.com/zsh-users
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
# ------------------------------------------------------------------------------
# Description
# -----------
#

View File

@@ -0,0 +1,182 @@
#compdef bitcoin-cli
# ------------------------------------------------------------------------------
# Copyright (c) 2017 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 bitcoin-cli (https://bitcoin.org).
#
# ------------------------------------------------------------------------------
# Authors
# -------
#
# * Ian Ker-Seymer (https://github.com/ianks)
#
# ------------------------------------------------------------------------------
_bitcoin-cli() {
local context state line curcontext="$curcontext"
_arguments -C \
-?'[This help message]' \
-conf='[Specify configuration file (default: bitcoin.conf)]:PATH:_files' \
-datadir='[Specify data directory]:PATH:_directories' \
-testnet'[Use the test chain]' \
-regtest'[Enter regression test mode, which uses a special chain in which blocks can be solved instantly. This is intended for regression testing tools and app development.]' \
-named'[Pass named instead of positional arguments (default: false)]' \
-stdin'[Read extra arguments from standard input, one per line until EOF/Ctrl-D (recommended for sensitive information such as passphrases)]' \
-rpcport='[Connect to JSON-RPC on <port> (default: 8332 or testnet: 18332)]: :_guard "[[\:digit\:]]#" "PORT"' \
-rpcwait'[Wait for RPC server to start]' \
-rpcuser='[Username for JSON-RPC connections]:RPCUSER:()' \
-rpcpassword='[Password for JSON-RPC connections]:RPCPASSWORD:()' \
-rpcconnect='[Send commands to node running on <ip> (default: 127.0.0.1)]:RPCCONNECT:_hosts' \
-rpcclienttimeout='[Timeout during HTTP requests (default: 900)]: :_guard "[[\:digit\:]]#" "RPCCLIENTTIMEOUT"' \
':subcommand:->subcommand' && ret=0
case $state in
subcommand)
subcommands=(
'getbestblockhash'
'getblock'
'getblockchaininfo'
'getblockcount'
'getblockhash'
'getblockheader'
'getchaintips'
'getdifficulty'
'getmempoolancestors'
'getmempooldescendants'
'getmempoolentry'
'getmempoolinfo'
'getrawmempool'
'gettxout'
'gettxoutproof'
'gettxoutsetinfo'
'preciousblock'
'pruneblockchain'
'verifychain'
'verifytxoutproof'
'getinfo'
'getmemoryinfo'
'help'
'stop'
'generate'
'generatetoaddress'
'getblocktemplate'
'getmininginfo'
'getnetworkhashps'
'prioritisetransaction'
'submitblock'
'addnode'
'clearbanned'
'disconnectnode'
'getaddednodeinfo'
'getconnectioncount'
'getnettotals'
'getnetworkinfo'
'getpeerinfo'
'listbanned'
'ping'
'setban'
'setnetworkactive'
'createrawtransaction'
'decoderawtransaction'
'decodescript'
'fundrawtransaction'
'getrawtransaction'
'sendrawtransaction'
'signrawtransaction'
'createmultisig'
'estimatefee'
'estimatepriority'
'estimatesmartfee'
'estimatesmartpriority'
'signmessagewithprivkey'
'validateaddress'
'verifymessage'
'abandontransaction'
'addmultisigaddress'
'addwitnessaddress'
'backupwallet'
'bumpfee'
'dumpprivkey'
'dumpwallet'
'getaccount'
'getaccountaddress'
'getaddressesbyaccount'
'getbalance'
'getnewaddress'
'getrawchangeaddress'
'getreceivedbyaccount'
'getreceivedbyaddress'
'gettransaction'
'getunconfirmedbalance'
'getwalletinfo'
'importaddress'
'importmulti'
'importprivkey'
'importprunedfunds'
'importpubkey'
'importwallet'
'keypoolrefill'
'listaccounts'
'listaddressgroupings'
'listlockunspent'
'listreceivedbyaccount'
'listreceivedbyaddress'
'listsinceblock'
'listtransactions'
'listunspent'
'lockunspent'
'move'
'removeprunedfunds'
'sendfrom'
'sendmany'
'sendtoaddress'
'setaccount'
'settxfee'
'signmessage'
'walletlock'
'walletpassphrase'
'walletpassphrasechange'
)
_describe -t subcommands 'bitcoin-cli subcommands' subcommands && ret=0
esac
return ret
}
_bitcoin-cli "$@"
# Local Variables:
# mode: Shell-Script
# sh-indentation: 2
# indent-tabs-mode: nil
# sh-basic-offset: 2
# End:
# vim: ft=zsh sw=2 ts=2 et

View File

@@ -1,87 +0,0 @@
#compdef boot2docker
# ------------------------------------------------------------------------------
# Description
# -----------
#
# Completion script for boot2docker (https://github.com/boot2docker/boot2docker-cli).
#
# ------------------------------------------------------------------------------
# Authors
# -------
#
# * hhatto (https://github.com/hhatto)
#
# ------------------------------------------------------------------------------
_boot2docker() {
local context state line
_arguments -C \
--basevmdk'[Path to VMDK to use as base for persistent partition]:vmdk:' \
--dhcp'[enable VirtualBox host-only network DHCP. default=true]' \
--dhcpip'[VirtualBox host-only network DHCP server address. default=192.168.59.99]' \
'(-s --disksize)'{-s,--disksize}'[boot2docker disk image size (in MB). default=20000.]:disksize:' \
--dockerport'[host Docker port (forward to port 2375 in VM).]:PORT:' \
--hostip'[VirtualBox host-only network IP address.]:IP:' \
--iso'[path to boot2docker ISO image.]:FILE:_files' \
--lowerip'[VirtualBox host-only network DHCP lower bound.]:IP:' \
'(-m --memory)'{-m,--memory}'[virtual machine memory size (in MB). default=2048]' \
--netmask'[VirtualBox host-only network mask.]' \
--serial'[try serial console to get IP address (experimental) default=false]' \
--serialfile'[path to the serial socket/pipe.]:FILE:_files' \
--ssh'[path to SSH client utility. default="ssh"]:SSH:' \
--ssh-keygen'[path to ssh-keygen utility. default="ssh-keygen"]:KEYGEN:' \
--sshkey'[path to SSH key to use.]:FILE:_files' \
--sshport'[host SSH port (forward to port 22 in VM). default=2022]:PORT:' \
--upperip'[VirtualBox host-only network DHCP upper bound. default=192.168.59.254]:IP:' \
--vbm'[path to VirtualBox management utility. default="VBoxManage"]' \
'(-v --verbose)'{-v,--verbose}'[display verbose command invocations. default=false]' \
--vm'[virtual machine name. default="boot2docker-vm"]' \
'*::boot2docker commands:_boot2docker_command'
}
(( $+functions[_boot2docker_command] )) ||
_boot2docker_command() {
local _boot2docker_cmds
_boot2docker_cmds=(
'init:Create a new boot2docker VM.' \
'up:Start VM from any states.' \
'start:Start VM from any states.' \
'boot:Start VM from any states.' \
'ssh:Login to VM via SSH.' \
'save:Suspend VM and save state to disk.' \
'suspend:Suspend VM and save state to disk.' \
"down:Gracefully shutdown the VM." \
"stop:Gracefully shutdown the VM." \
"halt:Gracefully shutdown the VM." \
"restart:Gracefully reboot the VM." \
"poweroff:Forcefully power off the VM (might corrupt disk image)." \
"reset:Forcefully power cycle the VM (might corrupt disk image)." \
"delete:Delete boot2docker VM and its disk image." \
"destroy:Delete boot2docker VM and its disk image." \
"config:Show selected profile file settings." \
"cfg:Show selected profile file settings." \
"info:Display detailed information of VM." \
"ip:Display the IP address of the VM's Host-only network." \
"status:Display current state of VM." \
"download:Download boot2docker ISO image." \
"upgrade:Upgrade the boot2docker ISO image (if vm is running it will be stopped and started)." \
"version:Display version information."
)
if (( CURRENT == 1 )); then
_describe -t commands 'boot2docker subcommand' _boot2docker_cmds
fi
}
_boot2docker "$@"
# Local Variables:
# mode: Shell-Script
# sh-indentation: 2
# indent-tabs-mode: nil
# sh-basic-offset: 2
# End:
# vim: ft=zsh sw=2 ts=2 et

View File

@@ -1,5 +1,30 @@
#compdef bower
# ------------------------------------------------------------------------------
# Copyright (c) 2016 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
# -----------
#

View File

@@ -1,215 +0,0 @@
#compdef brew
# ------------------------------------------------------------------------------
# Description
# -----------
#
# Completion script for brew (https://github.com/mxcl/homebrew).
#
# Source: https://github.com/mxcl/homebrew/blob/master/Library/Contributions/brew_zsh_completion.zsh
#
# ------------------------------------------------------------------------------
# Authors
# -------
#
# * kulakowski (https://github.com/kulakowski)
# * Gabe Berke-Williams (https://github.com/gabebw)
# * James Conroy-Finn (https://github.com/jcf)
# * Daniel Schauenberg (https://github.com/mrtazz)
# * Adam Vandenberg (https://github.com/adamv)
# * Erik Kastner (https://github.com/kastner)
# * Katsunori Kanda (https://github.com/potix2)
#
# ------------------------------------------------------------------------------
_brew_all_formulae() {
formulae=(${(f)"$(_call_program formulae brew search 2>/dev/null)"})
}
_brew_installed_formulae() {
installed_formulae=(${(f)"$(_call_program formulae brew list 2>/dev/null)"})
}
_brew_installed_taps() {
installed_taps=(${(f)"$(_call_program formulae brew tap 2>/dev/null)"})
}
_brew_outdated_formulae() {
outdated_formulae=(${(f)"$(_call_program formulae brew outdated 2>/dev/null)"})
}
_brew_cask() {
local -a _1st_arguments
_1st_arguments=(
"alfred:displays note about new built-in alfred support"
"audit:verifies installability of Casks"
"cat:dump raw source of the given Cask to the standard output"
"cleanup:cleans up cached downloads and tracker symlinks"
"create:creates the given Cask and opens it in an editor"
"doctor:checks for configuration issues"
"edit:edits the given Cask"
"fetch:downloads Cask resources to local cache"
"home:opens the homepage of the given Cask"
"info:displays information about the given Cask"
"install:installs the given Cask"
"list:with no args, lists installed Casks; given installed Casks, lists staged files"
"search:searches all known Casks"
"uninstall:uninstalls the given Cask"
"update:a synonym for 'brew update'"
"zap:zaps all files associated with the given Cask"
)
if (( CURRENT == 2 )); then
_describe -t commands "brew cask subcommand" _1st_arguments
return
fi
local expl
local -a all_cask_formulae installed_cask_formulae
case "$words[2]" in
audit|cat|edit|info|install|search)
all_cask_formulae=( $(brew cask search 2>/dev/null) )
_wanted all_cask_formulae expl 'all cask formulae' compadd -a all_cask_formulae ;;
uninstall|zap)
installed_cask_formulae=( $(brew cask list 2>/dev/null) )
_wanted installed_cask_formulae expl 'installed cask formulae' compadd -a installed_cask_formulae ;;
*) ;;
esac
}
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'
'create:create a new formula'
'deps:list dependencies and dependants of a formula'
'doctor:audits your installation for common issues'
'diy:automatically determine the installation prefix for non-Homebrew software'
'edit:edit a formula'
'fetch:download the source packages for the given formulae'
'home:visit the homepage of a formula or the brew project'
'info:information about a formula'
'install:install a formula'
'link:link a formula'
'list:list files in a formula or not-installed formulae'
'log:git commit log for a formula'
'missing:check all installed formulae for missing dependencies.'
'options:display install options specific to formula'
'outdated:list formulae for which a newer version is available'
'prune:remove dead links'
'reinstall:install a formula anew; re-using its current options'
'remove:remove a formula'
'search:search for a formula (/regex/ or string)'
'server:start a local web app that lets you browse formulae (requires Sinatra)'
'services:manage background services via launchctl'
'tap:tap a new formula repository from GitHub, or list existing taps'
'test:a few formulae provide a test method'
'unlink:unlink a formula'
'untap:remove a tapped repository'
'unpin:unpin specified formulae'
'update:freshen up links'
'upgrade:upgrade outdated formulae'
'uses:show formulae which depend on a formula'
'versions:list previous versions of formulae'
)
local expl
local -a formulae installed_formulae installed_taps outdated_formulae
_arguments \
'(-v)-v[verbose]' \
'(--cellar)--cellar[brew cellar]' \
'(--config)--config[brew configuration]' \
'(--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
search|-S)
_arguments \
'(--debian)--debian[search the Debian repository]' \
'(--fedora)--fedora[search the Fedora repository]' \
'(--fink)--fink[search the Fink repository]' \
'(--macports)--macports[search the Macports repository]' \
'(--opensuse)--opensuse[search the OpenSuse repository]' \
'(--ubuntu)--ubuntu[search the Ubuntu repository]' \
'1: :->forms' && return 0
if [[ "$state" == forms ]]; then
_brew_all_formulae
_wanted formulae expl 'all formulae' compadd -a formulae
fi ;;
link|ln)
_arguments \
'(-n --dry-run)'{-n,--dry-run}'[All files would be linked or be deleted will be listed, but no real linking or deletion will be done]' \
'(--force)--force[Allow keg-only formulae to be linked]' \
'(--overwrite)--overwrite[Also delete files which already exist in the prefix while linking]' \
'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 ;;
install|reinstall)
_arguments \
'(--devel)--devel[install the development version]' \
'(--env=std)--env=std[use the standard build environment instead of superenv]' \
'(--env=super)--env=super[use superenv even if the formula specifies the standard build environment]' \
'(--fresh)--fresh[the installation process will not re-use any options from previous installs]' \
'(--ignore-dependencies)--ignore-dependencies[skip any dependencies installation]' \
'(--use-clang)--use-clang[attempt to compile using clang]' \
'(--use-gcc)--use-gcc[attempt to compile using GCC]' \
'(--use-llvm)--use-llvm[attempt to compile using the LLVM front-end to GCC]' \
'1: :->forms' && return 0
if [[ "$state" == forms ]]; then
_brew_all_formulae
_wanted formulae expl 'all formulae' compadd -a formulae
fi ;;
audit|home|homepage|log|info|abv|uses|cat|deps|edit|options)
_brew_all_formulae
_wanted formulae expl 'all formulae' compadd -a formulae ;;
remove|rm|uninstall|unlink|cleanup|pin|unpin|test)
_brew_installed_formulae
_wanted installed_formulae expl 'installed formulae' compadd -a installed_formulae ;;
tap)
_arguments \
'(--repair)--repair[repair all tap formula, i.e. symlinks and dead formula]' && return 0 ;;
upgrade)
_brew_outdated_formulae
_wanted outdated_formulae expl 'outdated formulae' compadd -a outdated_formulae ;;
untap)
_brew_installed_taps
_wanted installed_taps expl 'installed taps' compadd -a installed_taps ;;
cask)
_brew_cask ;;
esac
# Local Variables:
# mode: Shell-Script
# sh-indentation: 2
# indent-tabs-mode: nil
# sh-basic-offset: 2
# End:
# vim: ft=zsh sw=2 ts=2 et

View File

@@ -1,5 +1,30 @@
#compdef bundle
# ------------------------------------------------------------------------------
# Copyright (c) 2016 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
# -----------
#
@@ -48,6 +73,7 @@ case $state in
_values 'commands' 'install' 'update' 'package' 'exec' 'config' 'check' 'list' 'show' 'console' 'open' 'viz' 'init' 'gem' 'help' 'platform' 'outdated' && ret=0
;;
install)
_policies=('HighSecurity' 'MediumSecurity' 'LowSecurity' 'AlmostNoSecurity' 'NoSecurity')
_arguments \
'(--no-color)--no-color[disable colorization in output]' \
'(--local)--local[do not attempt to connect to rubygems.org]' \
@@ -58,7 +84,18 @@ case $state in
'(--frozen)--frozen[do not allow the Gemfile.lock to be updated after this install]' \
'(--path)--path=-[specify a different path than the system default]:path:_files' \
'(--binstubs)--binstubs=-[generate bin stubs for bundled gems to ./bin]:directory:_files' \
'(--without)--without=-[exclude gems that are part of the specified named group]:groups'
'(--without)--without=-[exclude gems that are part of the specified named group]:groups' \
'(--with)--with=-[include gems that are part of the specified named group]:groups' \
'(--clean)--clean[remove any gems not present in the current Gemfile]' \
'(--full-index)--full-index[download and cache the index file of all gems]' \
'(--jobs)--jobs=-[install gems parallely]:number' \
'(--force)--force[force download every gem]' \
'(--no-cache)--no-cache[do not update the cache in vendor/cache with newly installed gems]' \
'(--no-prune)--no-prune[do not remove stale gem from cache after installation]' \
'(--retry)--retry=-[number of times to retry failed network or git requests]:number' \
'(--sheband)--shebang=-[specify ruby executable to execute scripts]:ruby' \
'(--standalone)--standalone=-[create standalone bundles]:groups' \
"(--trust-policy)--trust-policy=-[apply the Rubygems security policy]:arg:($_policies)"
ret=0
;;
exec)

View File

@@ -1,648 +0,0 @@
#compdef cabal
# ------------------------------------------------------------------------------
# Copyright (c) 2012 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 cabal-install (http://hackage.haskell.org/trac/hackage/wiki/CabalInstall)
#
# ------------------------------------------------------------------------------
# Authors
# -------
#
# * Gérard Milmeister
# * Matvey Aksenov <matvey.aksenov@gmail.com>
#
# ------------------------------------------------------------------------------
local WORDS
_cabal ()
{
WORDS=()
for w in $words[1,(($CURRENT - 1))]; do
if [[ $w != -* ]]; then WORDS+=$w; fi
done
if (( $#WORDS == 1 )); then
_arguments \
{-h,--help}'[show help]' \
{-V,--version}'[print version information]' \
'--numeric-version[print just the version number]' \
'--config-file=[set an alternate location for the config file]:config file:_files' \
'--sandbox-config-file=[set an alternate location for the sandbox config file]:config file:_files' \
'--require-sandbox[enable requiring the presence of a sandbox for sandbox-aware commands]' \
'--no-require-sandbox[disable requiring the presence of a sandbox for sandbox-aware commands]' \
'--ignore-sandbox[ignore any existing sandbox]' \
'*::command:_cabal_command'
else
_arguments '*::command:_cabal_command'
fi
}
_cabal_command ()
{
local -a _cabal_cmds
_cabal_cmds=(
'install:installs a list of packages'
'update:updates list of known packages'
'list:list packages matching a search string'
'info:display detailed information about a particular package'
'fetch:downloads packages for later installation'
'freeze:freeze dependencies'
"get:get a package's source code"
'check:check the package for common mistakes'
'sdist:generate a source distribution file (.tar.gz)'
'upload:uploads source packages to Hackage'
'report:upload build reports to a remote server'
'run:runs the compiled executable'
'init:interactively create a .cabal file'
'configure:prepare to build the package'
'build:compile all targets or specific targets'
'repl:open an interpreter session for the given target'
'sandbox:create/modify/delete a sandbox'
'haddock:generate Haddock HTML documentation'
'exec:run a command with the cabal environment'
'copy:copy the files into the install locations'
'clean:clean up after a build'
'hscolour:generate HsColour colourised code, in HTML format'
'register:register this package with the compiler'
'test:run the test suite, if any (configure with UserHooks)'
'bench:run the benchmark, if any (configure with UserHooks)'
'help:help about commands'
)
local -a _cabal_programs
_cabal_programs=()
programs=(alex ar c2hs cpphs ffihugs gcc ghc ghc-pkg greencard haddock
happy hmake hpc hsc2hs hscolour hugs jhc ld lhc lhc-pkg nhc98 pkg-config
ranlib strip tar uhc)
for program in $programs; do
_cabal_programs+=(
"--with-${program}=[give the path to ${program}]:file:_files"
"--${program}-options=[give extra options to ${program}]"
"--${program}-option=[give an extra option to ${program}]"
)
done
if (( CURRENT == 1 )) then
_describe -t commands 'command' _cabal_cmds || compadd "$@"
else
local curcontext="$curcontext"
cmd="${${_cabal_cmds[(r)$WORDS[2]:*]%%:*}}"
if (( $#cmd )); then
_call_function ret _cabal_$cmd
else
_message "unknown cabal command: $WORDS[2]"
fi
fi
}
_cabal_bench ()
{
_arguments \
{-h,--help}'[show help]' \
{-v-,--verbose=}'[control verbosity]:level:(0 1 2 3)' \
'--builddir=[the directory where Cabal puts generated build files]:directory:_files -/' \
'--benchmark-options=[give extra options to benchmark executables]' \
'--benchmark-option=[give an extra option to benchmark executables (no need to quote options containing spaces)]' \
{-j,--jobs=}'[run NUM jobs simultaneously]' \
$_cabal_programs \
"--only[don't reinstall add-source dependencies (sandbox-only)]"
}
_cabal_build ()
{
_arguments \
{-h,--help}'[show help]' \
{-v-,--verbose=}'[control verbosity]:level:(0 1 2 3)' \
'--builddir=[the directory where Cabal puts generated build files]:directory:_files -/' \
$_cabal_programs \
{-j,--jobs=}'[run NUM jobs simultaneously]' \
"--only[don't reinstall add-source dependencies (sandbox-only)]"
}
_cabal_check ()
{
_arguments {-h,--help}'[show help]'
}
_cabal_clean ()
{
_arguments \
{-h,--help}'[show help]' \
{-v-,--verbose=}'[control verbosity]:level:(0 1 2 3)' \
'--builddir=[the directory where Cabal puts generated build files]:directory:_files -/' \
{-s,--save-configure}'[do not remove the configuration file]'
}
_cabal_configure ()
{
local context state state_descr line
typeset -A opt_args
_arguments \
{-h,--help}'[show help]' \
{-v-,--verbose=}'[control verbosity]:level:(0 1 2 3)' \
'--builddir=[the directory where Cabal puts generated build files]:directory:_files -/' \
{-g,--ghc}'[compile with GHC]' \
'--nhc98[compile with NHC]' \
'--jhc[compile with JHC]' \
'--lhc[compile with LHC]' \
'--hugs[compile with Hugs]' \
'--uhc[compile with UHC]' \
'--haskell-suite[compile with a haskell-suite compiler]' \
{-w,--with-compiler=}'[give the path to a particular compiler]:file:_files' \
'--with-hc-pkg=[give the path to the package tool]:file:_files' \
'--prefix=[take this prefix in preparation of installation]:directory:_files -/' \
'--bindir=[installation directory for executables]:directory:_files -/' \
'--libdir=[installation directory for libraries]:directory:_files -/' \
'--libsubdir=[subdirectory of libdir in which libs are installed]:directory:_files -/' \
'--libexecdir=[installation directory for program executables]:directory:_files -/' \
'--datadir=[installation directory for read-only data]:directory:_files -/' \
'--datasubdir=[subdirectory of datadir in which data files are installed]:directory:_files -/' \
'--docdir=[installation directory for documentation]:directory:_files -/' \
'--htmldir=[installation directory for HTML]:directory:_files -/' \
'--haddockdir=[installation directory for haddock interfaces]:directory:_files -/' \
'--sysconfdir=[installation directory for configuration files]:directory:_files -/' \
{-b,--scratchdir=}'[directory to receive the built package]:directory:_files -/' \
'--program-prefix=[prefix to be applied to installed executables]' \
'--program-suffix=[suffix to be applied to installed executables]' \
'--enable-library-vanilla[enable Vanilla libraries]' \
'--disable-library-vanilla[disable Vanilla libraries]' \
{-p,--enable-library-profiling}'[enable Library profiling]' \
'--disable-library-profiling[disable Library profiling]' \
'--enable-shared[enable Shared library]' \
'--disable-shared[disable Shared library]' \
'--enable-executable-dynamic[enable Executable dynamic linking]' \
'--disable-executable-dynamic[disable Executable dynamic linking]' \
'--enable-executable-profiling[enable Executable profiling]' \
'--disable-executable-profiling[disable Executable profiling]' \
{-O-,--enable-optimization=}'[build with optimization]:level:(0 1 2)' \
'--disable-optimization[build without optimization]' \
'--enable-library-for-ghci[enable compile library for use with GHCi]' \
'--disable-library-for-ghci[disable compile library for use with GHCi]' \
'--enable-split-objs[enable split library into smaller objects]' \
'--disable-split-objs[disable split library into smaller objects]' \
'--enable-executable-stripping[enable strip executables upon installation]' \
'--disable-executable-stripping[disable strip executables upon installation]' \
'--configure-option=[extra option for configure]' \
'--user[enable doing a per-user installation]' \
'--global[disable doing a per-user installation]' \
'--package-db=[use a given package database]:: :->default-db-or-filepath' \
{-f,--flags=}'[force values for the given flags]:flags:' \
'--extra-include-dirs=[a list of directories to search for header files]:directory:_files -/' \
'--extra-lib-dirs=[a list of directories to search for externallibraries]:directory:_files -/' \
'--extra-prog-path=[A list of directories to search for required programs]:directory:_files -/' \
'--enable-tests[enable dependency checking and compilation for test suites listed in the package description file]' \
'--disable-tests[disable dependency checking and compilation for test suites listed in the package description file]' \
'--enable-library-coverage[enable build library and test suites with, Haskell Program Coverage enabled. (GHC only)]' \
'--disable-library-coverage[disable build library and test suites with, Haskell Program Coverage enabled. (GHC only)]' \
'--enable-benchmarks[enable dependency checking and compilation, for benchmarks listed in the package]' \
'--disable-benchmarks[disable dependency checking and compilation, for benchmarks listed in the package]' \
$_cabal_programs \
'--cabal-lib-version=[select which version of the Cabal lib to use]' \
'--constraint=[a list of additional constraints on the dependencies]' \
'--preference=[specify preferences on the version of a package]' \
'--solver=[select dependency solver to use]:solver:(topdown modular choose)' \
'--allow-newer=[ignore upper bounds in dependencies on some or all packages]'
case $state in
(default-db-or-filepath)
_alternative \
':default db:(global user clear)' \
':filepath:_files'
;;
esac
}
_cabal_copy ()
{
_arguments \
{-h,--help}'[show help]' \
{-v-,--verbose=}'[control verbosity]:level:(0 1 2 3)' \
'--builddir=[the directory where Cabal puts generated build]:directory:_files -/' \
'--destdir=[directory to copy files to]:directory:_files -/'
}
_cabal_exec ()
{
_arguments \
{-h,--help}'[show help]' \
{-v-,--verbose=}'[control verbosity]:level:(0 1 2 3)'
}
_cabal_fetch ()
{
_arguments \
{-h,--help}'[show help]' \
{-v-,--verbose=}'[control verbosity]:level:(0 1 2 3)' \
'--dependencies[resolve and fetch dependencies]' \
'--no-dependencies[ignore dependencies]' \
'--dry-run[do not install anything, only print what would be installed]' \
'--solver=[select dependency solver to use]:solver:(topdown modular choose)]' \
'--max-backjumps=[maximum number of backjumps allowed while solving dependencies]' \
'--reorder-goals[try to reorder goals according to certain heuristics]' \
'--shadow-installed-packages[if multiple package instances of the same version are installed, treat all but one as shadowed]' \
'*:package:_cabal_list_packages'
}
_cabal_freeze ()
{
_arguments \
{-h,--help}'[show help]' \
{-v-,--verbose=}'[control verbosity]:level:(0 1 2 3)' \
'--dry-run[do not freeze anything, only print what would be frozen]' \
'--solver=[select dependency solver to use]:solver:(topdown modular choose)]' \
'--max-backjumps=[maximum number of backjumps allowed while solving dependencies]' \
'--reorder-goals[try to reorder goals according to certain heuristics]' \
'--shadow-installed-packages[if multiple package instances of the same version are installed, treat all but one as shadowed]'
}
_cabal_get ()
{
_arguments \
{-h,--help}'[show help]' \
{-v-,--verbose=}'[control verbosity]:level:(0 1 2 3)' \
{-d-,--destdir=}'[where to unpack the packages]:directory:_files -/' \
{-s,--source-repository=}"[copy the package's source repository]" \
'--pristine[unpack the original pristine tarball, rather than updating the .cabal file with the latest revision from the package archive.]' \
'*:package:_cabal_list_packages'
}
_cabal_haddock ()
{
_arguments \
{-h,--help}'[show help]' \
{-v-,--verbose=}'[control verbosity]:level:(0 1 2 3)' \
'--builddir=[the directory where Cabal puts generated files]:directory:_files -/' \
'--keep-temp-files[keep temporary files]' \
'--hoogle[generate a hoogle database]' \
'--html[generate HTML documentation]' \
'--html-location=[location of HTML documentation]:url:' \
'--executables[run haddock for Executables targets]' \
'--tests[run haddock for Test Suite targets]' \
'--benchmarks[run haddock for Benchmark targets]' \
'--all[run haddock for all targets]' \
'--internal[run haddock for internal modules]' \
'--css=[path to the haddock stylesheet]:file:_files' \
'--hyperlink-source[hyperlink the documentation to the source code]' \
'--hscolour-css=[path to the HsColour stylesheet]:file:_files' \
'--contents-location=[bake URL in as the location for the contents page]:url:' \
'--with-ghc=[path to ghc]:file:_files' \
'--with-haddock=[path to haddock]:file:_files' \
'--PROG-option=[give an extra option to PROG (no need to quote options containing spaces)]:option:' \
'--ghc-options=[give extra options to ghc]:option:' \
'--haddock-options=[give extra options to haddock]:option:' \
}
_cabal_help ()
{
local -a cmds
cmds=(install update list info fetch freeze get check sdist upload report run init
configure build repl sandbox haddock exec copy clean hscolour register test bench help)
_arguments \
{-h,--help}'[Show help]' \
'*::command:( $cmds )'
}
_cabal_hscolour ()
{
_arguments \
{-h,--help}'[show help]' \
{-v-,--verbose=}'[control verbosity]:level:(0 1 2 3)' \
'--builddir=[the directory where Cabal puts generated files]:directory:_files -/' \
'--executables[run hscolour for Executables targets]' \
'--tests[run hscolour for Test Suite targets]' \
'--benchmarks[run hscolour for Benchmarks targets]' \
'--all[run hscolour for all targets]' \
'--css=[path to stylesheet]:file:_files'
}
_cabal_info ()
{
local context state state_descr line
typeset -A opt_args
_arguments \
{-h,--help}'[show help]' \
{-v-,--verbose=}'[control verbosity]:level:(0 1 2 3)' \
'--package-db=[use a given package database]:: :->default-db-or-filepath' \
'*:package:_cabal_list_packages'
case $state in
(default-db-or-filepath)
_alternative \
':default db:(global user clear)' \
':filepath:_files'
;;
esac
}
_cabal_install ()
{
local context state state_descr line
typeset -A opt_args
_arguments \
{-h,--help}'[show help]' \
{-v-,--verbose=}'[control verbosity]:level:(0 1 2 3)' \
'--builddir=[the directory where Cabal puts generated build files]:directory:_files -/' \
{-g,--ghc}'[compile with GHC]' \
'--nhc98[compile with NHC]' \
'--jhc[compile with JHC]' \
'--lhc[compile with LHC]' \
'--hugs[compile with Hugs]' \
'--uhc[compile with UHC]' \
'--haskell-suite[compile with a haskell-suite compiler]' \
{-w,--with-compiler=}'[give the path to a particular compiler]:file:_files' \
'--with-hc-pkg=[give the path to the package tool]:file:_files' \
'--prefix=[take this prefix in preparation of installation]:directory:_files -/' \
'--bindir=[installation directory for executables]:directory:_files -/' \
'--libdir=[installation directory for libraries]:directory:_files -/' \
'--libsubdir=[subdirectory of libdir in which libs are installed]:directory:_files -/' \
'--libexecdir=[installation directory for program executables]:directory:_files -/' \
'--datadir=[installation directory for read-only data]:directory:_files -/' \
'--datasubdir=[subdirectory of datadir in which data files are installed]:directory:_files -/' \
'--docdir=[installation directory for documentation]:directory:_files -/' \
'--htmldir=[installation directory for HTML]:directory:_files -/' \
'--haddockdir=[installation directory for haddock interfaces]:directory:_files -/' \
'--sysconfdir=[installation directory for configuration files]:directory:_files -/' \
{-b,--scratchdir=}'[directory to receive the built package]:directory:_files -/' \
'--program-prefix=[prefix to be applied to installed executables]' \
'--program-suffix=[suffix to be applied to installed executables]' \
'--enable-library-vanilla[enable Vanilla libraries]' \
'--disable-library-vanilla[disable Vanilla libraries]' \
{-p,--enable-library-profiling}'[enable Library profiling]' \
'--disable-library-profiling[disable Library profiling]' \
'--enable-shared[enable Shared library]' \
'--disable-shared[disable Shared library]' \
'--enable-executable-dynamic[enable Executable dynamic linking]' \
'--disable-executable-dynamic[disable Executable dynamic linking]' \
'--enable-executable-profiling[enable Executable profiling]' \
'--disable-executable-profiling[disable Executable profiling]' \
{-O-,--enable-optimization=}'[build with optimization]:level:(0 1 2)' \
'--disable-optimization[build without optimization]' \
'--enable-library-for-ghci[enable compile library for use with GHCi]' \
'--disable-library-for-ghci[disable compile library for use with GHCi]' \
'--enable-split-objs[enable split library into smaller objects]' \
'--disable-split-objs[disable split library into smaller objects]' \
'--enable-executable-stripping[enable strip executables upon installation]' \
'--disable-executable-stripping[disable strip executables upon installation]' \
'--configure-option=[extra option for configure]' \
'--user[enable doing a per-user installation]' \
'--global[disable doing a per-user installation]' \
'--package-db=[use a given package database]:: :->default-db-or-filepath' \
{-f,--flags=}'[force values for the given flags]:flags:' \
'--extra-include-dirs=[a list of directories to search for header files]:directory:_files -/' \
'--extra-lib-dirs=[a list of directories to search for external libraries]:directory:_files -/' \
'--extra-prog-path=[a list of directories to search for required programs]:directory:_files -/' \
'--enable-tests[enable dependency checking and compilation for test suites listed in the package description file]' \
'--disable-tests[disable dependency checking and compilation for test suites listed in the package description file]' \
'--enable-library-coverage[enable build library and test suites with, Haskell Program Coverage enabled. (GHC only)]' \
'--disable-library-coverage[disable build library and test suites with, Haskell Program Coverage enabled. (GHC only)]' \
'--enable-benchmarks[enable dependency checking and compilation, for benchmarks listed in the package]' \
'--disable-benchmarks[disable dependency checking and compilation, for benchmarks listed in the package]' \
$_cabal_programs \
'--cabal-lib-version=[select which version of the Cabal lib to use]' \
'--constraint=[a list of additional constraints on the dependencies]' \
'--preference=[specify preferences on the version of a package]' \
'--solver=[select dependency solver to use]:solver:(topdown modular choose)' \
'--allow-newer=[ignore upper bounds in dependencies on some or all packages]' \
'--enable-documentation[enable building of documentation]' \
'--disable-documentation[disable building of documentation]' \
'--doc-index-file=[a central index of haddock API documentation]:file:_files' \
'--dry-run[do not install anything]' \
'--max-backjumps=[maximum number of backjumps allowed while solving dependencies]' \
'--reorder-goals[try to reorder goals according to certain heuristics]' \
'--shadow-installed-packages[if multiple package instances of the same version are installed, treat all but one as shadowed]' \
'--reinstall[always install]' \
'--avoid-reinstalls[do not select versions that would destructively overwrite installed packages]' \
'--force-reinstalls[reinstall packages even if they will most likely break other installed packages]' \
'--upgrade-dependencies[pick the latest version for all dependencies, rather than trying to pick an installed version]' \
{--only-dependencies,--dependencies-only}'[install only the dependencies necessary to build the given packages]' \
'--root-cmd=[command used to gain root privileges]::' \
'--symlink-bindir=[add symlinks into this directory]:directory:_files -/' \
'--build-summary=[save build summaries to file]:file:_files' \
'--build-log=[log all builds to file]:file:_files' \
'--remote-build-reporting=[generate build reports to send to a remote]:level:(none anonymous detailed)' \
'--one-shot[do not record the packages in the world file]' \
'--run-tests[run package test suites during installation]' \
{-j,--jobs=}'[run NUM jobs simultaneously]' \
'--haddock-hoogle[generate a hoogle database]' \
'--haddock-html[generate HTML documentation]' \
'--haddock-html-location=[location of HTML documentation]:url:' \
'--haddock-executables[run haddock for Executables targets]' \
'--haddock-tests[run haddock for Test Suite targets]' \
'--haddock-benchmarks[run haddock for Benchmarks targets]' \
'--haddock-all[run haddock for all targets]' \
'--haddock-internal[run haddock for internal modules]' \
'--haddock-css=[path to the haddock stylesheet]:file:_files' \
'--haddock-hyperlink-source[hyperlink the documentation to the source code]' \
'--haddock-hscolour-css=[path to the HsColour stylesheet]:file:_files' \
'--haddock-contents-location=[bake URL in as the location for the contents page]:url:' \
'*:: :->package-or-cabal-file'
case $state in
(default-db-or-filepath)
_alternative \
':default db:(global user clear)' \
':filepath:_files'
;;
(package-or-cabal-file)
_alternative \
':package:_cabal_list_packages' \
':files:_files -g "*.cabal"'
;;
esac
}
_cabal_list ()
{
local context state state_descr line
typeset -A opt_args
_arguments \
{-h,--help}'[show help]' \
{-v-,--verbose=}'[control verbosity]:level:(0 1 2 3)' \
'--installed[only print installed packages]' \
'--simple-output[print in a easy-to-parse format]' \
'--package-db=[use a given package database]:: :->default-db-or-filepath' \
'*:package:_cabal_list_packages'
case $state in
(default-db-or-filepath)
_alternative \
':default db:(global user clear)' \
':filepath:_files'
;;
esac
}
_cabal_register ()
{
_arguments \
{-h,--help}'[show help]' \
{-v-,--verbose=}'[control verbosity]:level:(0 1 2 3)' \
'--builddir=[the directory where Cabal puts generated files]:directory:_files -/' \
"--user[register in user's local package database]" \
"--global[register in the system-wide package database]" \
'--inplace[register in build location]' \
'--gen-script[generate a script to register later]' \
'--gen-pkg-config=[generate package registration file]'
}
_cabal_repl ()
{
_arguments \
{-h,--help}'[show help]' \
{-v-,--verbose=}'[control verbosity]:level:(0 1 2 3)' \
'--builddir=[the directory where Cabal puts generated build files]:directory:_files -/' \
$_cabal_programs
}
_cabal_report ()
{
_arguments \
{-h,--help}'[show help]' \
{-v-,--verbose=}'[control verbosity]:level:(0 1 2 3)' \
{-u,--username=}'[hackage username]' \
{-p,--password=}'[hackage password]'
}
_cabal_run ()
{
_arguments \
{-h,--help}'[show help]' \
{-v-,--verbose=}'[control verbosity]:level:(0 1 2 3)' \
'--builddir=[the directory where Cabal puts generated build files]:directory:_files -/' \
{-j,--jobs=}'[run NUM jobs simultaneously]' \
$_cabal_programs \
"--only[don't reinstall add-source dependencies (sandbox-only)]"
}
_cabal_sandbox ()
{
_arguments \
{-h,--help}'[show help]' \
{-v-,--verbose=}'[control verbosity]:level:(0 1 2 3)' \
'--sandbox=[Sandbox location]:sandbox:_files -/'
if (( CURRENT == 2 )); then
local -a _cabal_sandbox_cmds
_cabal_sandbox_cmds=(
'init:initialize the sandbox'
'delete:delete the sandbox'
'add-source:add sources path to sandbox'
'hc-pkg:call sandbox related haskell compiler package database'
'list-sources:list added sources paths'
)
_describe -t sandbox-commands 'sandbox-command' _cabal_sandbox_cmds || compadd "$@"
else
case $WORDS[3] in
add-source)
_arguments \
{-h,--help}'[show help]' \
{-v-,--verbose=}'[control verbosity]:level:(0 1 2 3)' \
'--snapshot[take a snapshot instead of creating a link]' \
'--sandbox=[Sandbox location]:sandbox:_files -/' \
'*:sources:_files -/'
;;
*)
_message "unknown cabal sandbox command: $WORDS[3]"
;;
esac
fi
}
_cabal_sdist ()
{
_arguments \
{-h,--help}'[show help]' \
{-v,--verbose=}'[control verbosity]:level:(0 1 2 3)' \
'--builddir=[the directory where Cabal puts generated files]:directory:_files -/' \
"--list-sources=[just write a list of the package's sources to a file]:directory:_files -/" \
'--snapshot[produce a snapshot source distribution]' \
'--output-directory=[generate a source distribution in the given directory]:directory:_files -/' \
'--targz[produce a .tar.gz format archive]' \
'--zip[produce a .zip format archive]'
}
_cabal_test ()
{
_arguments \
{-h,--help}'[show help]' \
{-v-,--verbose=}'[control verbosity]:level:(0 1 2 3)' \
'--builddir=[the directory where Cabal puts generated files]:directory:_files -/' \
'--log=[log all test suite results to file]:file:_files' \
'--machine-log=[produce a machine-readable log file]:file:_files' \
'--show-details=[when to show results of individual test cases?]:filter:(always never failures)' \
'--keep-tix-files[keep .tix files for HPC between test runs]' \
'--test-options=[give extra options to test executables]' \
'--test-option=[give an extra option to test executables]' \
{-j,--jobs=}'[run NUM jobs simultaneously]' \
$_cabal_programs \
"--only[don't reinstall add-source dependencies (sandbox-only)]"
}
_cabal_update ()
{
_arguments \
{-h,--help}'[show help]' \
{-v-,--verbose=}'[control verbosity]:level:(0 1 2 3)'
}
_cabal_upload ()
{
_arguments \
{-h,--help}'[show help]' \
{-v-,--verbose=}'[control verbosity]:level:(0 1 2 3)' \
{-c,--check}'[do not upload, just do QA checks]' \
{-u-,--username=}'[hackage username]' \
{-p-,--password=}'[hackage password]' \
'*:file:_files -g "*.tar.gz"'
}
_cabal_list_packages () {
_cabal_get_available_packages
_cabal_get_available_files=(*.cabal)
compadd "$@" -a -- _cabal_available_packages _cabal_get_available_files
}
_cabal_get_available_packages ()
{
if ( [[ ${+_cabal_available_packages} -eq 0 ]] || _cache_invalid CABAL_AVAILABLE_PACKAGES ) &&
! _retrieve_cache CABAL_AVAILABLE_PACKAGES;
then
_cabal_available_packages=( $(cabal list --simple-output | cut -d' ' -f1 | uniq) )
_store_cache CABAL_AVAILABLE_PACKAGES _cabal_available_packages
fi
}
_cabal "$@"

View File

@@ -0,0 +1,50 @@
#compdef caffeinate
# ------------------------------------------------------------------------------
# Copyright (c) 2017 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 the OSX 'caffeinate' tool (man 8 caffeinate).
#
# -------------------------------------------------------------------------
# Authors
# -------
#
# * Nicolas Despres <nicolas.despres@gmail.com> (initial version)
#
# -------------------------------------------------------------------------
_arguments -s \
'-d[prevent the display from sleeping]' \
'-i[prevent the system from idle sleeping]' \
'-m[prevent the disk from idle sleeping]' \
'-s[prevent the system from sleeping but only when running on AC power]' \
'-u[declare that user is active]' \
'-t+[assertion timeout value]:delay in seconds' \
'-w+[waits for process to exit]:pid:_pids' \
'(-):command: _command_names -e' \
'*::args: _normal'

View File

@@ -1,5 +1,30 @@
#compdef cap
# ------------------------------------------------------------------------------
# Copyright (c) 2016 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
# -----------
#

View File

@@ -1,139 +0,0 @@
#compdef celery
# ------------------------------------------------------------------------------
# Description
# -----------
#
# Completion script for celery (https://github.com/celery/celery).
#
# ------------------------------------------------------------------------------
# Authors
# -------
#
# * Dong weiming (https://github.com/dongweiming)
#
# ------------------------------------------------------------------------------
_celery () {
local -a _1st_arguments ifargs dopts controlargs
typeset -A opt_args
_1st_arguments=('worker' 'events' 'beat' 'shell' 'multi' 'amqp' 'status' 'inspect' \
'control' 'purge' 'list' 'migrate' 'call' 'result' 'report')
ifargs=('--app=' '--broker=' '--loader=' '--config=' '--version')
dopts=('--detach' '--umask=' '--gid=' '--uid=' '--pidfile=' '--logfile=' '--loglevel=')
controlargs=('--timeout' '--destination')
_arguments \
'(-A --app=)'{-A,--app}'[app instance to use (e.g. module.attr_name):APP]' \
'(-b --broker=)'{-b,--broker}'[url to broker. default is "amqp://guest@localhost//":BROKER]' \
'(--loader)--loader[name of custom loader class to use.:LOADER]' \
'(--config)--config[Name of the configuration module:CONFIG]' \
'(--workdir)--workdir[Optional directory to change to after detaching.:WORKING_DIRECTORY]' \
'(-q --quiet)'{-q,--quiet}'[Don"t show as much output.]' \
'(-C --no-color)'{-C,--no-color}'[Don"t display colors.]' \
'(--version)--version[show program"s version number and exit]' \
'(- : *)'{-h,--help}'[show this help message and exit]' \
'*:: :->subcmds' && return 0
if (( CURRENT == 1 )); then
_describe -t commands "celery subcommand" _1st_arguments
return
fi
case "$words[1]" in
worker)
_arguments \
'(-C --concurrency=)'{-C,--concurrency=}'[Number of child processes processing the queue. The default is the number of CPUs.]' \
'(--pool)--pool=:::(processes eventlet gevent threads solo)' \
'(--purge --discard)'{--discard,--purge}'[Purges all waiting tasks before the daemon is started.]' \
'(-f --logfile=)'{-f,--logfile=}'[Path to log file. If no logfile is specified, stderr is used.]' \
'(--loglevel=)--loglevel=:::(critical error warning info debug)' \
'(-N --hostname=)'{-N,--hostname=}'[Set custom hostname, e.g. "foo.example.com".]' \
'(-B --beat)'{-B,--beat}'[Also run the celerybeat periodic task scheduler.]' \
'(-s --schedule=)'{-s,--schedule=}'[Path to the schedule database if running with the -B option. Defaults to celerybeat-schedule.]' \
'(-S --statedb=)'{-S,--statedb=}'[Path to the state database.Default: None]' \
'(-E --events)'{-E,--events}'[Send events that can be captured by monitors like celeryev, celerymon, and others.]' \
'(--time-limit=)--time-limit=[nables a hard time limit (in seconds int/float) for tasks]' \
'(--soft-time-limit=)--soft-time-limit=[Enables a soft time limit (in seconds int/float) for tasks]' \
'(--maxtasksperchild=)--maxtasksperchild=[Maximum number of tasks a pool worker can execute before it"s terminated and replaced by a new worker.]' \
'(-Q --queues=)'{-Q,--queues=}'[List of queues to enable for this worker, separated by comma. By default all configured queues are enabled.]' \
'(-I --include=)'{-I,--include=}'[Comma separated list of additional modules to import.]' \
'(--pidfile=)--pidfile=[Optional file used to store the process pid.]' \
'(--autoscale=)--autoscale=[Enable autoscaling by providing max_concurrency, min_concurrency.]' \
'(--autoreload)--autoreload[Enable autoreloading.]' \
'(--no-execv)--no-execv[Don"t do execv after multiprocessing child fork.]'
compadd -a ifargs
;;
inspect)
_values -s \
'active[dump active tasks (being processed)]' \
'active_queues[dump queues being consumed from]' \
'ping[ping worker(s)]' \
'registered[dump of registered tasks]' \
'report[get bugreport info]' \
'reserved[dump reserved tasks (waiting to be processed)]' \
'revoked[dump of revoked task ids]' \
'scheduled[dump scheduled tasks (eta/countdown/retry)]' \
'stats[dump worker statistics]'
compadd -a controlargs ifargs
;;
control)
_values -s \
'add_consumer[tell worker(s) to start consuming a queue]' \
'autoscale[change autoscale settings]' \
'cancel_consumer[tell worker(s) to stop consuming a queue]' \
'disable_events[tell worker(s) to disable events]' \
'enable_events[tell worker(s) to enable events]' \
'pool_grow[start more pool processes]' \
'pool_shrink[use less pool processes]' \
'rate_limit[tell worker(s) to modify the rate limit for a task type]' \
'time_limit[tell worker(s) to modify the time limit for a task type.]'
compadd -a controlargs ifargs
;;
multi)
_values -s \
'--nosplash[Don"t display program info.]' \
'--verbose[Show more output.]' \
'--no-color[Don"t display colors.]' \
'--quiet[Don"t show as much output.]' \
'start' 'restart' 'stopwait' 'stop' 'show' \
'names' 'expand' 'get' 'kill'
compadd -a ifargs
;;
amqp)
_values -s \
'queue.declare' 'queue.purge' 'exchange.delete' 'basic.publish' \
'exchange.declare' 'queue.delete' 'queue.bind' 'basic.get'
;;
list)
_values -s, 'bindings'
;;
shell)
_values -s \
'--ipython[force iPython.]' \
'--bpython[force bpython.]' \
'--python[force default Python shell.]' \
'--without-tasks[don"t add tasks to locals.]' \
'--eventlet[use eventlet.]' \
'--gevent[use gevent.]'
compadd -a ifargs
;;
beat)
_arguments \
'(-s --schedule=)'{-s,--schedule=}'[Path to the schedule database. Defaults to celerybeat-schedule.]' \
'(-S --scheduler=)'{-S,--scheduler=}'[Scheduler class to use. Default is celery.beat.PersistentScheduler.]' \
'(--max-interval)--max-interval[]'
compadd -a dopts fargs
;;
events)
_arguments \
'(-d --dump)'{-d,--dump}'[Dump events to stdout.]' \
'(-c --camera=)'{-c,--camera=}'[Take snapshots of events using this camera.]' \
'(-F --frequency=)'{-F,--frequency=}'[Camera: Shutter frequency. Default is every 1.0 seconds.]' \
'(-r --maxrate=)'{-r,--maxrate=}'[Camera: Optional shutter rate limit (e.g. 10/m).]'
compadd -a dopts fargs
;;
*)
;;
esac
}

View File

@@ -0,0 +1,994 @@
#compdef cf
# ------------------------------------------------------------------------------
#
# Copyright 2015 Ferran Rodenas & Danny Rosen
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# ------------------------------------------------------------------------------
#
# Description
# -----------
#
# Completion script for Cloud Foundry CLI (https://github.com/cloudfoundry/cli#downloads)
#
# ------------------------------------------------------------------------------
#
# Authors
# -------
#
# * Ferran Rodenas (https://github.com/frodenas)
# * Danny Rosen (https://github.com/dannyzen)
#
# ------------------------------------------------------------------------------
# ----------------------
# ----- Helper functions
# ----------------------
# Output a selectable list of organizations
__cf_orgs() {
declare -a cont_cmd
cont_cmd=($(CF_COLOR=false CF_TRACE=false cf orgs | awk 'NR>3{print $1}'))
if [[ 'X$cont_cmd' != 'X' ]]
_describe 'ORG' cont_cmd
}
# Output a selectable list of spaces
__cf_spaces() {
declare -a cont_cmd
cont_cmd=($(CF_COLOR=false CF_TRACE=false cf spaces | awk 'NR>3{print $1}'))
if [[ 'X$cont_cmd' != 'X' ]]
_describe 'SPACE' cont_cmd
}
# Output a selectable list of applications
__cf_apps() {
declare -a cont_cmd
cont_cmd=($(CF_COLOR=false CF_TRACE=false cf apps | awk 'NR>4{print $1}'))
if [[ 'X$cont_cmd' != 'X' ]]
_describe 'APP' cont_cmd
}
# Output a selectable list of stacks
__cf_stacks() {
declare -a cont_cmd
cont_cmd=($(CF_COLOR=false CF_TRACE=false cf stacks | awk 'NR>4{print $1}'))
if [[ 'X$cont_cmd' != 'X' ]]
_describe 'STACK' cont_cmd
}
# Output a selectable list of services
__cf_marketplace_services() {
declare -a cont_cmd
cont_cmd=($(CF_COLOR=false CF_TRACE=false cf marketplace | awk 'NR>4{print $1}'))
if [[ 'X$cont_cmd' != 'X' ]]
_describe 'SERVICE' cont_cmd
}
# Output a selectable list of services
__cf_services() {
declare -a cont_cmd
cont_cmd=($(CF_COLOR=false CF_TRACE=false cf services | awk 'NR>4{print $1}'))
if [[ 'X$cont_cmd' != 'X' ]]
_describe 'SERVICE' cont_cmd
}
# Output a selectable list of domains
__cf_domains() {
declare -a cont_cmd
cont_cmd=($(CF_COLOR=false CF_TRACE=false cf domains | grep -v shared | awk 'NR>2{print $1}'))
if [[ 'X$cont_cmd' != 'X' ]]
_describe 'DOMAIN' cont_cmd
}
# Output a selectable list of shared domains
__cf_shared_domains() {
declare -a cont_cmd
cont_cmd=($(CF_COLOR=false CF_TRACE=false cf domains | grep -v owned | awk 'NR>2{print $1}'))
if [[ 'X$cont_cmd' != 'X' ]]
_describe 'SHARED-DOMAIN' cont_cmd
}
# Output a selectable list of hostnames
__cf_hostnames() {
declare -a cont_cmd
cont_cmd=($(CF_COLOR=false CF_TRACE=false cf routes | awk 'NR>3{print $2}'))
if [[ 'X$cont_cmd' != 'X' ]]
_describe 'ROUTE' cont_cmd
}
# Output a selectable list of buildpacks
__cf_buildpacks() {
declare -a cont_cmd
cont_cmd=($(CF_COLOR=false CF_TRACE=false cf buildpacks | awk 'NR>3{print $1}'))
if [[ 'X$cont_cmd' != 'X' ]]
_describe 'BUILDPACK' cont_cmd
}
# Output a selectable list of feature flags
__cf_feature_flags() {
declare -a cont_cmd
cont_cmd=($(CF_COLOR=false CF_TRACE=false cf feature-flags | awk 'NR>4{print $1}'))
if [[ 'X$cont_cmd' != 'X' ]]
_describe 'FEATURE-FLAG' cont_cmd
}
# Output a selectable list of plugin repos
__cf_repo_plugins() {
declare -a cont_cmd
cont_cmd=($(CF_COLOR=false CF_TRACE=false cf list-plugin-repos | awk 'NR>3{print $1}'))
if [[ 'X$cont_cmd' != 'X' ]]
_describe 'REPO-PLUGIN' cont_cmd
}
# Output a selectable list of plugins
__cf_plugins() {
declare -a cont_cmd
cont_cmd=($(cf plugins | awk 'NR>4{print $1}'))
if [[ 'X$cont_cmd' != 'X' ]]
_describe 'PLUGIN' cont_cmd
}
# Output a selectable list of targets (requires cf-targets plugin)
__cf_targets() {
declare -a cont_cmd
cont_cmd=($(cf targets | awk '{print $1}'))
if [[ 'X$cont_cmd' != 'X' ]]
_describe 'TARGET' cont_cmd
}
# --------------------------
# ----- end Helper functions
# --------------------------
# --------------
# ----- Commands
# --------------
__login() {
_arguments \
'-a=[API endpoint (e.g. https://api.example.com)]:api endpoint:' \
'-u=[Username]:username:' \
'-p=[Password]:password:' \
'-o=[Organization]:organization name:__cf_orgs' \
'-s=[Space]:space name:__cf_spaces' \
'--sso[Use a one-time password to login]' \
'--skip-ssl-validation[Skip SSL validation]'
}
__logout() {
# no arguments
}
__passwd() {
_arguments \
'1:password:'
}
__target() {
_arguments \
'-o=[Organization]:organization name:__cf_orgs' \
'-s=[Space]:space name:__cf_spaces'
}
__api() {
_arguments \
'1:API url:' \
'--unset[Remove all api endpoint targeting]' \
'--skip-ssl-validation[Skip SSL validation]'
}
__auth() {
# no arguments
}
__apps() {
# no arguments
}
__app() {
_arguments \
'1:application name:__cf_apps' \
'--guid[Retrieve and display the given app guid. All other health and status output for the app is suppressed]'
}
__push() {
_arguments \
'1:application name:__cf_apps' \
'-b=[Custom buildpack by name (e.g. my-buildpack) or GIT URL or GIT BRANCH URL]:buildpack name:__cf_buildpacks' \
'-c=[Startup command, set to null to reset to default start command]:startup command:' \
'-d=[Domain (e.g. example.com)]:domain (e.g. example.com):__cf_domains' \
'-f=[Path to manifest]:file:_files:' \
'-i=[Number of instances]:number of instances:' \
'-k=[Disk limit (e.g. 256M, 1024M, 1G)]:disk limit (e.g. 256M, 1024M, 1G):' \
'-m=[Memory limit (e.g. 256M, 1024M, 1G)]:memory limit (e.g. 256M, 1024M, 1G):' \
'-n=[Hostname (e.g. my-subdomain)]:hostname (e.g. my-subdomain):' \
'-p=[Path to app directory or to a zip file of the contents of the app directory]:file:_files' \
'-s=[Stack to use (a stack is a pre-built file system, including an operating system, that can run apps)]:stack name:__cf_stacks:' \
'-t=[Maximum time (in seconds) for CLI to wait for application start, other server side timeouts may apply]:maximum time (in seconds):' \
'--no-hostname[Map the root domain to this app]' \
'--no-manifest[Ignore manifest file]' \
'--no-route[Do not map a route to this app and remove routes from previous pushes of this app]' \
'--no-start[Do not start an app after pushing]' \
'--random-route[Create a random route for this app]'
}
__scale() {
_arguments \
'1:application name:__cf_apps' \
'-i=[Number of instances]:number of instances:' \
'-k=[Disk limit (e.g. 256M, 1024M, 1G)]:disk limit (e.g. 256M, 1024M, 1G):' \
'-m=[Memory limit (e.g. 256M, 1024M, 1G)]:memory limit (e.g. 256M, 1024M, 1G):' \
'-f[Force restart of app without prompt]'
}
__delete() {
_arguments \
'1:application name:__cf_apps' \
'--f[Force deletion without confirmation]' \
'--r[Also delete any mapped routes]'
}
__rename() {
_arguments \
'1:application name:__cf_apps' \
'2:application name:'
}
__start() {
_arguments \
'1:application name:__cf_apps'
}
__stop() {
_arguments \
'1:application name:__cf_apps'
}
__restart() {
_arguments \
'1:application name:__cf_apps'
}
__restage() {
_arguments \
'1:application name:__cf_apps'
}
__restart-app-instance() {
_arguments \
'1:application name:__cf_apps' \
'2:application index:'
}
__events() {
_arguments \
'1:application name:__cf_apps'
}
__files() {
_arguments \
'1:application name:__cf_apps' \
'2::path:' \
'-i=[instance]'
}
__logs() {
_arguments \
'1:application name:__cf_apps' \
'--recent[Dump recent logs instead of tailing]'
}
__env() {
_arguments \
'1:application name:__cf_apps'
}
__set-env() {
_arguments \
'1:application name:__cf_apps' \
'2:env var name:' \
'3:env var value:'
}
__unset-env() {
_arguments \
'1:application name:__cf_apps' \
'2:env var name:'
}
__stacks() {
# no arguments
}
__stack() {
_arguments \
'1:stack name:__cf_stacks' \
'--guid[Retrieve and display the given stack guid. All other output for the stack is suppressed]'
}
__copy-source() {
_arguments \
'1:source application name:__cf_apps' \
'2:target application name:' \
'-o=[Org that contains the target application]:organization name:__cf_orgs' \
'-s=[Space that contains the target application]:space name:__cf_spaces' \
'--no-restart[Override restart of the application in target environment after copy-source completes]'
}
__create-app-manifest() {
_arguments \
'1:application name:__cf_apps' \
'-p=[Specify a path for file creation. If path not specified, manifest file is created in current working directory]:path:_files'
}
__marketplace() {
_arguments \
'-s=[Show plan details for a particular service offering]'
}
__services() {
# no arguments
}
__service() {
_arguments \
'1:service name:__cf_services' \
'--guid[Retrieve and display the given service guid. All other output for the service is suppressed]'
}
__create-service() {
_arguments \
'1:service:__cf_marketplace_services' \
'2:plan:' \
'3:service name:' \
'-c=[Valid JSON object containing service-specific configuration parameters, provided either in-line or in a file]' \
'-t=[User provided tags]'
}
__update-service() {
_arguments \
'1:service name:__cf_services' \
'-p=[Change service plan for a service instance]' \
'-c=[Valid JSON object containing service-specific configuration parameters, provided either in-line or in a file]' \
'-t=[User provided tags]'
}
__rename-service() {
_arguments \
'1:service name:__cf_services' \
'2:service name:'
}
__delete-service() {
_arguments \
'1:service name:__cf_services' \
'-f[Force deletion without confirmation]'
}
__create-service-key() {
_arguments \
'1:service name:__cf_services' \
'2:service key:' \
'-c=[Valid JSON object containing service-specific configuration parameters, provided either in-line or in a file]'
}
__service-keys() {
_arguments \
'1:service name:__cf_services'
}
__service-key() {
_arguments \
'1:service name:__cf_services' \
'2:service key:'
}
__delete-service-key() {
_arguments \
'1:service name:__cf_services' \
'2:service key:' \
'-f[Force deletion without confirmation]'
}
__bind-service() {
_arguments \
'1:application name:__cf_apps' \
'2:service name:__cf_services' \
'-c=[Valid JSON object containing service-specific configuration parameters, provided either in-line or in a file]'
}
__unbind-service() {
_arguments \
'1:application name:__cf_apps' \
'2:service name:__cf_services'
}
__create-user-provided-service() {
_arguments \
'1:service name:' \
'-p=[Credentials]' \
'-l=[Syslog Drain Url]'
}
__update-user-provided-service() {
_arguments \
'1:service name:__cf_services' \
'-p=[Credentials]' \
'-l=[Syslog Drain Url]'
}
__orgs() {
# no arguments
}
__org() {
_arguments \
'1:organization name:__cf_orgs' \
'--guid[Retrieve and display the given org guid. All other output for the org is suppressed]'
}
__create-org() {
_arguments \
'1:organization name:' \
'-q=[Quota to assign to the newly created org (excluding this option results in assignment of default quota)]'
}
__delete-org() {
_arguments \
'1:organization name:__cf_orgs' \
'-f[Force deletion without confirmation]'
}
__spaces() {
# no arguments
}
__space() {
_arguments \
'1:space name:__cf_spaces' \
'--guid[Retrieve and display the given space guid. All other output for the space is suppressed]' \
'--security-group-rules[Retrive the rules for all the security groups associated with the space]'
}
__create-space() {
_arguments \
'1:space name:' \
'-o=[Org that contains the target application]:organization name:__cf_orgs' \
'-q=[Quota to assign to the newly created space (excluding this option results in assignment of default quota)]'
}
__delete-space() {
_arguments \
'1:space name:__cf_spaces' \
'-f[Force deletion without confirmation]'
}
__domains() {
# no arguments
}
__create-domain() {
_arguments \
'1:organization name:__cf_orgs' \
'2:domain:'
}
__delete-domain() {
_arguments \
'1:domain:__cf_domains' \
'-f[Force deletion without confirmation]'
}
__create-shared-domain() {
_arguments \
'1:domain:'
}
__delete-shared-domain() {
_arguments \
'1:domain:__cf_shared_domains' \
'-f[Force deletion without confirmation]'
}
__routes() {
_arguments \
'--orglevel[List all the routes for all spaces of current organization]'
}
__create-route() {
_arguments \
'1:space name:__cf_spaces' \
'2:domain:__cf_domains' \
'-n=[Hostname]'
}
__check-route() {
_arguments \
'1:hostname:__cf_hostnames' \
'2:domain:__cf_domains'
}
__map-route() {
_arguments \
'1:application name:__cf_apps' \
'2:domain:__cf_domains' \
'-n=[Hostname]:hostname:__cf_hostnames:'
}
__unmap-route() {
_arguments \
'1:application name:__cf_apps' \
'2:domain:__cf_domains' \
'-n=[Hostname]:hostname:__cf_hostnames:'
}
__delete-route() {
_arguments \
'1:domain:__cf_domains' \
'-n=[Hostname]:hostname:__cf_hostnames:' \
'-f[Force deletion without confirmation]'
}
__delete-orphaned-routes() {
_arguments \
'-f[Force deletion without confirmation]'
}
__buildpacks() {
# no arguments
}
__create-buildpack() {
_arguments \
'1:buildpack name:' \
'2:path:_files' \
'3:position:' \
'--enable[Enable the buildpack to be used for staging]' \
'--disable[Disable the buildpack from being used for staging]'
}
__update-buildpack() {
_arguments \
'1:buildpack name:__cf_buildpacks' \
'-p=[Path to directory or zip file]:file:_files' \
'-i=[The order in which the buildpacks are checked during buildpack auto-detection]' \
'--enable[Enable the buildpack to be used for staging]' \
'--disable[Disable the buildpack from being used for staging]' \
'--lock[Lock the buildpack to prevent updates]' \
'--unlock[Unlock the buildpack to enable updates]'
}
__rename-buildpack() {
_arguments \
'1:buildpack name:__cf_buildpacks' \
'2:new buildpack name:'
}
__delete-buildpack() {
_arguments \
'1:buildpack name:__cf_buildpacks' \
'-f[Force deletion without confirmation]'
}
__running-environment-variable-group() {
# no arguments
}
__staging-environment-variable-group() {
# no arguments
}
__set-staging-environment-variable-group() {
# no arguments
}
__set-running-environment-variable-group() {
# no arguments
}
__feature-flags() {
# no arguments
}
__feature-flag() {
_arguments \
'1:feature name:__cf_feature_flags'
}
__enable-feature-flag() {
_arguments \
'1:feature name:__cf_feature_flags'
}
__disable-feature-flag() {
_arguments \
'1:feature name:__cf_feature_flags'
}
__curl() {
_arguments \
'1:path:' \
'-i[Include response headers in the output]' \
'-v[Enable CF_TRACE output for all requests and responses]' \
'-X=[HTTP method]:http method:(GET POST PUT DELETE)' \
'-h=[Custom headers to include in the request, flag can be specified multiple times]' \
'-d=[HTTP data to include in the request body]' \
'--output[Write curl body to FILE instead of stdout]'
}
__config() {
_arguments \
'--async-timeout=[Timeout for async HTTP requests]' \
'--trace=[Trace HTTP requests]:trace:(true false)' \
'--color=[Enable or disable color]:color:(true false)' \
'--locale=[Set default locale. If LOCALE is CLEAR, previous locale is deleted]'
}
__oauth-token() {
# no arguments
}
__add-plugin-repo() {
_arguments \
'1:repo name:' \
'2:url:'
}
__remove-plugin-repo() {
_arguments \
'1:repo name:__cf_repo_plugins' \
'2:url:'
}
__list-plugin-repos() {
# no arguments
}
__repo-plugins() {
_arguments \
'-r=[Repo Name]:repo name:__cf_repo_plugins'
}
__plugins() {
_arguments \
'-checksum[Compute and show the sha1 value of the plugin binary file]'
}
__install-plugin() {
_arguments \
'1:plugin URL or path:_files' \
'-r=[repo name where the plugin binary is located]:repo name:__cf_repo_plugins'
}
__uninstall-plugin() {
_arguments \
'1:plugin name:__cf_plugins'
}
__save-target() {
_arguments \
'1:target-name:' \
'-f[Force save even if current target is already saved under another name]'
}
__set-target() {
_arguments \
'1:target-name:__cf_targets' \
'-f[Force target change even if current target is unsaved]'
}
__delete-target() {
_arguments \
'1:target-name:__cf_targets'
}
# ------------------
# ----- end Commands
# ------------------
# -------------------
# ----- 1st Arguments
# -------------------
local -a _1st_arguments
_1st_arguments=(
"login":"Log user in"
"logout":"Log user out"
"passwd":"Change user password"
"target":"Set or view the targeted org or space"
"api":"Set or view target api url"
"auth":"Authenticate user non-interactively"
"apps":"List all apps in the target space"
"app":"Display health and status for app"
"push":"Push a new app or sync changes to an existing app"
"scale":"Change or view the instance count, disk space limit, and memory limit for an app"
"delete":"Delete an app"
"rename":"Rename an app"
"start":"Start an app"
"stop":"Stop an app"
"restart":"Restart an app"
"restage":"Restage an app"
"restart-app-instance":"Terminate the running application Instance at the given index and instantiate a new instance of the application with the same index"
"events":"Show recent app events"
"files":"Print out a list of files in a directory or the contents of a specific file"
"logs":"Tail or show recent logs for an app"
"env":"Show all env variables for an app"
"set-env":"Set an env variable for an app"
"unset-env":"Remove an env variable"
"stacks":"List all stacks"
"stack":"Show information for a stack"
"copy-source":"Make a copy of app source code from one application to another. Unless overridden, the copy-source command will restart the application"
"create-app-manifest":"Create an app manifest for an app that has been pushed successfully"
"marketplace":"List available offerings in the marketplace"
"services":"List all service instances in the target space"
"service":"Show service instance info"
"create-service":"Create a service instance"
"update-service":"Update a service instance"
"delete-service":"Delete a service instance"
"rename-service":"Rename a service instance"
"create-service-key":"Create key for a service instance"
"service-keys":"List keys for a service instance"
"service-key":"Show service key info"
"delete-service-key":"Delete a service key"
"bind-service":"Bind a service instance to an app"
"unbind-service":"Unbind a service instance from an app"
"create-user-provided-service":"Make a user-provided service instance available to cf apps"
"update-user-provided-service":"Update user-provided service instance name value pairs"
"orgs":"List all orgs"
"org":"Show org info"
"create-org":"Create an org"
"delete-org":"Delete an org"
"rename-org":"Rename an org"
"spaces":"List all spaces in an org"
"space":"Show space info"
"create-space":"Create a space"
"delete-space":"Delete a space"
"rename-space":"Rename a space"
"domains":"List domains in the target org"
"create-domain":"Create a domain in an org for later use"
"delete-domain":"Delete a domain"
"create-shared-domain":"Create a domain that can be used by all orgs (admin-only)"
"delete-shared-domain":"Delete a shared domain"
"routes":"List all routes in the current space or the current organization"
"create-route":"Create a url route in a space for later use"
"check-route":"Perform a simple check to determine whether a route currently exists or not"
"map-route":"Add a url route to an app"
"unmap-route":"Remove a url route from an app"
"delete-route":"Delete a route"
"delete-orphaned-routes":"Delete all orphaned routes (e.g.: those that are not mapped to an app)"
"buildpacks":"List all buildpacks"
"create-buildpack":"Create a buildpack"
"update-buildpack":"Update a buildpack"
"rename-buildpack":"Rename a buildpack"
"delete-buildpack":"Delete a buildpack"
"running-environment-variable-group":"Retrieve the contents of the running environment variable group"
"staging-environment-variable-group":"Retrieve the contents of the staging environment variable group"
"set-staging-environment-variable-group":"Pass parameters as JSON to create a staging environment variable group"
"set-running-environment-variable-group":"Pass parameters as JSON to create a running environment variable group"
"feature-flags":"Retrieve list of feature flags with status of each flag-able feature"
"feature-flag":"Retrieve an individual feature flag with status"
"enable-feature-flag":"Enable the use of a feature so that users have access to and can use the feature"
"disable-feature-flag":"Disable the use of a feature so that users have access to and can use the feature"
"curl":"Executes a raw request, content-type set to application/json by default"
"config":"write default values to the config"
"oauth-token":"Retrieve and display the OAuth token for the current session"
"add-plugin-repo":"Add a new plugin repository"
"remove-plugin-repo":"Remove a plugin repository"
"list-plugin-repos":"list all the added plugin repository"
"repo-plugins":"List all available plugins in all added repositories"
"plugins":"list all available plugin commands"
"install-plugin":"Install the plugin defined in command argument"
"uninstall-plugin":"Uninstall the plugin defined in command argument"
"targets":"List all saved targets (requires cf-targets plugin)"
"save-target":"Save the current target under a given name (requires cf-targets plugin)"
"set-target":"Restore a previously saved target (requires cf-targets plugin)"
"delete-target":"Delete a saved target (requires cf-targets plugin)"
)
# -----------------------
# ----- end 1st Arguments
# -----------------------
# ----------
# ----- Main
# ----------
_arguments '*:: :->command'
if (( CURRENT == 1 )); then
_describe -t commands "cf command" _1st_arguments
return
fi
local -a _command_args
case "$words[1]" in
login)
__login ;;
logout)
__logout ;;
passwd)
__passwd ;;
target)
__target ;;
api)
__api ;;
auth)
__auth ;;
apps)
__apps ;;
app)
__app ;;
push)
__push ;;
scale)
__scale ;;
delete)
__delete ;;
rename)
__rename ;;
start)
__start ;;
stop)
__stop ;;
restart)
__restart ;;
restage)
__restage ;;
restart-app-instance)
__restart-app-instance ;;
events)
__events ;;
files)
__files ;;
logs)
__logs ;;
env)
__env ;;
set-env)
__set-env ;;
unset-env)
__unset-env ;;
stacks)
__stacks ;;
stack)
__stack ;;
copy-source)
__copy-source ;;
create-app-manifest)
__create-app-manifest ;;
marketplace)
__marketplace ;;
services)
__services ;;
service)
__service ;;
create-service)
__create-service ;;
update-service)
__update-service ;;
rename-service)
__rename-service ;;
delete-service)
__delete-service ;;
create-service-key)
__create-service-key ;;
service-keys)
__service-keys ;;
service-key)
__service-key ;;
delete-service-key)
__delete-service-key ;;
bind-service)
__bind-service ;;
unbind-service)
__unbind-service ;;
create-user-provided-service)
__create-user-provided-service ;;
update-user-provided-service)
__update-user-provided-service ;;
orgs)
__orgs ;;
org)
__org ;;
create-org)
__create-org ;;
delete-org)
__delete-org ;;
spaces)
__spaces ;;
space)
__space ;;
create-space)
__create-space ;;
delete-space)
__delete-space ;;
domains)
__domains ;;
create-domain)
__create-domain ;;
delete-domain)
__delete-domain ;;
create-shared-domain)
__create-shared-domain ;;
delete-shared-domain)
__delete-shared-domain ;;
routes)
__routes ;;
create-route)
__create-route ;;
check-route)
__check-route ;;
map-route)
__map-route ;;
unmap-route)
__unmap-route ;;
delete-route)
__delete-route ;;
delete-orphaned-routes)
__delete-orphaned-routes ;;
buildpacks)
__buildpacks ;;
create-buildpack)
__create-buildpack ;;
update-buildpack)
__update-buildpack ;;
rename-buildpack)
__rename-buildpack ;;
delete-buildpack)
__delete-buildpack ;;
running-environment-variable-group)
__running-environment-variable-group ;;
staging-environment-variable-group)
__staging-environment-variable-group ;;
set-staging-environment-variable-group)
__set-staging-environment-variable-group ;;
set-running-environment-variable-group)
__set-running-environment-variable-group ;;
feature-flags)
__feature-flags ;;
feature-flag)
__feature-flag ;;
enable-feature-flag)
__enable-feature-flag ;;
disable-feature-flag)
__disable-feature-flag ;;
curl)
__curl ;;
config)
__config ;;
oauth-token)
__oauth-token ;;
add-plugin-repo)
__add-plugin-repo ;;
remove-plugin-repo)
__remove-plugin-repo ;;
list-plugin-repos)
__list-plugin-repos ;;
repo-plugins)
__repo-plugins ;;
plugins)
__plugins ;;
install-plugin)
__install-plugin ;;
uninstall-plugin)
__uninstall-plugin ;;
save-target)
__save-target ;;
set-target)
__set-target ;;
delete-target)
__delete-target ;;
esac

View File

@@ -0,0 +1,77 @@
#compdef chattr
# ------------------------------------------------------------------------------
# Copyright (c) 2016 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 chattr a tool to change file attributes on a Linux second extended file system. (http://e2fsprogs.sourceforge.net/).
#
# ------------------------------------------------------------------------------
# Authors
# -------
#
# * Jindřich Pilař (https://github.com/JindrichPilar)
#
# ------------------------------------------------------------------------------
_chattr() {
_arguments -C \
"-R[Recursively change attributes of directories and their contents.]" \
"-V[Be verbose with chattr's output and print the program version.]" \
"-f[Suppress most error messages.]" \
"-v[Set the file's version/generation number.]:version:" \
"(-A)+A[Disable atime updates]" \
"(+A)-A[Enable atime updates]" \
"(-a)+a[Enable append only - file cannot be overridden]" \
"(+a)-a[Disable append only - file can be overridden]" \
"(-c)+c[Enable automatic compression]" \
"(+c)-c[Disable automatic compression]" \
"(-D)+D[Enable synchronous directory updates]" \
"(+D)-D[Disable synchronous directory updates]" \
"(-d)+d[Forbid backing file up with dump program]" \
"(+d)-d[Allow backing file up with dump program]" \
"(-i)+i[Mark as immutable]" \
"(+i)-i[Unmark as immutable]" \
"(-j)+j[Enable ext3 journaling]" \
"(+j)-j[Disable ext3 journaling]" \
"(-s)+s[Enable secure deletion - zero all blocks on delete]" \
"(+s)-s[Disable secure deletion - do not zero all blocks on delete]" \
"(-S)+S[Enable synchronous updates]" \
"(+S)-S[Disable synchronous updates]" \
"(-T)+T[Set top of hierarchy - direct subdirectories are allocated independently]" \
"(+T)-T[Unset top of hierarchy]" \
"(-t)+t[Disable tail merging]" \
"(+t)-t[Enable tail merging]" \
"(-u)+u[Mark as undeletable - enable undeletion]" \
"(+u)-u[Unmark as undeletable - disable undeletion]" \
'*:files:_files' \
}
_chattr

View File

@@ -0,0 +1,73 @@
#compdef cheat
# ------------------------------------------------------------------------------
# Copyright (c) 2016 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 Cheat an interactive cheatsheets on the command-line. (https://github.com/chrisallenlane/cheat/).
#
# ------------------------------------------------------------------------------
# Authors
# -------
#
# * Jindřich Pilař (https://github.com/JindrichPilar)
#
# ------------------------------------------------------------------------------
local cheats
_cheat_load_cheats() {
cheats=("${(f)$(cheat -l | cut -d' ' -f1)}")
}
_cheat() {
_arguments -C -s -S -n \
'(- 1 *)'{-d,--directories}'[List directories on CHEATPATH]: :->full' \
'(- 1 *)'{-e,--edit}'[Edit cheatsheet]:cheat:->cheats' \
'(- 1 *)'{-l,--list}'[List cheatsheets]: :->full' \
'(- 1 *)'{-s,--search}'[Search cheatsheets for <keyword>]: :->full' \
'(- 1 *)'{-v,--version}'[display version and copyright information]: :->full' \
case "$state" in
(full)
;;
(cheats)
_cheat_load_cheats
_describe -t cheats 'cheats' cheats
;;
(*)
_cheat_load_cheats
_describe -t cheats 'cheats' cheats
;;
esac
}
_cheat

View File

@@ -1,5 +1,30 @@
#compdef cmake
# ------------------------------------------------------------------------------
# Copyright (c) 2016 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
# -----------
#
@@ -9,7 +34,8 @@
# Authors
# -------
#
# * Scott M. Kroll <skroll@gmail.com>
# * Scott M. Kroll <skroll@gmail.com> (initial version)
# * Paul Seyfert <pseyfert@mathphys.fsk.uni-heidelberg.de> (handling of --build)
#
# -------------------------------------------------------------------------
# Notes
@@ -24,10 +50,133 @@
#
# -------------------------------------------------------------------------
_cmake() {
local context state line curcontext="$curcontext" cmake_args
local context state line curcontext="$curcontext" cmake_args
local cmake_help_actions;cmake_help_actions=(
local cmake_build_options;cmake_build_options=(
'-C[Pre-load a script to populate the cache]:script:_files'
'*-D-[Create a cmake cache entry]:property:_cmake_define_property'
'-U[Remove matching entries from CMake cache]:globbing expression'
'-G[Specify a makefile generator]:generator:_cmake_generators'
'-T[Specify toolset name if supported by generator]:toolset name'
'(-Wno-dev -Wdev)-Wno-dev[Suppress/Enable developer warnings]'
'(-Wno-dev -Wdev)-Wdev[Suppress/Enable developer warnings]'
'(-Wno-deprecated -Wdeprecated)-Wno-deprecated[Suppress/Enable deprecation warnings]'
'(-Wno-deprecated -Wdeprecated)-Wdeprecated[Suppress/Enable deprecation warnings]'
'(-Wno-error=dev -Werror=dev)-Wno-error=dev[Make developer warnings (not) errors]'
'(-Wno-error=dev -Werror=dev)-Werror=dev[Make developer warnings (not) errors]'
'(-Wno-error=deprecated -Werror=deprecated)-Werror=deprecated[Make deprecated macro and function warnings (not) errors]'
'(-Wno-error=deprecated -Werror=deprecated)-Wno-error=deprecated[Make deprecated macro and function warnings (not) errors]'
'--warn-uninitialized[Warn about uninitialized values.]'
'--warn-unused-vars[Warn about unused variables.]'
'--no-warn-unused-cli[Dont warn about command line options.]'
'-i[Run in wizard mode]'
'-L-[List cache variables]::_values "options" "[non-advanced cache variables]" "A[advanced cache variables]" "H[non-advanced cached variables with help]" "AH[advanced cache variables with help]"'
'--trace[Put cmake in trace mode]'
'--find-package[Run in pkg-config like mode.]'
':cmake project:_files -/'
)
# ------------------------
# _cmake_generator_options
# ------------------------
(( $+functions[_cmake_generator_options] )) ||
_cmake_generator_options() {
if [ -f $1/Makefile ]
then
$_comps[make]
elif [ -f $1/build.ninja ]
then
$_comps[ninja]
fi
}
# --------------
# _cmake_targets
# --------------
(( $+functions[_cmake_targets] )) ||
_cmake_targets() {
local -a targets
if [ -f $1/Makefile ]
then
# `make help` doesn't work for Makefiles in general, but for cmake generated makefiles it does.
i=1
for target in $(make help | \grep -e "\.\.\." | sed "s/\.\.\. //" | sed "s/ (the default.*//") ; do
targets[$i]=$target
(( i = $i + 1 ))
done
elif [ -f $1/build.ninja ]
then
# `ninja help` doesn't seem to be the list of targets we're interested in
i=1
for target in $(ninja -C $1 -t targets all 2&>/dev/null | awk -F: '{print $1}') ; do
targets[$i]="$target"
(( i++ ))
done
fi
_describe 'build targets' targets
}
_cmake_on_build() {
local build_extras;build_extras=(
'--[Native build tool options]'
'--target[specify build target]'
'--clean-first[build target clean first]'
'--config[For multi-configuration tools]'
'--use-stderr')
local -a undescribed_build_extras
i=1
for be in $build_extras ; do
undescribed_build_extras[$i]=$(echo $be | sed "s/\[.*//")
(( i++ ))
done
inbuild=false
nativemode=false
for ((i = (($CURRENT - 1)); i > 1 ; i--)); do
if [[ $words[$i] == --build ]] ; then
inbuild=true
buildat=$i
(( difference = $CURRENT - $i ))
elif [[ $words[$i] == -- ]] ; then
nativemode=true
fi
done
# check if build mode has been left
outofbuild=false
for ((i = (($CURRENT - 1)); i > (($buildat + 1)); i--)); do
# don't check the word after --build (should be a directory)
if [[ ${undescribed_build_extras[(r)$words[$i]]} == $words[$i] ]] ; then continue ; fi
if [[ $words[(($i - 1))] == --target ]] ; then continue ; fi
if [[ $words[(($i - 1))] == --config ]] ; then continue ; fi
outofbuild=true
done
if [ "$nativemode" = true ] ; then
_cmake_generator_options $words[(($buildat + 1))] && return 0
fi
if [ "$inbuild" = false ] ; then
_arguments -C -s \
- build_opts \
"$cmake_build_options[@]" \
- build_cmds \
"$cmake_suggest_build[@]" && return 0
elif [ $difference -eq 1 ] ; then
# directly after --build comes the build directory
_alternative ':current directory:(.)' 'directory::_directories' && return 0
elif [[ $words[(($CURRENT - 1))] == --target ]] ; then
# after --build <dir> --target, suggest targets
_cmake_targets $words[(($buildat + 1))] && return 0
elif [[ $words[(($CURRENT - 1))] == --config ]] ; then
# after --build <dir> --config, no idea
return 0
elif [ "$outofbuild" = true ] ; then
# after --build <dir> --<not a --build option>, suggest other cmake_build_options (like -Wno-dev)
_arguments "$cmake_build_options[@]" && return 0
else
# after --build <dir>, suggest other cmake_build_options (like -Wno-dev) or --build options (like --clean-first)
_arguments "$build_extras[@]" "$cmake_build_options[@]" && return 0
fi
}
local cmake_help_actions;cmake_help_actions=(
'(- 1)--help-command[Print help for a single command and exit]:command-name:_cmake_command_names'
'(- 1)--help-command-list[List available listfile commands and exit]'
'(- 1)--help-commands[Print help for all commands and exit]'
@@ -47,33 +196,9 @@ _cmake() {
'(- 1)--help-html[Print full help in HTML format]'
'(- 1)--help-man[Print full help as a UNIX man page and exit]'
'(- 1)'{--version,-version}'[Print full help as a UNIX man page and exit]'
)
local cmake_build_options;cmake_build_options=(
'-C[Pre-load a script to populate the cache]:script:_files'
'*-D-[Create a cmake cache entry]:property:_cmake_define_property'
'-U[Remove matching entries from CMake cache]:globbing expression'
'-G[Specify a makefile generator]:generator:_cmake_generators'
'-T[Specify toolset name if supported by generator]:toolset name'
'(-Wno-dev -Wdev)-Wno-dev[Suppress developer warnings]'
'(-Wno-dev -Wdev)-Wdev[Enable developer warnings]'
'-i[Run in wizard mode]'
'-L-[List cache variables]::_values "options" "[non-advanced cache variables]" "A[advanced cache variables]" "H[non-advanced cached variables with help]" "AH[advanced cache variables with help]"'
'--trace[Put cmake in trace mode]'
':cmake project:_files -/'
)
local cmake_command_actions;cmake_command_actions=(
'-E[CMake command mode]:*:command'
)
_arguments -C -s \
- help \
"$cmake_help_actions[@]" \
- command \
"$cmake_command_actions[@]" \
- build_opts \
"$cmake_build_options[@]" && return 0
)
_cmake_help() {
_arguments -C -s - help "$cmake_help_actions[@]"
}
# -------------------
@@ -163,7 +288,7 @@ _cmake_define_lang_property_names() {
"CMAKE_${cmake_lang}_COMPILER:${cmake_lang_desc} compiler"
"CMAKE_${cmake_lang}_FLAGS:${cmake_lang_desc} compiler flags for all builds"
"CMAKE_${cmake_lang}_FLAGS_DEBUG:${cmake_lang_desc} compiler flags for all Debug build"
"CMAKE_${cmake_lang}_FLAGS_RLEASE:${cmake_lang_desc} compiler flags for all Relase build"
"CMAKE_${cmake_lang}_FLAGS_RELEASE:${cmake_lang_desc} compiler flags for all Relase build"
"CMAKE_${cmake_lang}_FLAGS_MINSIZREL:${cmake_lang_desc} compiler flags for all MinSizRel build"
"CMAKE_${cmake_lang}_FLAGS_RELWITHDEBINFO:${cmake_lang_desc} compiler flags for all RelWithDebInfo build"
)
@@ -177,10 +302,12 @@ _cmake_define_lang_property_names() {
(( $+functions[_cmake_define_common_property_names] )) ||
_cmake_define_common_property_names() {
local properties; properties=(
'CMAKE_MODULE_PATH:Search path for cmake modules'
'CMAKE_BUILD_TYPE:Specifies the build type for make based generators'
'CMAKE_TOOLCHAIN_FILE:Absolute or relative path to a cmake script which sets up toolchain related variables'
'CMAKE_COLOR_MAKEFILE:Enables/disables color output when using the Makefile generator'
'CMAKE_INSTALL_PREFIX:Install directory used by install'
'CMAKE_EXPORT_COMPILE_COMMANDS:Enable/disable output of compilation database during generation'
)
_describe -t 'common-property-names' 'common property name' properties $@
@@ -198,6 +325,7 @@ _cmake_define_property_values() {
(CMAKE_TOOLCHAIN_FILE) _wanted toolchain-files expl 'file' _cmake_toolchain_files && ret=0;;
(CMAKE_COLOR_MAKEFILE) _wanted booleans expl 'boolean' _cmake_booleans && ret=0;;
(CMAKE_INSTALL_PREFIX) _files -/ && ret=0;;
(CMAKE_EXPORT_COMPILE_COMMANDS) _wanted booleans expl 'boolean' _cmake_booleans && ret=0;;
(CMAKE_*_COMPILER) _wanted compilers expl 'compiler' _cmake_compilers && ret=0;;
(CMAKE_*_FLAGS(|_?*)) _message -e compiler-flags 'compiler flags' && ret=0;;
(*) _files && ret=0;;
@@ -269,6 +397,31 @@ _cmake_compilers() {
_command_names -e
}
local cmake_command_actions;cmake_command_actions=(
'-E[CMake command mode]:*:command'
)
_cmake_command() {
_arguments -C -s - command "$cmake_command_actions[@]"
}
_cmake "$@"
local cmake_suggest_build;cmake_suggest_build=(
'--build[build]'
)
if [ $CURRENT -eq 2 ] ; then
_arguments -C -s \
- help \
"$cmake_help_actions[@]" \
- command \
"$cmake_command_actions[@]" \
- build_opts \
"$cmake_build_options[@]" \
- build_cmds \
"$cmake_suggest_build[@]" && return 0
elif [[ $words[2] = --help* ]] ; then
_cmake_help
elif [[ $words[2] != -E ]] ; then
_cmake_on_build
else
_cmake_command
fi

View File

@@ -0,0 +1,60 @@
#compdef column
#
# ------------------------------------------------------------------------------
# Copyright (c) 2016 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 column (from util-linux 2.27.1->)
# (https://git.kernel.org/cgit/utils/util-linux/util-linux.git/)
#
# ------------------------------------------------------------------------------
# Authors
# -------
#
# * Ole Jørgen Brønner <olejorgenb@yahoo.no>
#
# ------------------------------------------------------------------------------
#
# Note: column has upstream bash completions.
#
# Automatically generated with http://github.com/RobSis/zsh-completion-generator
local arguments
arguments=(
'(-c --columns)'{-c,--columns}'[width of output in number of characters]:width:'
'(-t --table)'{-t,--table}'[create a table]'
'(-s --separator)'{-s,--separator}'[possible table delimiters]:separator:'
'(-o --output-separator)'{-o,--output-separator}'[columns separator for table output; default is two spaces]:separator:'
'(-x --fillrows)'{-x,--fillrows}'[fill rows before columns]'
'(-h --help)'{-h,--help}'[display this help and exit]'
'(-V --version)'{-V,--version}'[output version information and exit]'
'*:filename:_files'
)
_arguments -s $arguments

View File

@@ -35,18 +35,29 @@
# -------
#
# * loranger (https://github.com/loranger)
# * Yohan Tambè (https://github.com/Cronos87)
#
# ------------------------------------------------------------------------------
_find_console () {
echo "php $(find . -maxdepth 2 -mindepth 1 -name 'console' -type f | head -n 1)"
}
_console_get_command_list () {
php console --no-ansi | sed "1,/Available commands/d" | awk '/ [a-z]+/ { print $1 }'
IFS=" "
`_find_console` --no-ansi | \
sed "1,/Available commands/d" | \
awk '/ [a-z]+/ { print $0 }' | \
sed -E 's/^[ ]+//g' | \
sed -E 's/[:]+/\\:/g' | \
sed -E 's/[ ]{2,}/\:/g'
}
_console () {
if [ -f console ]; then
compadd `_console_get_command_list`
fi
local -a commands
IFS=$'\n'
commands=(`_console_get_command_list`)
_describe 'commands' commands
}
compdef _console php console

View File

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

View File

@@ -0,0 +1,68 @@
#compdef dad
# ------------------------------------------------------------------------------
# Copyright (c) 2016 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 dad a command line manager of aria2 daemon. (https://github.com/baskerville/diana).
#
# ------------------------------------------------------------------------------
# Authors
# -------
#
# * Jindřich Pilař (https://github.com/JindrichPilar)
#
# ------------------------------------------------------------------------------
_dad() {
local -a commands
commands=(
"start:Start aria2c daemon"
"stop:Stop aria2c daemon"
)
_arguments -C \
'(- 1 *)'-h"[Show help and exit]" \
"-d[Set download dir]:download_dir:->val" \
"-s[Set secret token]:secret_token:->val" \
"-u[Set aria2c username]:username:->val" \
"-p[Set aria2c password]:password:->val" \
'1:cmd:->cmds' \
'*: : :->args' \
case "$state" in
(cmds)
_describe -t commands 'commands' commands
;;
(*)
;;
esac
}
_dad

View File

@@ -1,30 +1,5 @@
#compdef debuild
# ------------------------------------------------------------------------------
# Copyright (c) 2011 Github zsh-users - http://github.com/zsh-users
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the zsh-users nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL ZSH-USERS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# ------------------------------------------------------------------------------
# Description
# -----------
#

Some files were not shown because too many files have changed in this diff Show More