NEW ERA
This commit is contained in:
1237
.tmux.conf
1237
.tmux.conf
File diff suppressed because it is too large
Load Diff
301
.tmux.conf.local
301
.tmux.conf.local
@@ -1,301 +0,0 @@
|
||||
# https://github.com/gpakosz/.tmux
|
||||
# (‑●‑●)> dual licensed under the WTFPL v2 license and the MIT license,
|
||||
# without any warranty.
|
||||
# Copyright 2012— Gregory Pakosz (@gpakosz).
|
||||
|
||||
|
||||
# -- navigation ----------------------------------------------------------------
|
||||
|
||||
# if you're running tmux within iTerm2
|
||||
# - and tmux is 1.9 or 1.9a
|
||||
# - and iTerm2 is configured to let option key act as +Esc
|
||||
# - and iTerm2 is configured to send [1;9A -> [1;9D for option + arrow keys
|
||||
# then uncomment the following line to make Meta + arrow keys mapping work
|
||||
#set -ga terminal-overrides "*:kUP3=\e[1;9A,*:kDN3=\e[1;9B,*:kRIT3=\e[1;9C,*:kLFT3=\e[1;9D"
|
||||
|
||||
|
||||
# -- windows & pane creation ---------------------------------------------------
|
||||
|
||||
# new window retains current path, possible values are:
|
||||
# - true
|
||||
# - false (default)
|
||||
tmux_conf_new_window_retain_current_path=false
|
||||
|
||||
# new pane retains current path, possible values are:
|
||||
# - true (default)
|
||||
# - false
|
||||
tmux_conf_new_pane_retain_current_path=true
|
||||
|
||||
# new pane tries to reconnect ssh sessions (experimental), possible values are:
|
||||
# - true
|
||||
# - false (default)
|
||||
tmux_conf_new_pane_reconnect_ssh=false
|
||||
|
||||
# prompt for session name when creating a new session, possible values are:
|
||||
# - true
|
||||
# - false (default)
|
||||
tmux_conf_new_session_prompt=false
|
||||
|
||||
|
||||
# -- display -------------------------------------------------------------------
|
||||
|
||||
# RGB 24-bit colour support (tmux >= 2.2), possible values are:
|
||||
# - true
|
||||
# - false (default)
|
||||
tmux_conf_theme_24b_colour=false
|
||||
|
||||
# window style
|
||||
tmux_conf_theme_window_fg='default'
|
||||
tmux_conf_theme_window_bg='default'
|
||||
|
||||
# highlight focused pane (tmux >= 2.1), possible values are:
|
||||
# - true
|
||||
# - false (default)
|
||||
tmux_conf_theme_highlight_focused_pane=false
|
||||
|
||||
# focused pane colours:
|
||||
tmux_conf_theme_focused_pane_fg='default'
|
||||
tmux_conf_theme_focused_pane_bg='#0087d7' # light blue
|
||||
|
||||
# pane border style, possible values are:
|
||||
# - thin (default)
|
||||
# - fat
|
||||
tmux_conf_theme_pane_border_style=thin
|
||||
|
||||
# pane borders colours:
|
||||
tmux_conf_theme_pane_border='#444444' # gray
|
||||
tmux_conf_theme_pane_active_border='#00afff' # light blue
|
||||
|
||||
# pane indicator colours
|
||||
tmux_conf_theme_pane_indicator='#00afff' # light blue
|
||||
tmux_conf_theme_pane_active_indicator='#00afff' # light blue
|
||||
|
||||
# status line style
|
||||
tmux_conf_theme_message_fg='#000000' # black
|
||||
tmux_conf_theme_message_bg='#ffff00' # yellow
|
||||
tmux_conf_theme_message_attr='bold'
|
||||
|
||||
# status line command style (<prefix> : Escape)
|
||||
tmux_conf_theme_message_command_fg='#ffff00' # yellow
|
||||
tmux_conf_theme_message_command_bg='#000000' # black
|
||||
tmux_conf_theme_message_command_attr='bold'
|
||||
|
||||
# window modes style
|
||||
tmux_conf_theme_mode_fg='#000000' # black
|
||||
tmux_conf_theme_mode_bg='#ffff00' # yellow
|
||||
tmux_conf_theme_mode_attr='bold'
|
||||
|
||||
# status line style
|
||||
tmux_conf_theme_status_fg='#8a8a8a' # light gray
|
||||
tmux_conf_theme_status_bg='#080808' # dark gray
|
||||
tmux_conf_theme_status_attr='none'
|
||||
|
||||
# terminal title
|
||||
# - built-in variables are:
|
||||
# - #{circled_window_index}
|
||||
# - #{circled_session_name}
|
||||
# - #{hostname}
|
||||
# - #{hostname_ssh}
|
||||
# - #{username}
|
||||
# - #{username_ssh}
|
||||
tmux_conf_theme_terminal_title='#h ❐ #S ● #I #W'
|
||||
|
||||
# window status style
|
||||
# - built-in variables are:
|
||||
# - #{circled_window_index}
|
||||
# - #{circled_session_name}
|
||||
# - #{hostname}
|
||||
# - #{hostname_ssh}
|
||||
# - #{username}
|
||||
# - #{username_ssh}
|
||||
tmux_conf_theme_window_status_fg='#8a8a8a' # light gray
|
||||
tmux_conf_theme_window_status_bg='#080808' # dark gray
|
||||
tmux_conf_theme_window_status_attr='none'
|
||||
tmux_conf_theme_window_status_format='#I #W'
|
||||
#tmux_conf_theme_window_status_format='#{circled_window_index} #W'
|
||||
#tmux_conf_theme_window_status_format='#I #W#{?window_bell_flag,🔔,}#{?window_zoomed_flag,🔍,}'
|
||||
|
||||
# window current status style
|
||||
# - built-in variables are:
|
||||
# - #{circled_window_index}
|
||||
# - #{circled_session_name}
|
||||
# - #{hostname}
|
||||
# - #{hostname_ssh}
|
||||
# - #{username}
|
||||
# - #{username_ssh}
|
||||
tmux_conf_theme_window_status_current_fg='#000000' # black
|
||||
tmux_conf_theme_window_status_current_bg='#00afff' # light blue
|
||||
tmux_conf_theme_window_status_current_attr='bold'
|
||||
tmux_conf_theme_window_status_current_format='#I #W'
|
||||
#tmux_conf_theme_window_status_current_format='#{circled_window_index} #W'
|
||||
#tmux_conf_theme_window_status_current_format='#I #W#{?window_zoomed_flag,🔍,}'
|
||||
|
||||
# window activity status style
|
||||
tmux_conf_theme_window_status_activity_fg='default'
|
||||
tmux_conf_theme_window_status_activity_bg='default'
|
||||
tmux_conf_theme_window_status_activity_attr='underscore'
|
||||
|
||||
# window bell status style
|
||||
tmux_conf_theme_window_status_bell_fg='#ffff00' # yellow
|
||||
tmux_conf_theme_window_status_bell_bg='default'
|
||||
tmux_conf_theme_window_status_bell_attr='blink,bold'
|
||||
|
||||
# window last status style
|
||||
tmux_conf_theme_window_status_last_fg='#00afff' # light blue
|
||||
tmux_conf_theme_window_status_last_bg='default'
|
||||
tmux_conf_theme_window_status_last_attr='none'
|
||||
|
||||
# status left/right sections separators
|
||||
tmux_conf_theme_left_separator_main=''
|
||||
tmux_conf_theme_left_separator_sub='|'
|
||||
tmux_conf_theme_right_separator_main=''
|
||||
tmux_conf_theme_right_separator_sub='|'
|
||||
#tmux_conf_theme_left_separator_main='\uE0B0' # /!\ you don't need to install Powerline
|
||||
#tmux_conf_theme_left_separator_sub='\uE0B1' # you only need fonts patched with
|
||||
#tmux_conf_theme_right_separator_main='\uE0B2' # Powerline symbols or the standalone
|
||||
#tmux_conf_theme_right_separator_sub='\uE0B3' # PowerlineSymbols.otf font, see README.md
|
||||
|
||||
# status left/right content:
|
||||
# - separate main sections with '|'
|
||||
# - separate subsections with ','
|
||||
# - built-in variables are:
|
||||
# - #{battery_bar}
|
||||
# - #{battery_hbar}
|
||||
# - #{battery_percentage}
|
||||
# - #{battery_status}
|
||||
# - #{battery_vbar}
|
||||
# - #{circled_session_name}
|
||||
# - #{hostname_ssh}
|
||||
# - #{hostname}
|
||||
# - #{loadavg}
|
||||
# - #{pairing}
|
||||
# - #{prefix}
|
||||
# - #{root}
|
||||
# - #{synchronized}
|
||||
# - #{uptime_y}
|
||||
# - #{uptime_d} (modulo 365 when #{uptime_y} is used)
|
||||
# - #{uptime_h}
|
||||
# - #{uptime_m}
|
||||
# - #{uptime_s}
|
||||
# - #{username}
|
||||
# - #{username_ssh}
|
||||
tmux_conf_theme_status_left=' ❐ #S '
|
||||
tmux_conf_theme_status_right='#{prefix}#{pairing}#{synchronized} #{?battery_status, #{battery_status},}#{?battery_bar, #{battery_bar},}#{?battery_percentage, #{battery_percentage},} , %R , %d %b | #{username}#{root} | #{hostname} '
|
||||
|
||||
# status left style
|
||||
tmux_conf_theme_status_left_fg='#000000,#e4e4e4,#e4e4e4' # black, white , white
|
||||
tmux_conf_theme_status_left_bg='#ffff00,#ff00af,#00afff' # yellow, pink, white blue
|
||||
tmux_conf_theme_status_left_attr='bold,none,none'
|
||||
|
||||
# status right style
|
||||
tmux_conf_theme_status_right_fg='#8a8a8a,#e4e4e4,#000000' # light gray, white, black
|
||||
tmux_conf_theme_status_right_bg='#080808,#d70000,#e4e4e4' # dark gray, red, white
|
||||
tmux_conf_theme_status_right_attr='none,none,bold'
|
||||
|
||||
# pairing indicator
|
||||
tmux_conf_theme_pairing='👓 ' # U+1F453
|
||||
tmux_conf_theme_pairing_fg='none'
|
||||
tmux_conf_theme_pairing_bg='none'
|
||||
tmux_conf_theme_pairing_attr='none'
|
||||
|
||||
# prefix indicator
|
||||
tmux_conf_theme_prefix='⌨ ' # U+2328
|
||||
tmux_conf_theme_prefix_fg='none'
|
||||
tmux_conf_theme_prefix_bg='none'
|
||||
tmux_conf_theme_prefix_attr='none'
|
||||
|
||||
# root indicator
|
||||
tmux_conf_theme_root='!'
|
||||
tmux_conf_theme_root_fg='none'
|
||||
tmux_conf_theme_root_bg='none'
|
||||
tmux_conf_theme_root_attr='bold,blink'
|
||||
|
||||
# synchronized indicator
|
||||
tmux_conf_theme_synchronized='🔒' # U+1F512
|
||||
tmux_conf_theme_synchronized_fg='none'
|
||||
tmux_conf_theme_synchronized_bg='none'
|
||||
tmux_conf_theme_synchronized_attr='none'
|
||||
|
||||
# battery bar symbols
|
||||
tmux_conf_battery_bar_symbol_full='◼'
|
||||
tmux_conf_battery_bar_symbol_empty='◻'
|
||||
#tmux_conf_battery_bar_symbol_full='♥'
|
||||
#tmux_conf_battery_bar_symbol_empty='·'
|
||||
|
||||
# battery bar length (in number of symbols), possible values are:
|
||||
# - auto
|
||||
# - a number, e.g. 5
|
||||
tmux_conf_battery_bar_length='auto'
|
||||
|
||||
# battery bar palette, possible values are:
|
||||
# - gradient (default)
|
||||
# - heat
|
||||
# - 'colour_full_fg,colour_empty_fg,colour_bg'
|
||||
tmux_conf_battery_bar_palette='gradient'
|
||||
#tmux_conf_battery_bar_palette='#d70000,#e4e4e4,#000000' # red, white, black
|
||||
|
||||
# battery hbar palette, possible values are:
|
||||
# - gradient (default)
|
||||
# - heat
|
||||
# - 'colour_low,colour_half,colour_full'
|
||||
tmux_conf_battery_hbar_palette='gradient'
|
||||
#tmux_conf_battery_hbar_palette='#d70000,#ff5f00,#5fff00' # red, orange, green
|
||||
|
||||
# battery vbar palette, possible values are:
|
||||
# - gradient (default)
|
||||
# - heat
|
||||
# - 'colour_low,colour_half,colour_full'
|
||||
tmux_conf_battery_vbar_palette='gradient'
|
||||
#tmux_conf_battery_vbar_palette='#d70000,#ff5f00,#5fff00' # red, orange, green
|
||||
|
||||
# symbols used to indicate whether battery is charging or discharging
|
||||
tmux_conf_battery_status_charging='↑' # U+2191
|
||||
tmux_conf_battery_status_discharging='↓' # U+2193
|
||||
#tmux_conf_battery_status_charging='⚡ ' # U+26A1
|
||||
#tmux_conf_battery_status_charging='🔌 ' # U+1F50C
|
||||
#tmux_conf_battery_status_discharging='🔋 ' # U+1F50B
|
||||
|
||||
# clock style (when you hit <prefix> + t)
|
||||
# you may want to use %I:%M %p in place of %R in tmux_conf_theme_status_right
|
||||
tmux_conf_theme_clock_colour='#00afff' # light blue
|
||||
tmux_conf_theme_clock_style='24'
|
||||
|
||||
|
||||
# -- clipboard -----------------------------------------------------------------
|
||||
|
||||
# in copy mode, copying selection also copies to the OS clipboard
|
||||
# - true
|
||||
# - false (default)
|
||||
# on macOS, this requires installing reattach-to-user-namespace, see README.md
|
||||
# on Linux, this requires xsel or xclip
|
||||
tmux_conf_copy_to_os_clipboard=false
|
||||
|
||||
|
||||
# -- user customizations -------------------------------------------------------
|
||||
# this is the place to override or undo settings
|
||||
|
||||
# increase history size
|
||||
set -g history-limit 100000
|
||||
|
||||
# start with mouse mode enabled
|
||||
#set -g mouse on
|
||||
|
||||
# force Vi mode
|
||||
# really you should export VISUAL or EDITOR environment variable, see manual
|
||||
#set -g status-keys vi
|
||||
#set -g mode-keys vi
|
||||
|
||||
# replace C-b by C-a instead of using both prefixes
|
||||
# set -gu prefix2
|
||||
# unbind C-a
|
||||
# unbind C-b
|
||||
# set -g prefix C-a
|
||||
# bind C-a send-prefix
|
||||
|
||||
# move status line to top
|
||||
#set -g status-position top
|
||||
|
||||
|
||||
# Shift arrow to switch windows
|
||||
bind -n S-Left previous-window
|
||||
bind -n S-Right next-window
|
||||
6
.vimrc
6
.vimrc
@@ -7,7 +7,6 @@ syntax enable " enable syntax processing
|
||||
set tabstop=4 " number of visual spaces per TAB
|
||||
set softtabstop=4 " number of spaces in tab when editing
|
||||
set expandtab " tabs are spaces
|
||||
set number " show line numbers
|
||||
set showcmd " show command in bottom bar
|
||||
set cursorline " highlight current line
|
||||
set wildmenu " visual autocomplete for command menu
|
||||
@@ -15,6 +14,11 @@ set lazyredraw " redraw only when we need to.
|
||||
set showmatch " highlight matching [{()}]
|
||||
set incsearch " search as characters are entered
|
||||
set hlsearch " highlight matches
|
||||
set hidden " switch buffers without saving
|
||||
set ignorecase smartcase " smart case search
|
||||
set scrolloff=8 " keep 8 lines visible above/below cursor
|
||||
set undofile " persistent undo across sessions
|
||||
set mouse=a " mouse support
|
||||
|
||||
|
||||
noremap <Up> <NOP>
|
||||
|
||||
@@ -1,75 +0,0 @@
|
||||
Contributing
|
||||
------------
|
||||
|
||||
This project would not exist without all of its users and [contributors][1].
|
||||
|
||||
If you have ideas on how to make the configuration easier to maintain or
|
||||
improve its performance, do not hesitate to fork and send pull requests.
|
||||
|
||||
### Issue Reporting
|
||||
|
||||
- Check that the issue has not already been reported.
|
||||
- Check that the issue has not already been fixed in the latest code.
|
||||
- Open an issue with a clear title and description in grammatically correct,
|
||||
complete sentences.
|
||||
|
||||
### Pull Request
|
||||
|
||||
- Read [how to properly contribute to open source projects on GitHub][2].
|
||||
- Use a topic branch to easily amend a pull request later, if necessary.
|
||||
- Write [good commit messages][3].
|
||||
- Squash commits on the topic branch before opening a pull request.
|
||||
- Use the same coding style and spacing.
|
||||
- Open a [pull request][4] that relates to but one subject with a clear
|
||||
title and description in grammatically correct, complete sentences.
|
||||
|
||||
#### Code Style
|
||||
|
||||
This project follows the [Google Shell Style Guide][5] when possible. However,
|
||||
there are a number of additional things to keep in mind.
|
||||
|
||||
- Local variables should be used whenever possible.
|
||||
- Prefer `zstyle` over environment variables for configuration.
|
||||
- Prefer (( ... )) over [[ ... ]] for arithmetic expression.
|
||||
- Use the function keyword to define functions.
|
||||
- The 80 character hard limit can be waived for readability.
|
||||
|
||||
#### Using an Alternative zprezto Directory
|
||||
|
||||
To work on zprezto without messing with your current configuration:
|
||||
|
||||
```sh
|
||||
mkdir devel-zprezto
|
||||
cd devel-zprezto
|
||||
git clone --recursive https://github.com/sorin-ionescu/prezto.git .zprezto
|
||||
ZDOTDIR=$(pwd)
|
||||
echo "Your development ZDOTDIR is $ZDOTDIR"
|
||||
setopt EXTENDED_GLOB
|
||||
for rcfile in "${ZDOTDIR:-$HOME}"/.zprezto/runcoms/^README.md(.N); do
|
||||
ln -s "$rcfile" "${ZDOTDIR:-$HOME}/.${rcfile:t}"
|
||||
done
|
||||
```
|
||||
|
||||
Then to start zsh in this development environment you will run:
|
||||
|
||||
```sh
|
||||
ZDOTDIR=/path/to/devel-zprezto zsh
|
||||
```
|
||||
|
||||
#### Modules
|
||||
|
||||
- A *README.md* must be present.
|
||||
- Large functions must be placed in a *functions* directory.
|
||||
- Functions that take arguments must have completion.
|
||||
|
||||
#### Themes
|
||||
|
||||
- A screenshots section must be present in the file header.
|
||||
- The pull request description must have [embedded screenshots][6].
|
||||
|
||||
[1]: https://github.com/sorin-ionescu/prezto/contributors
|
||||
[2]: http://gun.io/blog/how-to-github-fork-branch-and-pull-request
|
||||
[3]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
|
||||
[4]: https://help.github.com/articles/using-pull-requests
|
||||
[5]: https://google.github.io/styleguide/shell.xml
|
||||
[6]: http://daringfireball.net/projects/markdown/syntax#img
|
||||
@@ -1,20 +0,0 @@
|
||||
Copyright (c) 2009-2011 Robby Russell and contributors
|
||||
Copyright (c) 2011-2017 Sorin Ionescu and contributors
|
||||
|
||||
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
|
||||
@@ -1,136 +0,0 @@
|
||||
Prezto — Instantly Awesome Zsh
|
||||
==============================
|
||||
|
||||
Prezto is the configuration framework for [Zsh][1]; it enriches the command line
|
||||
interface environment with sane defaults, aliases, functions, auto completion,
|
||||
and prompt themes.
|
||||
|
||||
Installation
|
||||
------------
|
||||
|
||||
Prezto will work with any recent release of Zsh, but the minimum required
|
||||
version is 4.3.11.
|
||||
|
||||
1. Launch Zsh:
|
||||
|
||||
```console
|
||||
zsh
|
||||
```
|
||||
|
||||
2. Clone the repository:
|
||||
|
||||
```console
|
||||
git clone --recursive https://github.com/sorin-ionescu/prezto.git "${ZDOTDIR:-$HOME}/.zprezto"
|
||||
```
|
||||
|
||||
3. Create a new Zsh configuration by copying the Zsh configuration files
|
||||
provided:
|
||||
|
||||
```sh
|
||||
setopt EXTENDED_GLOB
|
||||
for rcfile in "${ZDOTDIR:-$HOME}"/.zprezto/runcoms/^README.md(.N); do
|
||||
ln -s "$rcfile" "${ZDOTDIR:-$HOME}/.${rcfile:t}"
|
||||
done
|
||||
```
|
||||
|
||||
Note: If you already have any of the given configuration files, `ln` will
|
||||
cause error. In simple cases you can load prezto by adding the line
|
||||
`source "${ZDOTDIR:-$HOME}/.zprezto/init.zsh"` to the bottom of your
|
||||
`.zshrc` and keep the rest of your Zsh configuration intact. For more
|
||||
complicated setups, it is recommended that you back up your original
|
||||
configs and replace them with the provided prezto runcoms.
|
||||
|
||||
4. Set Zsh as your default shell:
|
||||
|
||||
```console
|
||||
chsh -s /bin/zsh
|
||||
```
|
||||
|
||||
5. Open a new Zsh terminal window or tab.
|
||||
|
||||
### Troubleshooting
|
||||
|
||||
If you are not able to find certain commands after switching to *Prezto*,
|
||||
modify the `PATH` variable in *~/.zprofile* then open a new Zsh terminal
|
||||
window or tab.
|
||||
|
||||
Updating
|
||||
--------
|
||||
|
||||
Run `zprezto-update` to automatically check if there is an update to zprezto.
|
||||
If there are no file conflicts, zprezto and its submodules will be
|
||||
automatically updated. If there are conflicts you will instructed to go into
|
||||
the `$ZPREZTODIR` directory and resolve them yourself.
|
||||
|
||||
To pull the latest changes and update submodules manually:
|
||||
|
||||
```console
|
||||
cd $ZPREZTODIR
|
||||
git pull
|
||||
git submodule update --init --recursive
|
||||
```
|
||||
|
||||
Usage
|
||||
-----
|
||||
|
||||
Prezto has many features disabled by default. Read the source code and
|
||||
accompanying README files to learn of what is available.
|
||||
|
||||
### Modules
|
||||
|
||||
1. Browse */modules* to see what is available.
|
||||
2. Load the modules you need in *~/.zpreztorc* then open a new Zsh terminal
|
||||
window or tab.
|
||||
|
||||
### Themes
|
||||
|
||||
1. For a list of themes, type `prompt -l`.
|
||||
2. To preview a theme, type `prompt -p name`.
|
||||
3. Load the theme you like in *~/.zpreztorc* then open a new Zsh terminal
|
||||
window or tab.
|
||||
|
||||
![sorin theme][2]
|
||||
Note that the 'git' module may be required for special symbols to appear,
|
||||
such as those on the right of the above image. Add `'git'` to the `pmodule`
|
||||
list (under `zstyle ':prezto:load' pmodule \` in your *~/.zpreztorc*) to
|
||||
enable this module.
|
||||
|
||||
### External Modules
|
||||
|
||||
1. By default modules will be loaded from */modules* and */contrib*.
|
||||
2. Additional module directories can be added to the
|
||||
`:prezto:load:pmodule-dirs` setting in *~/.zpreztorc*.
|
||||
|
||||
Note that module names need to be unique or they will cause an error when
|
||||
loading.
|
||||
|
||||
```sh
|
||||
zstyle ':prezto:load' pmodule-dirs $HOME/.zprezto-contrib
|
||||
```
|
||||
|
||||
Customization
|
||||
-------------
|
||||
|
||||
The project is managed via [Git][3]. It is highly recommended that you fork this
|
||||
project; so, that you can commit your changes and push them to [GitHub][4] to
|
||||
not lose them. If you do not know how to use Git, follow this [tutorial][5] and
|
||||
bookmark this [reference][6].
|
||||
|
||||
Resources
|
||||
---------
|
||||
|
||||
The [Zsh Reference Card][7] and the [zsh-lovers][8] man page are indispensable.
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
This project is licensed under the MIT License.
|
||||
|
||||
[1]: http://www.zsh.org
|
||||
[2]: http://i.imgur.com/nrGV6pg.png "sorin theme"
|
||||
[3]: http://git-scm.com
|
||||
[4]: https://github.com
|
||||
[5]: http://gitimmersion.com
|
||||
[6]: https://git.github.io/git-reference/
|
||||
[7]: http://www.bash2zsh.com/zsh_refcard/refcard.pdf
|
||||
[8]: http://grml.org/zsh/zsh-lovers.html
|
||||
@@ -1,80 +0,0 @@
|
||||
alias g="git"
|
||||
alias a="git add --all :/"
|
||||
alias b="git branch"
|
||||
alias c="git commit -am"
|
||||
alias ch="git checkout"
|
||||
alias pull="git pull"
|
||||
alias rb="git reset HEAD --hard"
|
||||
alias s="git status"
|
||||
alias st="git stash"
|
||||
|
||||
# alias g5="git5"
|
||||
# alias e="git5 export"
|
||||
# alias m="git5 merge --no-ff"
|
||||
# alias ma="git5 mail -m"
|
||||
# alias push="git5 submit -xy"
|
||||
# alias push="git submit -xy"
|
||||
alias dc="a && c \"dummy comment\""
|
||||
# alias dcp="a; dc; git push"
|
||||
|
||||
alias zshconfig="subl ~/.zshrc"
|
||||
alias zshreload="exec zsh"
|
||||
|
||||
alias tarc="tar cvzf"
|
||||
# alias rcp="rsync --partial --progress --append --rsh=ssh -r -h"
|
||||
# alias rmv="rsync --partial --progress --append --rsh=ssh -r -h --remove-sent-files"
|
||||
# alias rsyncc="rsync -rzPhc"
|
||||
|
||||
alias pythonserve="sudo python -m SimpleHTTPServer 80"
|
||||
|
||||
# replace
|
||||
alias sg='perl -0pe'
|
||||
|
||||
# alias clbin="curl -F 'clbin=<-' https://clbin.com"
|
||||
|
||||
#alias afs="unmount-abra0; mount-abra0;"
|
||||
|
||||
alias .g='git --git-dir=$HOME/.dotgit/ --work-tree=$HOME'
|
||||
alias .gs='.g status -uno'
|
||||
alias .gp='.g commit -am "auto" && .g push'
|
||||
|
||||
alias p="perl -pe"
|
||||
alias p0="perl -0pe"
|
||||
|
||||
alias -g LATEST='*(om[1])'
|
||||
|
||||
#alias f1sql="/google/data/ro/projects/storage/f1/tools/f1-sql"
|
||||
|
||||
#alias t="task"
|
||||
|
||||
#alias revs="ssh abra0 'tail -f -n0 ~/reverse_shell' | tee -a .rem_history| zsh -s"
|
||||
#alias nika_pop="echo \"afplay ~/tmp/nika.mp3\" > ~/reverse_shell"
|
||||
|
||||
# remote tmux on server
|
||||
alias tmuxr="tmux new-session -A -s auto"
|
||||
alias tmuxa="tmux new-session -A -s"
|
||||
|
||||
alias FUNCTION_PRELUDE="setopt LOCAL_OPTIONS PIPE_FAIL XTRACE ERR_RETURN"
|
||||
alias FUNCTION_PRELUDE_NO_XTRACE="setopt LOCAL_OPTIONS PIPE_FAIL NO_XTRACE ERR_RETURN"
|
||||
|
||||
# pottering recommendation
|
||||
alias psc="ps xawf -eo pid,user,cgroup,args"
|
||||
|
||||
local arr=(
|
||||
rsync
|
||||
--info=PROGRESS2
|
||||
--progress
|
||||
--recursive
|
||||
--compress
|
||||
--human-readable
|
||||
--update
|
||||
--times
|
||||
--no-whole-file
|
||||
--itemize-changes
|
||||
--stats
|
||||
--verbose
|
||||
--links
|
||||
--no-perms
|
||||
--chmod=ugo=rwX
|
||||
)
|
||||
alias rsync2="$arr"
|
||||
@@ -1,331 +0,0 @@
|
||||
# : magic
|
||||
# ':' just evaluates the given expression
|
||||
# : "${1:?dirs?}" exits saying "dirs?" if $1 is unset or null
|
||||
# : "${1:=best}" sets $1 to "best" if $1 is unset or null
|
||||
|
||||
# ${(j:,:)arr} joins arr with commas
|
||||
|
||||
|
||||
function reset_facl {
|
||||
FUNCTION_PRELUDE
|
||||
|
||||
: "${1:?dirs?}"
|
||||
|
||||
# reassign owner to root
|
||||
chown --recursive "root:root" "${@:1}"
|
||||
chmod --recursive "u=rwX,g=,o=" "${@:1}"
|
||||
# clear facl
|
||||
setfacl --recursive --remove-all "${@:1}"
|
||||
}
|
||||
|
||||
function add_facl {
|
||||
FUNCTION_PRELUDE
|
||||
|
||||
: "${1:?user?}"
|
||||
: "${2:?dirs?}"
|
||||
|
||||
local arr=(
|
||||
user::rwX
|
||||
user:${1}:rwX
|
||||
default:user:${1}:rwX
|
||||
group::0
|
||||
default:group::0
|
||||
mask::rwX
|
||||
default:mask::rwX
|
||||
other::0
|
||||
default:other::0
|
||||
)
|
||||
|
||||
setfacl --recursive --modify "${(j:,:)arr}" "${@:2}"
|
||||
}
|
||||
|
||||
function is_local {
|
||||
local HOSTNAME="$(hostname)"
|
||||
|
||||
[[ "$HOSTNAME" =~ '^abra0' || "$HOSTNAME" == "svxf2-osx" ]]
|
||||
}
|
||||
|
||||
function mount_sshfs {
|
||||
FUNCTION_PRELUDE
|
||||
|
||||
: "${1:?destination name?}"
|
||||
|
||||
local DESTINATION="$1"
|
||||
local LOCAL_MOUNT_PATH="/Users/$USER/mount/$1"
|
||||
|
||||
mkdir -p "$LOCAL_MOUNT_PATH"
|
||||
|
||||
if mount | grep "$LOCAL_MOUNT_PATH"; then
|
||||
umount "$LOCAL_MOUNT_PATH";
|
||||
fi
|
||||
|
||||
sshfs \
|
||||
-o allow_other \
|
||||
-o kernel_cache \
|
||||
-o direct_io \
|
||||
-o auto_cache \
|
||||
-o defer_permissions \
|
||||
-o noappledouble \
|
||||
-o cache=yes \
|
||||
-o Compression=yes \
|
||||
-o reconnect \
|
||||
-o workaround=rename \
|
||||
"$DESTINATION:/" "$LOCAL_MOUNT_PATH"
|
||||
|
||||
# if [[ ! -e "$LOCAL_COMMAND_PIPE_PATH" ]]; then
|
||||
# echo "Can't find the command pipe"
|
||||
# return
|
||||
# fi
|
||||
|
||||
echo "Starting remote command pipe..."
|
||||
|
||||
ssh $DESTINATION "
|
||||
set -euxo pipefail
|
||||
|
||||
if [[ -e /tmp/sshfs_command_pipe ]]; then
|
||||
rm /tmp/sshfs_command_pipe
|
||||
fi
|
||||
|
||||
mkfifo /tmp/sshfs_command_pipe
|
||||
|
||||
tail -f /tmp/sshfs_command_pipe
|
||||
" | zsh -x
|
||||
}
|
||||
|
||||
# function sublr {
|
||||
# FUNCTION_PRELUDE
|
||||
|
||||
# local HOSTNAME=$(hostname)
|
||||
# local FULL_PATH=$(realpath $1)
|
||||
|
||||
# echo "subl /Users/abra/mount/$HOSTNAME/$FULL_PATH" > /tmp/sshfs_command_pipe
|
||||
# }
|
||||
|
||||
function cdtmp {
|
||||
FUNCTION_PRELUDE
|
||||
|
||||
local DATESTR="$(date +%Y_%m_%d_%H_%M_%S)"
|
||||
local DIR_PATH="${HOME}/tmp/auto_${DATESTR}"
|
||||
|
||||
if [[ -n "$1" ]]; then
|
||||
local DIR_PATH="${DIR_PATH}_$1"
|
||||
fi
|
||||
|
||||
if [[ -e "${DIR_PATH}" ]]; then
|
||||
echo "${DIR_PATH} already exists"
|
||||
return 1
|
||||
fi
|
||||
|
||||
mkcd "${DIR_PATH}"
|
||||
echo "${DIR_PATH}"
|
||||
}
|
||||
|
||||
function mkcd {
|
||||
FUNCTION_PRELUDE_NO_XTRACE
|
||||
|
||||
: "${1:?where?}"
|
||||
|
||||
if [[ -e $1 ]]; then
|
||||
echo "file exists"
|
||||
return 1
|
||||
fi
|
||||
|
||||
mkdir $1
|
||||
|
||||
cd $1
|
||||
}
|
||||
|
||||
function publish {
|
||||
FUNCTION_PRELUDE
|
||||
|
||||
rsync2 "$@" "dedi:/var/www/abra.me/list/"
|
||||
}
|
||||
|
||||
function twitch {
|
||||
FUNCTION_PRELUDE
|
||||
|
||||
livestreamer "http://www.twitch.tv/${1}" "${${@:2}:-best}"
|
||||
}
|
||||
|
||||
function save_stream {
|
||||
FUNCTION_PRELUDE
|
||||
|
||||
local NAME=$1
|
||||
|
||||
if [[ ! -d $NAME ]]; then
|
||||
echo ':('
|
||||
return 1
|
||||
fi
|
||||
|
||||
while true; do
|
||||
local CURDATE=$(date +"%Y-%m-%d-%H:%M:%S")
|
||||
livestreamer "https://twitch.tv/$NAME" -o "$NAME/$CURDATE.mp4" || true
|
||||
sleep 30
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
function dcp {
|
||||
FUNCTION_PRELUDE
|
||||
|
||||
git add --all :/
|
||||
|
||||
git commit -m "${*:-$(whoami) at $(date)}"
|
||||
|
||||
git push
|
||||
}
|
||||
|
||||
|
||||
function .dcp {
|
||||
FUNCTION_PRELUDE
|
||||
|
||||
.g add -u
|
||||
|
||||
.g commit -m "${*:-$(whoami) at $(date)}"
|
||||
|
||||
.g push
|
||||
}
|
||||
|
||||
function strip_tags {
|
||||
FUNCTION_PRELUDE
|
||||
|
||||
find . -type f -name '*.mp3' \
|
||||
| tr '\n' '\0' \
|
||||
| xargs -0 -n1 mid3v2 --delete-frames=APIC,TXXX,USLT,TBPM
|
||||
}
|
||||
|
||||
function levi_beet {
|
||||
FUNCTION_PRELUDE
|
||||
|
||||
ssh levi -- sudo BEETSDIR=/projects/config/beets -u torrent beet "$@"
|
||||
}
|
||||
|
||||
function beet_comments {
|
||||
FUNCTION_PRELUDE
|
||||
|
||||
: "${1:?who?}"
|
||||
: "${2:?what?}"
|
||||
|
||||
levi_beet modify \'"comments=$2"\' \'"albumartist::$1"\'
|
||||
}
|
||||
|
||||
function sync_music {
|
||||
FUNCTION_PRELUDE
|
||||
|
||||
# if ! is_local; then
|
||||
# echo "Should be local"
|
||||
# return 1
|
||||
# fi
|
||||
|
||||
local MUSIC_DIR="$HOME/music/library"
|
||||
|
||||
mkdir -p "$MUSIC_DIR"
|
||||
|
||||
rsync2 \
|
||||
--delete \
|
||||
"levi:/projects/music/" \
|
||||
"$MUSIC_DIR/"
|
||||
}
|
||||
|
||||
# function .g-init() {
|
||||
# git init --bare $HOME/.dotgit
|
||||
# .g config --local status.showUntrackedFiles no
|
||||
# .g remote add origin ssh://dedi/root/.dotgit
|
||||
# git config --global user.name "Your Name"
|
||||
# git config --global user.email you@example.com
|
||||
# .g remote add origin ssh://dedi/var/www/git.abra.me/dot.git
|
||||
# }
|
||||
|
||||
|
||||
# make_user() {
|
||||
# FUNCTION_PRELUDE
|
||||
|
||||
# if is_local; then
|
||||
# echo "You're local"
|
||||
# return 1
|
||||
# fi
|
||||
|
||||
# adduser --system --shell /bin/zsh --disabled-password $1 || return 1
|
||||
|
||||
# # wget abra.me/.dotfiles.tar.gz -O /home/$1/.dotfiles.tar.gz
|
||||
# # tar xf /home/$1/.dotfiles.tar.gz -C /home/$1
|
||||
# # chown $1:nogroup -R /home/$1/
|
||||
# }
|
||||
|
||||
# function latest() {
|
||||
# echo -n ("${(@f)$(ls *(om[1,$1]))}")
|
||||
# }
|
||||
|
||||
function testo {
|
||||
local A="${@[2,3]}"
|
||||
./t.py ${(t)A} "$A" ${A[@]}
|
||||
unset A
|
||||
|
||||
local A=("$@[2,3]")
|
||||
./t.py ${(t)A} "$A" ${A[@]}
|
||||
unset A
|
||||
|
||||
./t.py "$@[2,3]"
|
||||
}
|
||||
# testo 1 "2 3" 4
|
||||
|
||||
# shit shit shit s hist h is htisthsi 2018-06-30
|
||||
function ffmpeg_timelapse {
|
||||
FUNCTION_PRELUDE
|
||||
|
||||
local DATE="$1"
|
||||
|
||||
ls "/mnt/a/snaps/$DATE" | wc -l
|
||||
|
||||
ffmpeg \
|
||||
-framerate 60 \
|
||||
-pattern_type glob -i "/mnt/a/snaps/$DATE/*.jpg" \
|
||||
"${@:2}" \
|
||||
-y "/mnt/a/tmp/$DATE.mp4"
|
||||
|
||||
mv "/mnt/a/tmp/$DATE.mp4" "/mnt/a/$DATE.mp4"
|
||||
|
||||
rm -rf "/mnt/a/snaps/$DATE"
|
||||
}
|
||||
|
||||
function ffmpeg_timelapse_today {
|
||||
local TODAY="$(date '+%Y-%m-%d')"
|
||||
|
||||
ffmpeg_timelapse "$TODAY" -preset ultrafast -crf 20
|
||||
}
|
||||
|
||||
function update_.g {
|
||||
if [[ ! -d "$HOME/.dotgit" ]]; then
|
||||
# no git to update
|
||||
return
|
||||
fi
|
||||
|
||||
# force updating origin to new server
|
||||
.g remote set-url origin https://gitea.abra.me/svxf/dotfiles.git
|
||||
|
||||
local RES="$(.g pull --no-stat 2>&1)"
|
||||
|
||||
if [[ $? != 0 ]]; then
|
||||
# something went wrong
|
||||
return
|
||||
fi
|
||||
|
||||
# no verbose :(
|
||||
# if [[ ! $RES =~ "Already up.to.date" ]]; then
|
||||
# echo "Updated .g"
|
||||
# echo $RES
|
||||
# echo "======"
|
||||
# echo
|
||||
# zshreload
|
||||
# fi
|
||||
}
|
||||
|
||||
function .sh_setup {
|
||||
echo 'wget abra.me/.sh && chmod +x .sh && ./.sh'
|
||||
}
|
||||
|
||||
function send_new_torrents {
|
||||
FUNCTION_PRELUDE
|
||||
|
||||
rsync2 --remove-source-files ~/Downloads/*.torrent(mm-10) levi:/projects/torrent_autoadd/
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
zsource_if_exists "${ZDOTDIR:-$HOME}/.zprezto/abra/options.zsh"
|
||||
zsource_if_exists "${ZDOTDIR:-$HOME}/.zprezto/abra/aliases.zsh"
|
||||
zsource_if_exists "${ZDOTDIR:-$HOME}/.zprezto/abra/functions.zsh"
|
||||
|
||||
zsource_if_exists "$HOME/.iterm2_shell_integration.zsh"
|
||||
|
||||
# update, background+disown
|
||||
update_.g &!
|
||||
@@ -1,56 +0,0 @@
|
||||
# Disable corrections
|
||||
unsetopt CORRECT
|
||||
# Now we can pipe to multiple outputs!
|
||||
setopt MULTIOS
|
||||
# This makes cd=pushd
|
||||
setopt AUTO_PUSHD
|
||||
# This will use named dirs when possible
|
||||
setopt AUTO_NAME_DIRS
|
||||
# If we have a glob this will expand it
|
||||
setopt GLOB_COMPLETE
|
||||
# use magic (this is default, but it can't hurt!)
|
||||
setopt ZLE
|
||||
# setopt NO_HUP
|
||||
# setopt IGNORE_EOF
|
||||
# If I could disable Ctrl-s completely I would!
|
||||
setopt NO_FLOW_CONTROL
|
||||
# unsetopt normstarsilent
|
||||
|
||||
## Keep echo "station" > station from clobbering station
|
||||
#setopt NO_CLOBBER
|
||||
setopt CLOBBER
|
||||
|
||||
# No ! voodoo
|
||||
unsetopt bang_hist
|
||||
|
||||
# Case insensitive globbing
|
||||
setopt NO_CASE_GLOB
|
||||
# Be Reasonable!
|
||||
setopt NUMERIC_GLOB_SORT
|
||||
# I don't know why I never set this before.
|
||||
setopt EXTENDED_GLOB
|
||||
# hows about arrays be awesome? (that is, frew${cool}frew has frew surrounding all the variables, not just first and last
|
||||
setopt RC_EXPAND_PARAM
|
||||
# disable running directory names
|
||||
unsetopt AUTO_CD
|
||||
|
||||
# return in functions if a command fails
|
||||
# setopt ERR_RETURN
|
||||
|
||||
|
||||
|
||||
# Who doesn't want home and end to work?
|
||||
bindkey '\e[1~' beginning-of-line
|
||||
bindkey '\e[4~' end-of-line
|
||||
|
||||
bindkey "\eOH" beginning-of-line
|
||||
bindkey "\eOF" end-of-line
|
||||
|
||||
# modules
|
||||
|
||||
# saves $EPOCHSECONDS
|
||||
zmodload zsh/datetime
|
||||
zmodload zsh/mathfunc
|
||||
|
||||
# profiler
|
||||
# zmodload zsh/zprof
|
||||
@@ -1,113 +0,0 @@
|
||||
pmodload 'helper'
|
||||
|
||||
# %<num>>dsadsa>dsadsa -- truncation
|
||||
# %~ -- current dir
|
||||
# %F{color}...%f -- foreground colors
|
||||
# %B...%b -- bold
|
||||
# %(x.a.b) -- if
|
||||
# ${(l)} -- padding
|
||||
|
||||
# color chart: https://upload.wikimedia.org/wikipedia/en/1/15/Xterm_256color_chart.svg
|
||||
# COLOR_PWD='141'
|
||||
# COLOR_PWD_ROOT='201'
|
||||
# COLOR_PROMPT_STARTER='85'
|
||||
# COLOR_TIME='244'
|
||||
# COLOR_USERNAME='34'
|
||||
# COLOR_AT='244'
|
||||
# COLOR_HOSTNAME='162'
|
||||
|
||||
COLOR_PWD='cyan'
|
||||
COLOR_PWD_ROOT='red'
|
||||
COLOR_PROMPT_STARTER='green'
|
||||
COLOR_TIME='green'
|
||||
COLOR_USERHOSTNAME='blue'
|
||||
COLOR_DURATION='magenta'
|
||||
|
||||
NEWLINE=$'\n'
|
||||
|
||||
function prompt_abra_precmd {
|
||||
setopt LOCAL_OPTIONS
|
||||
unsetopt XTRACE KSH_ARRAYS
|
||||
|
||||
# Get Git repository information.
|
||||
if [[ -z $NOGIT ]] && (( $+functions[git-info] )); then
|
||||
git-info || true
|
||||
fi
|
||||
|
||||
PRE_LENGTH=$(( ${COLUMNS} * 2 / 3 ))
|
||||
|
||||
# take current directory and truncate left so that up to $PRE_LENGTH chars are left
|
||||
PRE='%${PRE_LENGTH}<...<%~ %<<'
|
||||
PRE=$(print -P ${PRE})
|
||||
PRE=$(print ${(l:${COLUMNS}:)PRE})
|
||||
# print -P '%(!.%F{${COLOR_PWD_ROOT}}.%F{${COLOR_PWD}})${PRE}%f'
|
||||
print -P '%F{${COLOR_PWD}}${PRE}%f'
|
||||
|
||||
if [[ -z $PREEXEC_TIME ]]; then
|
||||
EXECTIME=0
|
||||
else
|
||||
EXECTIME=$(( EPOCHREALTIME - PREEXEC_TIME ))
|
||||
fi
|
||||
|
||||
if (( EXECTIME > 5 )); then
|
||||
SEC=$(( int(rint(EXECTIME % 60)) ))
|
||||
MIN=$(( int(rint(EXECTIME / 60 % 60)) ))
|
||||
HOUR=$(( int(rint(EXECTIME / 3600)) ))
|
||||
|
||||
DURATION="$(printf '%02d:%02d:%02d ' $HOUR $MIN $SEC)"
|
||||
else
|
||||
DURATION=''
|
||||
fi
|
||||
}
|
||||
|
||||
function prompt_abra_preexec {
|
||||
PREEXEC_TIME=$EPOCHREALTIME
|
||||
}
|
||||
|
||||
function prompt_abra_setup {
|
||||
setopt LOCAL_OPTIONS
|
||||
unsetopt XTRACE KSH_ARRAYS
|
||||
prompt_opts=(cr percent subst)
|
||||
|
||||
# Load required functions.
|
||||
autoload -Uz add-zsh-hook
|
||||
|
||||
# Add hook for calling git-info before each command.
|
||||
add-zsh-hook precmd prompt_abra_precmd
|
||||
add-zsh-hook preexec prompt_abra_preexec
|
||||
|
||||
# Set git-info parameters.
|
||||
zstyle ':prezto:module:git:info' verbose 'yes'
|
||||
zstyle ':prezto:module:git:info:action' format ':%%B%F{yellow}%s%f%%b'
|
||||
zstyle ':prezto:module:git:info:added' format ' %%B%F{green}✚%f%%b'
|
||||
zstyle ':prezto:module:git:info:ahead' format ' %%B%F{yellow}⬆%f%%b'
|
||||
zstyle ':prezto:module:git:info:behind' format ' %%B%F{yellow}⬇%f%%b'
|
||||
zstyle ':prezto:module:git:info:branch' format ':%F{green}%b%f'
|
||||
zstyle ':prezto:module:git:info:commit' format ':%F{green}%.7c%f'
|
||||
zstyle ':prezto:module:git:info:deleted' format ' %%B%F{red}✖%f%%b'
|
||||
zstyle ':prezto:module:git:info:modified' format ' %%B%F{blue}✱%f%%b'
|
||||
zstyle ':prezto:module:git:info:position' format ':%F{red}%p%f'
|
||||
zstyle ':prezto:module:git:info:renamed' format ' %%B%F{magenta}➜%f%%b'
|
||||
zstyle ':prezto:module:git:info:stashed' format ' %%B%F{cyan}✭%f%%b'
|
||||
zstyle ':prezto:module:git:info:unmerged' format ' %%B%F{yellow}═%f%%b'
|
||||
zstyle ':prezto:module:git:info:untracked' format ' %%B%F{white}◼%f%%b'
|
||||
zstyle ':prezto:module:git:info:keys' format \
|
||||
'prompt' '%b ' \
|
||||
'rprompt' '%A%B%S%a%d%m%r%U%u'
|
||||
|
||||
|
||||
|
||||
PROMPT=''
|
||||
PROMPT=$PROMPT'${git_info:+${(e)git_info[prompt]}}'
|
||||
PROMPT=$PROMPT'%(?.%F{$COLOR_PROMPT_STARTER}.%F{red})➤ %f'
|
||||
|
||||
RPROMPT=''
|
||||
RPROMPT=$RPROMPT'%(?..%F{red}%?%f )' # last command code if nonzero
|
||||
RPROMPT=$RPROMPT'%B%(!.%F{${COLOR_PWD_ROOT}}.%F{${COLOR_USERHOSTNAME}})%n@%M%f%b'
|
||||
RPROMPT=$RPROMPT'${git_info[rprompt]} '
|
||||
RPROMPT=$RPROMPT'%F{$COLOR_DURATION}$DURATION%f'
|
||||
RPROMPT=$RPROMPT'%F{$COLOR_TIME}%*%f'
|
||||
}
|
||||
|
||||
prompt_abra_setup "$@"
|
||||
|
||||
@@ -1,191 +0,0 @@
|
||||
#
|
||||
# Initializes Prezto.
|
||||
#
|
||||
# Authors:
|
||||
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
||||
#
|
||||
|
||||
#
|
||||
# Version Check
|
||||
#
|
||||
|
||||
# Check for the minimum supported version.
|
||||
min_zsh_version='4.3.11'
|
||||
if ! autoload -Uz is-at-least || ! is-at-least "$min_zsh_version"; then
|
||||
printf "prezto: old shell detected, minimum required: %s\n" "$min_zsh_version" >&2
|
||||
return 1
|
||||
fi
|
||||
unset min_zsh_version
|
||||
|
||||
# zprezto convenience updater
|
||||
# The function is surrounded by ( ) instead of { } so it starts in a subshell
|
||||
# and won't affect the environment of the calling shell
|
||||
function zprezto-update {
|
||||
(
|
||||
function cannot-fast-forward {
|
||||
local STATUS="$1"
|
||||
[[ -n "${STATUS}" ]] && printf "%s\n" "${STATUS}"
|
||||
printf "Unable to fast-forward the changes. You can fix this by "
|
||||
printf "running\ncd '%s' and then\n'git pull' " "${ZPREZTODIR}"
|
||||
printf "to manually pull and possibly merge in changes\n"
|
||||
}
|
||||
cd -q -- "${ZPREZTODIR}" || return 7
|
||||
local orig_branch="$(git symbolic-ref HEAD 2> /dev/null | cut -d '/' -f 3)"
|
||||
if [[ "$orig_branch" == "master" ]]; then
|
||||
git fetch || return "$?"
|
||||
local UPSTREAM=$(git rev-parse '@{u}')
|
||||
local LOCAL=$(git rev-parse HEAD)
|
||||
local REMOTE=$(git rev-parse "$UPSTREAM")
|
||||
local BASE=$(git merge-base HEAD "$UPSTREAM")
|
||||
if [[ $LOCAL == $REMOTE ]]; then
|
||||
printf "There are no updates.\n"
|
||||
return 0
|
||||
elif [[ $LOCAL == $BASE ]]; then
|
||||
printf "There is an update available. Trying to pull.\n\n"
|
||||
if git pull --ff-only; then
|
||||
printf "Syncing submodules\n"
|
||||
git submodule update --recursive
|
||||
return $?
|
||||
else
|
||||
cannot-fast-forward
|
||||
return 1
|
||||
fi
|
||||
elif [[ $REMOTE == $BASE ]]; then
|
||||
cannot-fast-forward "Commits in master that aren't in upstream."
|
||||
return 1
|
||||
else
|
||||
cannot-fast-forward "Upstream and local have diverged."
|
||||
return 1
|
||||
fi
|
||||
else
|
||||
printf "zprezto install at '%s' is not on the master branch " "${ZPREZTODIR}"
|
||||
printf "(you're on '%s')\nUnable to automatically update.\n" "${orig_branch}"
|
||||
return 1
|
||||
fi
|
||||
return 1
|
||||
)
|
||||
}
|
||||
#
|
||||
# Module Loader
|
||||
#
|
||||
|
||||
# Loads Prezto modules.
|
||||
function pmodload {
|
||||
local -a pmodules
|
||||
local -a pmodule_dirs
|
||||
local -a locations
|
||||
local pmodule
|
||||
local pmodule_location
|
||||
local pfunction_glob='^([_.]*|prompt_*_setup|README*|*~)(-.N:t)'
|
||||
|
||||
# Load in any additional directories and warn if they don't exist
|
||||
zstyle -a ':prezto:load' pmodule-dirs 'user_pmodule_dirs'
|
||||
for user_dir in "$user_pmodule_dirs[@]"; do
|
||||
if [[ ! -d "$user_dir" ]]; then
|
||||
echo "$0: Missing user module dir: $user_dir"
|
||||
fi
|
||||
done
|
||||
|
||||
pmodule_dirs=("$ZPREZTODIR/modules" "$ZPREZTODIR/contrib" "$user_pmodule_dirs[@]")
|
||||
|
||||
# $argv is overridden in the anonymous function.
|
||||
pmodules=("$argv[@]")
|
||||
|
||||
# Load Prezto modules.
|
||||
for pmodule in "$pmodules[@]"; do
|
||||
if zstyle -t ":prezto:module:$pmodule" loaded 'yes' 'no'; then
|
||||
continue
|
||||
else
|
||||
locations=(${pmodule_dirs:+${^pmodule_dirs}/$pmodule(-/FN)})
|
||||
if (( ${#locations} > 1 )); then
|
||||
print "$0: conflicting module locations: $locations"
|
||||
continue
|
||||
elif (( ${#locations} < 1 )); then
|
||||
print "$0: no such module: $pmodule"
|
||||
continue
|
||||
fi
|
||||
|
||||
# Grab the full path to this module
|
||||
pmodule_location=${locations[1]}
|
||||
|
||||
# Add functions to $fpath.
|
||||
fpath=(${pmodule_location}/functions(/FN) $fpath)
|
||||
|
||||
function {
|
||||
local pfunction
|
||||
|
||||
# Extended globbing is needed for listing autoloadable function directories.
|
||||
setopt LOCAL_OPTIONS EXTENDED_GLOB
|
||||
|
||||
# Load Prezto functions.
|
||||
for pfunction in ${pmodule_location}/functions/$~pfunction_glob; do
|
||||
autoload -Uz "$pfunction"
|
||||
done
|
||||
}
|
||||
|
||||
if [[ -s "${pmodule_location}/init.zsh" ]]; then
|
||||
source "${pmodule_location}/init.zsh"
|
||||
elif [[ -s "${pmodule_location}/${pmodule}.plugin.zsh" ]]; then
|
||||
source "${pmodule_location}/${pmodule}.plugin.zsh"
|
||||
fi
|
||||
|
||||
if (( $? == 0 )); then
|
||||
zstyle ":prezto:module:$pmodule" loaded 'yes'
|
||||
else
|
||||
# Remove the $fpath entry.
|
||||
fpath[(r)${pmodule_location}/functions]=()
|
||||
|
||||
function {
|
||||
local pfunction
|
||||
|
||||
# Extended globbing is needed for listing autoloadable function
|
||||
# directories.
|
||||
setopt LOCAL_OPTIONS EXTENDED_GLOB
|
||||
|
||||
# Unload Prezto functions.
|
||||
for pfunction in ${pmodule_location}/functions/$~pfunction_glob; do
|
||||
unfunction "$pfunction"
|
||||
done
|
||||
}
|
||||
|
||||
zstyle ":prezto:module:$pmodule" loaded 'no'
|
||||
fi
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
#
|
||||
# Prezto Initialization
|
||||
#
|
||||
|
||||
# This finds the directory prezto is installed to so plugin managers don't need
|
||||
# to rely on dirty hacks to force prezto into a directory. Additionally, it
|
||||
# needs to be done here because inside the pmodload function ${0:h} evaluates to
|
||||
# the current directory of the shell rather than the prezto dir.
|
||||
ZPREZTODIR=${0:h}
|
||||
|
||||
# Source the Prezto configuration file.
|
||||
if [[ -s "${ZDOTDIR:-$HOME}/.zpreztorc" ]]; then
|
||||
source "${ZDOTDIR:-$HOME}/.zpreztorc"
|
||||
fi
|
||||
|
||||
# Disable color and theme in dumb terminals.
|
||||
if [[ "$TERM" == 'dumb' ]]; then
|
||||
zstyle ':prezto:*:*' color 'no'
|
||||
zstyle ':prezto:module:prompt' theme 'off'
|
||||
fi
|
||||
|
||||
# Load Zsh modules.
|
||||
zstyle -a ':prezto:load' zmodule 'zmodules'
|
||||
for zmodule ("$zmodules[@]") zmodload "zsh/${(z)zmodule}"
|
||||
unset zmodule{s,}
|
||||
|
||||
# Autoload Zsh functions.
|
||||
zstyle -a ':prezto:load' zfunction 'zfunctions'
|
||||
for zfunction ("$zfunctions[@]") autoload -Uz "$zfunction"
|
||||
unset zfunction{s,}
|
||||
|
||||
# Load Prezto modules.
|
||||
zstyle -a ':prezto:load' pmodule 'pmodules'
|
||||
pmodload "$pmodules[@]"
|
||||
unset pmodules
|
||||
@@ -1,206 +0,0 @@
|
||||
Modules
|
||||
=======
|
||||
|
||||
Load modules in *zpreztorc*. The order matters.
|
||||
|
||||
```sh
|
||||
zstyle ':prezto:load' pmodule 'environment' 'terminal'
|
||||
```
|
||||
|
||||
Archive
|
||||
-------
|
||||
|
||||
Provides functions to list and extract archives.
|
||||
|
||||
Autosuggestions
|
||||
---------------
|
||||
|
||||
Integrates zsh-autosuggestions into Prezto.
|
||||
|
||||
Command-Not-Found
|
||||
-----------------
|
||||
|
||||
Loads the command-not-found tool on macOS or Debian-based distributions.
|
||||
|
||||
Completion
|
||||
----------
|
||||
|
||||
Loads and configures tab completion and provides additional completions from
|
||||
the zsh-completions project.
|
||||
|
||||
Directory
|
||||
---------
|
||||
|
||||
Sets directory options and defines directory aliases.
|
||||
|
||||
DNF
|
||||
---
|
||||
|
||||
Defines dnf aliases.
|
||||
|
||||
Dpkg
|
||||
----
|
||||
|
||||
Defines dpkg aliases and functions.
|
||||
|
||||
Editor
|
||||
------
|
||||
|
||||
Sets key bindings.
|
||||
|
||||
Emacs
|
||||
-----
|
||||
|
||||
Enables Emacs dependency management.
|
||||
|
||||
Environment
|
||||
-----------
|
||||
|
||||
Sets general shell options and defines environment variables.
|
||||
|
||||
Fasd
|
||||
----
|
||||
|
||||
Maintains a frequently used file and directory list for fast access.
|
||||
|
||||
Git
|
||||
---
|
||||
|
||||
Enhances the Git distributed version control system by providing aliases,
|
||||
functions and by exposing repository status information to prompts.
|
||||
|
||||
GNU Utility
|
||||
-----------
|
||||
|
||||
Provides for the interactive use of GNU utilities on non-GNU systems.
|
||||
|
||||
GPG
|
||||
---
|
||||
|
||||
Provides for an easier use of GPG by setting up gpg-agent.
|
||||
|
||||
Haskell
|
||||
-------
|
||||
|
||||
Enables local Haskell package installation.
|
||||
|
||||
Helper
|
||||
------
|
||||
|
||||
Provides helper functions for developing modules.
|
||||
|
||||
History
|
||||
-------
|
||||
|
||||
Sets history options and defines history aliases.
|
||||
|
||||
History Substring Search
|
||||
------------------------
|
||||
|
||||
Integrates zsh-history-substring-search into Prezto.
|
||||
|
||||
Homebrew
|
||||
--------
|
||||
|
||||
Defines Homebrew aliases.
|
||||
|
||||
MacPorts
|
||||
--------
|
||||
|
||||
Defines MacPorts aliases and adds MacPorts directories to path variables.
|
||||
|
||||
Node.js
|
||||
-------
|
||||
|
||||
Provides utility functions for Node.js and loads npm completion.
|
||||
|
||||
OCaml
|
||||
-----
|
||||
|
||||
Initializes OCaml package management.
|
||||
|
||||
OSX
|
||||
---
|
||||
|
||||
Defines macOS aliases and functions.
|
||||
|
||||
Pacman
|
||||
------
|
||||
|
||||
Provides aliases and functions for the Pacman package manager and frontends.
|
||||
|
||||
Perl
|
||||
----
|
||||
|
||||
Enables local Perl module installation on macOS and defines alises.
|
||||
|
||||
Prompt
|
||||
------
|
||||
|
||||
Loads prompt themes.
|
||||
|
||||
Python
|
||||
------
|
||||
|
||||
Enables local Python and local Python package installation.
|
||||
|
||||
Ruby on Rails
|
||||
-------------
|
||||
|
||||
Defines Ruby on Rails aliases.
|
||||
|
||||
Rsync
|
||||
-----
|
||||
|
||||
Defines rsync aliases.
|
||||
|
||||
Ruby
|
||||
----
|
||||
|
||||
Configures Ruby local gem installation, loads version managers, and defines
|
||||
aliases.
|
||||
|
||||
GNU Screen
|
||||
----------
|
||||
|
||||
Defines GNU Screen aliases and provides for auto launching it at start-up.
|
||||
|
||||
Spectrum
|
||||
--------
|
||||
|
||||
Provides for easier use of 256 colors and effects.
|
||||
|
||||
SSH
|
||||
---
|
||||
|
||||
Provides for an easier use of SSH by setting up ssh-agent.
|
||||
|
||||
Syntax Highlighting
|
||||
-------------------
|
||||
|
||||
Integrates zsh-syntax-highlighting into Prezto.
|
||||
|
||||
Terminal
|
||||
--------
|
||||
|
||||
Sets terminal window and tab titles.
|
||||
|
||||
Tmux
|
||||
----
|
||||
|
||||
Defines tmux aliases and provides for auto launching it at start-up.
|
||||
|
||||
Utility
|
||||
-------
|
||||
|
||||
Defines general aliases and functions.
|
||||
|
||||
Wake-on-LAN
|
||||
-----------
|
||||
|
||||
This module provides a wrapper around the wakeonlan tool.
|
||||
|
||||
Yum
|
||||
---
|
||||
|
||||
Defines yum aliases.
|
||||
@@ -1,52 +0,0 @@
|
||||
Archive
|
||||
=======
|
||||
|
||||
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.
|
||||
|
||||
Supported Formats
|
||||
-----------------
|
||||
|
||||
The following archive formats are supported when the required utilities are
|
||||
installed:
|
||||
|
||||
- *.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`.
|
||||
- *.gz* requires `gunzip`.
|
||||
- *.bz2* requires `bunzip2`.
|
||||
- *.xz* requires `unxz`.
|
||||
- *.lzma* requires `unlzma`.
|
||||
- *.Z* requires `uncompress`.
|
||||
- *.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://theunarchiver.com/command-line
|
||||
@@ -1,13 +0,0 @@
|
||||
#compdef lsarchive
|
||||
#autoload
|
||||
|
||||
#
|
||||
# Completes lsarchive.
|
||||
#
|
||||
# Authors:
|
||||
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
||||
#
|
||||
|
||||
_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|jar|rar|7z)(-.)'" && return 0
|
||||
@@ -1,13 +0,0 @@
|
||||
#compdef unarchive
|
||||
#autoload
|
||||
|
||||
#
|
||||
# Completes unarchive.
|
||||
#
|
||||
# Authors:
|
||||
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
||||
#
|
||||
|
||||
_arguments \
|
||||
'(-r --remove)'{-r,--remove}'[remove archive]' \
|
||||
"*::archive file:_files -g '(#i)*.(tar|tgz|tbz|tbz2|txz|tlz|gz|bz2|xz|lzma|Z|zip|jar|rar|7z|deb)(-.)'" && return 0
|
||||
@@ -1,71 +0,0 @@
|
||||
#!/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
|
||||
|
||||
# }
|
||||
@@ -1,61 +0,0 @@
|
||||
#
|
||||
# Lists the contents of archives.
|
||||
#
|
||||
# Authors:
|
||||
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
||||
#
|
||||
|
||||
# function lsarchive {
|
||||
|
||||
local verbose
|
||||
|
||||
if (( $# == 0 )); then
|
||||
cat >&2 <<EOF
|
||||
usage: $0 [-option] [file ...]
|
||||
|
||||
options:
|
||||
-v, --verbose verbose archive listing
|
||||
|
||||
Report bugs to <sorin.ionescu@gmail.com>.
|
||||
EOF
|
||||
fi
|
||||
|
||||
if [[ "$1" == "-v" || "$1" == "--verbose" ]]; then
|
||||
verbose=0
|
||||
shift
|
||||
fi
|
||||
|
||||
while (( $# > 0 )); do
|
||||
if [[ ! -s "$1" ]]; then
|
||||
print "$0: file not valid: $1" >&2
|
||||
shift
|
||||
continue
|
||||
fi
|
||||
|
||||
case "$1:l" in
|
||||
(*.tar.gz|*.tgz) tar t${verbose:+v}vzf "$1" ;;
|
||||
(*.tar.bz2|*.tbz|*.tbz2) tar t${verbose:+v}jf "$1" ;;
|
||||
(*.tar.xz|*.txz) tar --xz --help &> /dev/null \
|
||||
&& tar --xz -t${verbose:+v}f "$1" \
|
||||
|| xzcat "$1" | tar t${verbose:+v}f - ;;
|
||||
(*.tar.zma|*.tlz) tar --lzma --help &> /dev/null \
|
||||
&& tar --lzma -t${verbose:+v}f "$1" \
|
||||
|| lzcat "$1" | tar x${verbose:+v}f - ;;
|
||||
(*.tar) tar t${verbose:+v}f "$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
|
||||
success=1
|
||||
;;
|
||||
esac
|
||||
|
||||
shift
|
||||
done
|
||||
|
||||
# }
|
||||
@@ -1,86 +0,0 @@
|
||||
#
|
||||
# Extracts the contents of archives.
|
||||
#
|
||||
# Authors:
|
||||
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
||||
#
|
||||
|
||||
# function unarchive {
|
||||
|
||||
local remove_archive
|
||||
local success
|
||||
local file_name
|
||||
local file_path
|
||||
local extract_dir
|
||||
|
||||
if (( $# == 0 )); then
|
||||
cat >&2 <<EOF
|
||||
usage: $0 [-option] [file ...]
|
||||
|
||||
options:
|
||||
-r, --remove remove archive
|
||||
|
||||
Report bugs to <sorin.ionescu@gmail.com>.
|
||||
EOF
|
||||
fi
|
||||
|
||||
remove_archive=1
|
||||
if [[ "$1" == "-r" || "$1" == "--remove" ]]; then
|
||||
remove_archive=0
|
||||
shift
|
||||
fi
|
||||
|
||||
while (( $# > 0 )); do
|
||||
if [[ ! -s "$1" ]]; then
|
||||
print "$0: file not valid: $1" >&2
|
||||
shift
|
||||
continue
|
||||
fi
|
||||
|
||||
success=0
|
||||
file_name="${1:t}"
|
||||
file_path="${1:A}"
|
||||
extract_dir="${file_name:r}"
|
||||
case "$1:l" in
|
||||
(*.tar.gz|*.tgz) tar xvzf "$1" ;;
|
||||
(*.tar.bz2|*.tbz|*.tbz2) tar xvjf "$1" ;;
|
||||
(*.tar.xz|*.txz) tar --xz --help &> /dev/null \
|
||||
&& tar --xz -xvf "$1" \
|
||||
|| xzcat "$1" | tar xvf - ;;
|
||||
(*.tar.zma|*.tlz) tar --lzma --help &> /dev/null \
|
||||
&& tar --lzma -xvf "$1" \
|
||||
|| lzcat "$1" | tar xvf - ;;
|
||||
(*.tar) tar xvf "$1" ;;
|
||||
(*.gz) gunzip "$1" ;;
|
||||
(*.bz2) bunzip2 "$1" ;;
|
||||
(*.xz) unxz "$1" ;;
|
||||
(*.lzma) unlzma "$1" ;;
|
||||
(*.Z) uncompress "$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"
|
||||
mkdir -p "$extract_dir/data"
|
||||
cd "$extract_dir"; ar vx "${file_path}" > /dev/null
|
||||
cd control; tar xvf ../control.tar.*
|
||||
cd ../data; tar xvf ../data.tar.*
|
||||
cd ..; rm control.tar.* data.tar.* debian-binary
|
||||
cd ..
|
||||
;;
|
||||
(*)
|
||||
print "$0: cannot extract: $1" >&2
|
||||
success=1
|
||||
;;
|
||||
esac
|
||||
|
||||
(( success = $success > 0 ? $success : $? ))
|
||||
(( $success == 0 )) && (( $remove_archive == 0 )) && rm "$1"
|
||||
shift
|
||||
done
|
||||
|
||||
# }
|
||||
@@ -1,61 +0,0 @@
|
||||
Autosuggestions
|
||||
===============
|
||||
|
||||
Integrates [zsh-autosuggestions][1] into Prezto, which implements the
|
||||
[Fish shell][2]'s autosuggestions feature, where the user can type in any part
|
||||
of a previously entered command and Zsh suggests commands as you type based on
|
||||
history and completions.
|
||||
|
||||
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 conjunction with the *history-substring-search*
|
||||
module, this module must be loaded **after** the *history-substring-search*
|
||||
module.
|
||||
|
||||
Contributors
|
||||
------------
|
||||
|
||||
New features and bug fixes should be submitted to the [zsh-autosuggestions][1]
|
||||
project according to its rules and regulations. This module will be synchronized
|
||||
against it.
|
||||
|
||||
Settings
|
||||
--------
|
||||
|
||||
### Highlighting
|
||||
|
||||
If colors are enabled, *autosuggestions* will automatically highlight
|
||||
positive results.
|
||||
|
||||
To enable highlighting for this module only, add the following line to
|
||||
*zpreztorc*:
|
||||
|
||||
```sh
|
||||
zstyle ':prezto:module:autosuggestions' color 'yes'
|
||||
```
|
||||
|
||||
To set the query found color, add the following line to *zpreztorc*:
|
||||
|
||||
```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
|
||||
-------
|
||||
|
||||
*The authors of this module should be contacted via the [issue tracker][3].*
|
||||
|
||||
- [Sorin Ionescu](https://github.com/sorin-ionescu)
|
||||
|
||||
[1]: https://github.com/tarruda/zsh-autosuggestions
|
||||
[2]: http://fishshell.com
|
||||
[3]: https://github.com/sorin-ionescu/prezto/issues
|
||||
@@ -1,69 +0,0 @@
|
||||
# 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.
|
||||
@@ -1 +0,0 @@
|
||||
Fish-like fast/unobtrusive autosuggestions for zsh.
|
||||
@@ -1,5 +0,0 @@
|
||||
source 'https://rubygems.org'
|
||||
|
||||
gem 'rspec'
|
||||
gem 'rspec-wait'
|
||||
gem 'pry-byebug'
|
||||
@@ -1,41 +0,0 @@
|
||||
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
|
||||
@@ -1,67 +0,0 @@
|
||||
## 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.
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
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.
|
||||
@@ -1,36 +0,0 @@
|
||||
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)
|
||||
146
.zprezto/modules/autosuggestions/external/README.md
vendored
146
.zprezto/modules/autosuggestions/external/README.md
vendored
@@ -1,146 +0,0 @@
|
||||
# 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
|
||||
|
||||
[](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.
|
||||
@@ -1 +0,0 @@
|
||||
https://github.com/zsh-users/zsh-autosuggestions
|
||||
@@ -1 +0,0 @@
|
||||
v0.4.3
|
||||
@@ -1,12 +0,0 @@
|
||||
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
|
||||
@@ -1,41 +0,0 @@
|
||||
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
|
||||
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
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
|
||||
@@ -1,10 +0,0 @@
|
||||
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
|
||||
@@ -1,13 +0,0 @@
|
||||
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
|
||||
@@ -1,67 +0,0 @@
|
||||
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
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
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
|
||||
@@ -1,24 +0,0 @@
|
||||
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
|
||||
@@ -1,23 +0,0 @@
|
||||
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
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
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
|
||||
@@ -1,19 +0,0 @@
|
||||
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
|
||||
@@ -1,30 +0,0 @@
|
||||
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
|
||||
@@ -1,7 +0,0 @@
|
||||
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
|
||||
@@ -1,7 +0,0 @@
|
||||
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
|
||||
@@ -1,20 +0,0 @@
|
||||
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
|
||||
@@ -1,7 +0,0 @@
|
||||
describe 'suggestion fetching' do
|
||||
it 'is performed synchronously'
|
||||
|
||||
context 'when ZSH_AUTOSUGGEST_USE_ASYNC is set' do
|
||||
it 'is performed asynchronously'
|
||||
end
|
||||
end
|
||||
@@ -1,97 +0,0 @@
|
||||
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
|
||||
@@ -1,50 +0,0 @@
|
||||
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
|
||||
@@ -1,12 +0,0 @@
|
||||
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
|
||||
@@ -1,21 +0,0 @@
|
||||
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
|
||||
@@ -1,62 +0,0 @@
|
||||
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
|
||||
@@ -1,95 +0,0 @@
|
||||
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
|
||||
@@ -1,19 +0,0 @@
|
||||
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
|
||||
@@ -1,42 +0,0 @@
|
||||
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
|
||||
@@ -1,24 +0,0 @@
|
||||
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
|
||||
@@ -1,26 +0,0 @@
|
||||
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
|
||||
@@ -1,106 +0,0 @@
|
||||
|
||||
#--------------------------------------------------------------------#
|
||||
# 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
|
||||
}
|
||||
@@ -1,118 +0,0 @@
|
||||
|
||||
#--------------------------------------------------------------------#
|
||||
# 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
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
|
||||
#--------------------------------------------------------------------#
|
||||
# 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
|
||||
@@ -1,19 +0,0 @@
|
||||
|
||||
#--------------------------------------------------------------------#
|
||||
# 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
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
|
||||
#--------------------------------------------------------------------#
|
||||
# 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
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
|
||||
#--------------------------------------------------------------------#
|
||||
# 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
|
||||
@@ -1,24 +0,0 @@
|
||||
|
||||
#--------------------------------------------------------------------#
|
||||
# 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
|
||||
@@ -1,25 +0,0 @@
|
||||
|
||||
#--------------------------------------------------------------------#
|
||||
# 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}*]}"
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
|
||||
#--------------------------------------------------------------------#
|
||||
# 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]"
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
|
||||
#--------------------------------------------------------------------#
|
||||
# Utility Functions #
|
||||
#--------------------------------------------------------------------#
|
||||
|
||||
_zsh_autosuggest_escape_command() {
|
||||
setopt localoptions EXTENDED_GLOB
|
||||
|
||||
# Escape special chars in the string (requires EXTENDED_GLOB)
|
||||
echo -E "${1//(#m)[\"\'\\()\[\]|*?~]/\\$MATCH}"
|
||||
}
|
||||
@@ -1,213 +0,0 @@
|
||||
|
||||
#--------------------------------------------------------------------#
|
||||
# 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
|
||||
@@ -1 +0,0 @@
|
||||
source ${0:A:h}/zsh-autosuggestions.zsh
|
||||
@@ -1,708 +0,0 @@
|
||||
# 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
|
||||
@@ -1,35 +0,0 @@
|
||||
#
|
||||
# Integrates zsh-autosuggestions into Prezto.
|
||||
#
|
||||
# Authors:
|
||||
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
||||
#
|
||||
|
||||
# Load dependencies.
|
||||
pmodload 'editor'
|
||||
|
||||
# Source module files.
|
||||
source "${0:h}/external/zsh-autosuggestions.zsh" || return 1
|
||||
|
||||
#
|
||||
# Highlighting
|
||||
#
|
||||
|
||||
# Set highlight color, default 'fg=8'.
|
||||
zstyle -s ':prezto:module:autosuggestions:color' found \
|
||||
'ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE' || ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=8'
|
||||
|
||||
# Disable highlighting.
|
||||
if ! zstyle -t ':prezto:module:autosuggestions' color; then
|
||||
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE=''
|
||||
fi
|
||||
|
||||
#
|
||||
# Key Bindings
|
||||
#
|
||||
|
||||
if [[ -n "$key_info" ]]; then
|
||||
# vi
|
||||
bindkey -M viins "$key_info[Control]F" vi-forward-word
|
||||
bindkey -M viins "$key_info[Control]E" vi-add-eol
|
||||
fi
|
||||
@@ -1,24 +0,0 @@
|
||||
Command-Not-Found
|
||||
=================
|
||||
|
||||
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 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][3] to tap the `command-not-found` homebrew repository.
|
||||
|
||||
|
||||
Authors
|
||||
-------
|
||||
|
||||
*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/Homebrew/homebrew-command-not-found
|
||||
[3]: https://github.com/Homebrew/homebrew-command-not-found#install
|
||||
[4]: https://github.com/sorin-ionescu/prezto/issues
|
||||
@@ -1,21 +0,0 @@
|
||||
#
|
||||
# Displays installation information for not found commands.
|
||||
#
|
||||
# Authors:
|
||||
# Joseph Jon Booker <joe@neoturbine.net>
|
||||
# Indrajit Raychaudhuri <irc+code@indrajit.com>
|
||||
#
|
||||
|
||||
# Load command-not-found on Debian-based distributions.
|
||||
if [[ -s '/etc/zsh_command_not_found' ]]; then
|
||||
source '/etc/zsh_command_not_found'
|
||||
# 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
|
||||
fi
|
||||
@@ -1,53 +0,0 @@
|
||||
Completion
|
||||
==========
|
||||
|
||||
Loads and configures tab completion and provides additional completions from
|
||||
the [zsh-completions][1] project.
|
||||
|
||||
This module must be loaded **after** the *utility* module.
|
||||
|
||||
Options
|
||||
-------
|
||||
|
||||
- `COMPLETE_IN_WORD` complete from both ends of a word.
|
||||
- `ALWAYS_TO_END` move cursor to the end of a completed word.
|
||||
- `PATH_DIRS` perform path search even on command names with slashes.
|
||||
- `AUTO_MENU` show completion menu on a successive tab press.
|
||||
- `AUTO_LIST` automatically list choices on ambiguous completion.
|
||||
- `AUTO_PARAM_SLASH` if completed parameter is a directory, add a trailing slash.
|
||||
- `EXTENDED_GLOB` needed for file modification glob modifiers with compinit.
|
||||
- `MENU_COMPLETE` do not autoselect the first completion entry.
|
||||
- `FLOW_CONTROL` disable start/stop characters in shell editor.
|
||||
|
||||
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
|
||||
------------
|
||||
|
||||
Completions should be submitted to the [zsh-completions][1] project according
|
||||
to its rules and regulations. This module will be synchronized against it.
|
||||
|
||||
Authors
|
||||
-------
|
||||
|
||||
*The authors of this module should be contacted via the [issue tracker][2].*
|
||||
|
||||
- [Sorin Ionescu](https://github.com/sorin-ionescu)
|
||||
|
||||
[1]: https://github.com/zsh-users/zsh-completions
|
||||
[2]: https://github.com/sorin-ionescu/prezto/issues
|
||||
@@ -1,39 +0,0 @@
|
||||
# Contributing
|
||||
|
||||
## How to Contribute to zsh-completions
|
||||
|
||||
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's completion, ask before.
|
||||
* Partially implemented completions are not accepted.
|
||||
* 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)).
|
||||
* Any reasonable open source licence is acceptable but note that we recommend the use of the Zsh license and that you should use it if you hope for the function to migrate to zsh itself.
|
||||
* Please try to follow the [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.
|
||||
|
||||
## Contributing Completion Functions to Zsh
|
||||
|
||||
The zsh project itself welcomes completion function contributions via
|
||||
[github pull requests](https://github.com/zsh-users/zsh/),
|
||||
[gitlab merge requests](https://gitlab.com/zsh-org/zsh/) or via patch
|
||||
files sent to its mailing list, `zsh-workers@zsh.org`.
|
||||
|
||||
Contributing to zsh has the advantage of reaching the most users.
|
||||
|
||||
## Including Completion Functions in Upstream Projects
|
||||
|
||||
Many upstream projects include zsh completions.
|
||||
|
||||
If well maintained, this has the advantage that users get a completion
|
||||
function that matches the installed version of their software.
|
||||
|
||||
If you are the upstream maintainer this is a good choice. If the project
|
||||
already includes completions for bash, fish, tcsh, etc then they are
|
||||
likely open to including zsh's too. It can also be a good option for
|
||||
completions handling commands that are system or distribution specific.
|
||||
|
||||
Ideally, arrange for the project's build system to install the
|
||||
completion function in `$prefix/share/zsh/site-functions`.
|
||||
25
.zprezto/modules/completion/external/LICENSE
vendored
25
.zprezto/modules/completion/external/LICENSE
vendored
@@ -1,25 +0,0 @@
|
||||
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.
|
||||
65
.zprezto/modules/completion/external/README.md
vendored
65
.zprezto/modules/completion/external/README.md
vendored
@@ -1,65 +0,0 @@
|
||||
zsh-completions   [](irc://irc.freenode.net/#zsh-completions) [](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 may be contributed to the Zsh project when stable enough.*
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
### Using packages
|
||||
|
||||
| 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 / Manjaro / Antergos / Hyperbola | [zsh-completions](https://www.archlinux.org/packages/zsh-completions), [zsh-completions-git](https://aur.archlinux.org/packages/zsh-completions-git) |
|
||||
| Gentoo / Funtoo | [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/zsh-completions/default.nix) |
|
||||
| Void Linux | [zsh-completions](https://github.com/void-linux/void-packages/blob/master/srcpkgs/zsh-completions/template) |
|
||||
| Slackware | [Slackbuilds](https://slackbuilds.org/repository/14.2/system/zsh-completions) |
|
||||
| Mac OS | [homebrew](https://github.com/Homebrew/homebrew-core/blob/master/Formula/zsh-completions.rb), [MacPorts](https://github.com/macports/macports-ports/blob/master/sysutils/zsh-completions/Portfile) |
|
||||
| NetBSD | [pkgsrc](ftp://ftp.netbsd.org/pub/pkgsrc/current/pkgsrc/shells/zsh-completions/README.html) |
|
||||
|
||||
|
||||
### Using zsh frameworks
|
||||
|
||||
#### [antigen](https://github.com/zsh-users/antigen)
|
||||
|
||||
Add `antigen bundle zsh-users/zsh-completions` to your `~/.zshrc`.
|
||||
|
||||
#### [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:
|
||||
|
||||
git clone git://github.com/zsh-users/zsh-completions.git
|
||||
|
||||
* Include the directory in your `$fpath`, for example by adding in `~/.zshrc`:
|
||||
|
||||
fpath=(path/to/zsh-completions/src $fpath)
|
||||
|
||||
* You may have to force rebuild `zcompdump`:
|
||||
|
||||
rm -f ~/.zcompdump; compinit
|
||||
|
||||
### Contributing
|
||||
|
||||
Contributions are welcome, see [CONTRIBUTING](https://github.com/zsh-users/zsh-completions/blob/master/CONTRIBUTING.md).
|
||||
|
||||
|
||||
## License
|
||||
Completions use the Zsh license, unless explicitly mentioned in the file header.
|
||||
See [LICENSE](https://github.com/zsh-users/zsh-completions/blob/master/LICENSE) for more information.
|
||||
212
.zprezto/modules/completion/external/src/_ack
vendored
212
.zprezto/modules/completion/external/src/_ack
vendored
@@ -1,212 +0,0 @@
|
||||
#compdef ack ack2 ack-grep ack-standalone
|
||||
# ------------------------------------------------------------------------------
|
||||
# Description
|
||||
# -----------
|
||||
#
|
||||
# Completion script for ack 1.96 and 2.14 (http://betterthangrep.com).
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
# Authors
|
||||
# -------
|
||||
#
|
||||
# * Julien Nicoulaud <julien.nicoulaud@gmail.com> (version 1.94)
|
||||
# * Zhao Cai <caizhaoff@gmail.com> (version 2.04)
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
_ack_version() {
|
||||
local version
|
||||
version=(${(f)"$(_call_program version $words[1] --version)"})
|
||||
version=${${(z)${version[1]}}[2]}
|
||||
echo $version
|
||||
}
|
||||
|
||||
_ack() {
|
||||
local context curcontext="$curcontext" state line cmds update_policy ret=1
|
||||
integer NORMARG
|
||||
typeset -A opt_args
|
||||
|
||||
# Don't complete if command doesn't exist
|
||||
[[ ${+commands[${words[1]}]} -eq 0 ]] && return 0
|
||||
|
||||
zstyle -s ":completion:${curcontext}:" cache-policy update_policy
|
||||
[[ -z "$update_policy" ]] && zstyle ":completion:${curcontext}:" cache-policy _ack_types_caching_policy
|
||||
|
||||
unset _ack_raw_types
|
||||
if ( [[ ${+_ack_raw_types} -eq 0 ]] || _cache_invalid "ack-grep" ) && ! _retrieve_cache "ack-grep"; then
|
||||
_ack_raw_types=(${(S)${(S)${(f)${${"$(_call_program types $words[1] --help=types)"}#*--\[no\]}}%; first line matches \/*\/}#*no\]})
|
||||
[[ $#_ack_raw_types -gt 0 ]] && _store_cache "ack-grep" _ack_raw_types
|
||||
fi
|
||||
|
||||
ack_20_options=(
|
||||
'--ackrc[specify an ackrc file to use]:files:_files'
|
||||
'(- 1 *)--bar[consult Admiral Ackbar]'
|
||||
'(--nobreak --break)'{--nobreak,--break}'[print a break between results from different files, default on]'
|
||||
'(- 1 *)--cathy[chocolate chocolate chocolate]'
|
||||
'(- 1 *)--create-ackrc[create custom ackrc files based on the default settings loaded by ackrc]'
|
||||
'(- 1 *)--dump[writes the list of options loaded and where they came from to standard output]'
|
||||
'(--files-from -x)--files-from=[read the list of files to search from FILE]:files:_files'
|
||||
'(--filter --nofilter)--filter[force ack to treat input as pipe]'
|
||||
'(--filter --nofilter)--nofilter[force ack to treat input as tty]'
|
||||
'(--noheading --heading)'{--noheading,--heading}'[print a filename heading above results, default on]'
|
||||
'(- 1 *)--help-types[display all known types]'
|
||||
'--ignore-ack-defaults[ignore default definitions included with ack]'
|
||||
'*--ignore-file=[ignore file]:ignore file filter: _describe "ignore file filter" ignore_filter_opts'
|
||||
'(-k --known-types)'{-k,--known-types}'[include only files of types that ack recognizes]'
|
||||
'--lines=[only print line(s) NUM of each file]:number'
|
||||
'--nopager[do not send output through a pager, overrides ackrc, ACK_PAGER & ACK_PAGER_COLOR]'
|
||||
'-s[suppress error messages about nonexistent or unreadable files]'
|
||||
'(- 1 *)--thpppt[bill the cat]'
|
||||
'*--type-del[remove all filters associated with TYPE]' \
|
||||
'(-x --files-from)-x[read the list of files to search from STDIN]'
|
||||
)
|
||||
|
||||
ack_19_options=(
|
||||
'(-a --all -u --unrestricted)'{-a,--all}'[operate on all files, regardless of type (but still skip directories like blib, CVS, etc.)]'
|
||||
'-G+[only paths matching the given regex are included in the search]:regex'
|
||||
'--invert-file-match[print/search handle files that do not match -g/-G]'
|
||||
'--line=[only print given line of each file]:number' \
|
||||
'(-u --unrestricted -a --all)'{-u,--unrestricted}'[all files and directories (including blib/, core.*, ...) are searched, nothing is skipped]'
|
||||
)
|
||||
|
||||
if (( $(_ack_version) > 2.0 )); then
|
||||
ack_version_options=(${ack_20_options})
|
||||
else
|
||||
ack_version_options=(${ack_19_options})
|
||||
fi
|
||||
|
||||
_arguments -C -s -S -n \
|
||||
'(- 1 *)--version[display version and copyright information]' \
|
||||
'(- 1 *)--help[print a short help statement]' \
|
||||
'(- 1 *)--man[print the manual page]' \
|
||||
$ack_version_options \
|
||||
'(-A --after-context -C --context)'{-A+,--after-context=}'[print N lines of trailing context after matching lines]:number' \
|
||||
'(-B --before-context -C --context)'{-B+,--before-context=}'[print N lines of leading context before matching lines]:number' \
|
||||
'(-C --context -A --after-context -B --before-context)'{-C-,--context=}'[print N lines (default 2) of context around matching lines]:number' \
|
||||
'(-c --count)'{-c,--count}'[suppress normal output; instead print a count of matching lines for each input file]' \
|
||||
'(--nocolor)--color[highlight the matching text]' \
|
||||
'(--color --color-filename --color-match --color-lineno)--nocolor[suppress the color]' \
|
||||
'(--nocolor --color)--color-filename[sets the color to be used for filenames]:color:->colors' \
|
||||
'(--nocolor --color)--color-match[sets the color to be used for matches]:color:->colors' \
|
||||
'(--nocolor --color)--color-lineno[sets the color to be used for line numbers]:color:->colors' \
|
||||
'--column[show the column number of the first match]' \
|
||||
'(--noenv)--env[enable environment processing]' \
|
||||
'(--env)--noenv[disable all environment processing, no .ackrc is read and all environment variables are ignored]' \
|
||||
'--flush[flush output immediately]' \
|
||||
'-f[only print the files that would be searched, without actually doing any searching]' \
|
||||
'(--nofollow)--follow[follow symlinks]' \
|
||||
'(--follow)--nofollow[don'\''t follow symlinks]' \
|
||||
'-g+[print files where the relative path + filename matches the given regex]:regex' \
|
||||
'(--nogroup)--group[group matches by file name]' \
|
||||
'(--group)--nogroup[do not group matches by file name]' \
|
||||
'(-H --with-filename -h --no-filename)'{-H,--with-filename}'[print the filename for each match]' \
|
||||
'(-h --no-filename -H --with-filename)'{-h,--no-filename}'[suppress the prefixing of filenames on output when multiple files are searched]' \
|
||||
'(-i --ignore-case)'{-i,--ignore-case}'[ignore case in the search strings]' \
|
||||
'*--ignore-dir=[ignore directory]:directory:_files' \
|
||||
'*--noignore-dir=[ignore directory]:directory:_files' \
|
||||
'(-l --files-with-matches -L --files-without-matches)'{-l,--files-with-matches}'[only print the filenames of matching files, instead of the matching text]' \
|
||||
'(-L --files-without-matches -l --files-with-matches)'{-L,--files-without-matches}'[only print the filenames of files that do NOT match]' \
|
||||
'--match=[specify the regular expression explicitly]:regex' \
|
||||
'(-m --max-count)'{-m+,--max-count=}'[stop reading a file after N matches]:number' \
|
||||
'(-r -R --recurse -n --no-recurse)'{-r,-R,--recurse}'[recurse into sub-directories]' \
|
||||
'(-n --no-recurse -r -R --recurse)'{-n,--no-recurse}'[no descending into subdirectories]' \
|
||||
'-o[show only the part of each line matching PATTERN (turns off text highlighting)]:pattern' \
|
||||
'--output=[output the evaluation of expr for each line (turns off text highlighting)]:expression' \
|
||||
'--pager=[direct ack'\''s output through program]:pager program:_command_names' \
|
||||
'--passthru[prints all lines, whether or not they match the expression]' \
|
||||
'--print0[the filenames are output separated with a null byte instead of the usual newline]' \
|
||||
'(-Q --literal)'{-Q,--literal}'[quote all metacharacters in the pattern, it is treated as a literal]' \
|
||||
'(--no-smart-case)--smart-case[ignore case in the search strings if pattern contains no uppercase characters]' \
|
||||
'(--smart-case)--no-smart-case[disable --smart-case option]' \
|
||||
'--sort-files[sorts the found files lexically]' \
|
||||
'--show-types[outputs the filetypes that ack associates with each file]' \
|
||||
'--thpppt[display the all-important Bill The Cat logo]' \
|
||||
'*--type=[specify the types of files to include or exclude from a search]:type:->types' \
|
||||
'*--type-add[files with the given extensions are recognized as being of the given type]:type-def:->type-defs' \
|
||||
'*--type-set[files with the given extensions are recognized as being of the given type]:type-def:->type-defs' \
|
||||
'(-v --invert-match)'{-v,--invert-match}'[invert match: select non-matching lines]' \
|
||||
'(-w --word-regexp)'{-w,--word-regexp}'[force the given pattern to match only whole words]' \
|
||||
'-1[stops after reporting first match of any kind]' \
|
||||
{'--','--no'}${_ack_raw_types/ ##/\[}']' \
|
||||
'*: :->args' \
|
||||
&& ret=0
|
||||
|
||||
case $state in
|
||||
args)
|
||||
if [[ CURRENT -eq NORMARG && ${+opt_args[--match]} -eq 0 ]]; then
|
||||
# If the current argument is the first non-option argument
|
||||
# and --match isn't present then a pattern is expected
|
||||
_message -e patterns 'pattern' && ret=0
|
||||
else
|
||||
_files
|
||||
fi
|
||||
;;
|
||||
colors)
|
||||
local colors; colors=(
|
||||
'black' 'on_black'
|
||||
'red' 'on_red'
|
||||
'green' 'on_green'
|
||||
'yellow' 'on_yellow'
|
||||
'blue' 'on_blue'
|
||||
'magenta' 'on_magenta'
|
||||
'cyan' 'on_cyan'
|
||||
'white' 'on_white'
|
||||
'clear'
|
||||
'reset'
|
||||
'dark'
|
||||
'bold'
|
||||
'underline'
|
||||
'underscore'
|
||||
'blink'
|
||||
'reverse'
|
||||
'concealed'
|
||||
)
|
||||
_describe -t 'colors' 'color' colors && ret=0
|
||||
;;
|
||||
type-defs)
|
||||
if compset -P '*='; then
|
||||
local extensions; extensions=(*.*(:e))
|
||||
_values -s ',' 'file extension' '.'$extensions && ret=0
|
||||
else
|
||||
_message -e type-name 'type name' && ret=0
|
||||
fi
|
||||
;;
|
||||
types)
|
||||
local types; types=({'','no'}${_ack_raw_types/ ##/:})
|
||||
_describe -t 'types' 'type' types
|
||||
;;
|
||||
esac
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
ignore_filter_opts=(
|
||||
'is\::FILENAME'
|
||||
'ext\::[EXTENSION,EXTENSION2,...]'
|
||||
'match\::PATTERN'
|
||||
'firstlinematch\::PATTERN'
|
||||
)
|
||||
|
||||
_ack_types_caching_policy() {
|
||||
|
||||
# Rebuild if ackrc more recent than cache.
|
||||
[[ -f ${ACKRC:-$HOME/.ackrc} && ${ACKRC:-$HOME/.ackrc} -nt "$1" ]] && return 0
|
||||
|
||||
# Rebuild if cache is older than one week.
|
||||
local -a oldp
|
||||
oldp=( "$1"(Nmw+1) )
|
||||
(( $#oldp )) && return 0
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
_ack "$@"
|
||||
|
||||
# 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
|
||||
|
||||
66
.zprezto/modules/completion/external/src/_afew
vendored
66
.zprezto/modules/completion/external/src/_afew
vendored
@@ -1,66 +0,0 @@
|
||||
#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)
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
_arguments \
|
||||
'(- 1 *)-h[display usage information]' \
|
||||
"(-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=}"[specify path to notmuch configuration file]:files:_files" \
|
||||
{-e,--enable-filters=}"[specify filter classes to use]:filter" \
|
||||
{-d,--dry-run}"[don't change the DB]" \
|
||||
{-R,--reference-set-size=}"[specify size of the reference set]:size [1000]" \
|
||||
{-T,--reference-set-timeframe-days=}"[don't use emails older than specified age]:age (days) [30]" \
|
||||
{--verbose,-v}"[be more verbose]" \
|
||||
'*: :_guard "^-*" query'
|
||||
|
||||
# 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
|
||||
308
.zprezto/modules/completion/external/src/_android
vendored
308
.zprezto/modules/completion/external/src/_android
vendored
@@ -1,308 +0,0 @@
|
||||
#compdef android
|
||||
# ------------------------------------------------------------------------------
|
||||
# Description
|
||||
# -----------
|
||||
#
|
||||
# Completion script for the android command (Revision 12)
|
||||
# (http://developer.android.com/guide/developing/tools/android.html).
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
# Authors
|
||||
# -------
|
||||
#
|
||||
# * Julien Nicoulaud <julien.nicoulaud@gmail.com>
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
|
||||
_android() {
|
||||
typeset -A opt_args
|
||||
local context state line curcontext="$curcontext"
|
||||
|
||||
local ret=1
|
||||
|
||||
_arguments -C -A "-*" \
|
||||
'(- : *)'{-h,--help}'[get help on a specific command]:command:_android_cmds' \
|
||||
'(-s --silent -v --verbose)'{-v,--verbose}'[verbose mode: errors, warnings and informational messages are printed]' \
|
||||
'(-v --verbose -s --silent)'{-s,--silent}'[silent mode: only errors are printed out]' \
|
||||
'1: :_android_cmds' \
|
||||
'*::arg:->args' \
|
||||
&& ret=0
|
||||
|
||||
case "$state" in
|
||||
(args)
|
||||
curcontext="${curcontext%:*:*}:android-cmd-$words[1]:"
|
||||
case $words[1] in
|
||||
(list)
|
||||
_arguments -C \
|
||||
'1: :_android_list_entities' \
|
||||
'*::list-arg:->list-args' \
|
||||
&& ret=0
|
||||
case "$state" in
|
||||
(list-args)
|
||||
case $words[1] in
|
||||
(avd|target)
|
||||
_arguments \
|
||||
'(-0 --null)'{-0,--null}'[terminate lines with \0 instead of \n (e.g. for xargs -0)]' \
|
||||
'(-c --compact)'{-c,--compact}'[compact output (suitable for scripts)]' \
|
||||
&& ret=0
|
||||
;;
|
||||
(sdk)
|
||||
_arguments \
|
||||
'(-o --obsolete)'{-o,--obsolete}'[install obsolete packages]' \
|
||||
'--proxy-host[HTTP/HTTPS proxy host (overrides settings if defined)]:proxy host:_hosts' \
|
||||
'--proxy-port[HTTP/HTTPS proxy port (overrides settings if defined)]:proxy port number' \
|
||||
'(-s --no-https)'{-s,--no-https}'[use HTTP instead of HTTPS (the default) for downloads]' \
|
||||
'(-u --no-ui)'{-u,--no-ui}'[display list result on console (no GUI)]' \
|
||||
&& ret=0
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
(create)
|
||||
_arguments -C \
|
||||
'1: :_android_create_entities' \
|
||||
'*::create-arg:->create-args' \
|
||||
&& ret=0
|
||||
case "$state" in
|
||||
(create-args)
|
||||
case $words[1] in
|
||||
(avd)
|
||||
_arguments \
|
||||
'(-c --sdcard)'{-c,--sdcard}'[path to a shared SD card image, or size of a new sdcard for the new AVD]:SD card image or size:_files -g "*.img"' \
|
||||
'(-n --name)'{-n,--name}'[name of the new AVD]:name' \
|
||||
'(-a --snapshot)'{-a,--snapshot}'[place a snapshots file in the AVD, to enable persistence]' \
|
||||
'(-p --path)'{-p,--path}'[directory where the new AVD will be created]: :_files -/' \
|
||||
'(-f --force)'{-f,--force}'[forces creation (overwrites an existing AVD)]' \
|
||||
'(-s --skin)'{-s,--skin}'[skin for the new AVD]:skin' \
|
||||
'(-t --target)'{-t,--target}'[target ID of the new AVD]: :_android_targets' \
|
||||
&& ret=0
|
||||
;;
|
||||
(project)
|
||||
_arguments \
|
||||
'(-n --name)'{-n,--name}'[project name]:project name' \
|
||||
'(-p --path)'{-p,--path}'[the new project'\''s directory]: :_files -/' \
|
||||
'(-k --package)'{-k,--package}'[Android package name for the application]:package name' \
|
||||
'(-a --activity)'{-a,--activity}'[name of the default Activity that is created]:activity name' \
|
||||
'(-t --target)'{-t,--target}'[target ID of the new project]: :_android_targets' \
|
||||
&& ret=0
|
||||
;;
|
||||
(test-project)
|
||||
_arguments \
|
||||
'(-n --name)'{-n,--name}'[project name]:project name' \
|
||||
'(-p --path)'{-p,--path}'[the new project'\''s directory]: :_files -/' \
|
||||
'(-m --main)'{-m,--main}'[path to directory of the app under test, relative to the test project directory]:path' \
|
||||
&& ret=0
|
||||
;;
|
||||
(lib-project)
|
||||
_arguments \
|
||||
'(-n --name)'{-n,--name}'[project name]:project name' \
|
||||
'(-p --path)'{-p,--path}'[the new project'\''s directory]: :_files -/' \
|
||||
'(-k --package)'{-k,--package}'[Android package name for the application]:package name' \
|
||||
'(-t --target)'{-t,--target}'[target ID of the new project]: :_android_targets' \
|
||||
&& ret=0
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
(update)
|
||||
_arguments -C \
|
||||
'1: :_android_update_entities' \
|
||||
'*::update-arg:->update-args' \
|
||||
&& ret=0
|
||||
case "$state" in
|
||||
(update-args)
|
||||
case $words[1] in
|
||||
(avd)
|
||||
_arguments \
|
||||
'(-n --name)'{-n,--name}'[name of the AVD to update]: :_android_avd_names' \
|
||||
&& ret=0
|
||||
;;
|
||||
(project)
|
||||
_arguments \
|
||||
'(-l --library)'{-l,--library}'[directory of an Android library to add, relative to this project'\''s directory]: :_files -/' \
|
||||
'(-p --path)'{-p,--path}'[the project'\''s directory]: :_files -/' \
|
||||
'(-n --name)'{-n,--name}'[project name]:name' \
|
||||
'(-t --target)'{-t,--target}'[target ID to set for the project]: :_android_targets' \
|
||||
'(-s --subprojects)'{-s,--subprojects}'[also updates any projects in sub-folders, such as test projects]' \
|
||||
&& ret=0
|
||||
;;
|
||||
(test-project)
|
||||
_arguments \
|
||||
'(-p --path)'{-p,--path}'[the project'\''s directory]: :_files -/' \
|
||||
'(-m --main)'{-m,--main}'[directory of the app under test, relative to the test project directory]:path' \
|
||||
&& ret=0
|
||||
;;
|
||||
(lib-project)
|
||||
_arguments \
|
||||
'(-p --path)'{-p,--path}'[the project'\''s directory]: :_files -/' \
|
||||
'(-t --target)'{-t,--target}'[target ID to set for the project]: :_android_targets' \
|
||||
&& ret=0
|
||||
;;
|
||||
(sdk)
|
||||
_arguments \
|
||||
'(-o --obsolete)'{-o,--obsolete}'[install obsolete packages]' \
|
||||
'--proxy-host[HTTP/HTTPS proxy host (overrides settings if defined)]:proxy host:_hosts' \
|
||||
'--proxy-port[HTTP/HTTPS proxy port (overrides settings if defined)]:proxy port number' \
|
||||
'(-s --no-https)'{-s,--no-https}'[use HTTP instead of HTTPS (the default) for downloads]' \
|
||||
'(-u --no-ui)'{-u,--no-ui}'[update from command-line (no GUI)]' \
|
||||
'(-f --force)'{-f,--force}'[force replacement of a package or its parts, even if something has been modified]' \
|
||||
'(-t --filter)'{-t,--filter}'[a filter that limits the update to the specified types of packages]: :_android_sdk_update_filters -s ,' \
|
||||
'(-n --dry-mode)'{-n,--dry-mode}'[simulate the update but does not download or install anything]' \
|
||||
&& ret=0
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
(move)
|
||||
_arguments -C \
|
||||
'1: :_android_move_entities' \
|
||||
'*::move-arg:->move-args' \
|
||||
&& ret=0
|
||||
case "$state" in
|
||||
(move-args)
|
||||
case $words[1] in
|
||||
(avd)
|
||||
_arguments \
|
||||
'(-n --name)'{-n,--name}'[name of the AVD to move or rename]: :_android_avd_names' \
|
||||
'(-p --path)'{-p,--path}'[path to the AVD'\''s new directory]: :_files -/' \
|
||||
'(-r --rename)'{-r,--rename}'[new name of the AVD]:name' \
|
||||
&& ret=0
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
(delete)
|
||||
_arguments -C \
|
||||
'1: :_android_delete_entities' \
|
||||
'*::delete-arg:->delete-args' \
|
||||
&& ret=0
|
||||
case "$state" in
|
||||
(delete-args)
|
||||
case $words[1] in
|
||||
(avd)
|
||||
_arguments \
|
||||
'(-n --name)'{-n,--name}'[name of the AVD to delete]: :_android_avd_names' \
|
||||
&& ret=0
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
(display)
|
||||
_arguments \
|
||||
'1: :_android_display_entities' \
|
||||
&& ret=0
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
(( $+functions[_android_cmds] )) ||
|
||||
_android_cmds() {
|
||||
local commands; commands=(
|
||||
'list:list existing targets or virtual devices'
|
||||
'create:create new virtual devices or projects'
|
||||
'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 "$@"
|
||||
}
|
||||
|
||||
(( $+functions[_android_list_entities] )) ||
|
||||
_android_list_entities() {
|
||||
local entities; entities=(
|
||||
'avd:list existing Android Virtual Devices'
|
||||
'target:list existing targets'
|
||||
'sdk:list remote SDK repository'
|
||||
)
|
||||
_describe -t entities 'entity' entities "$@"
|
||||
}
|
||||
|
||||
(( $+functions[_android_create_entities] )) ||
|
||||
_android_create_entities() {
|
||||
local entities; entities=(
|
||||
'avd:create a new Android Virtual Device'
|
||||
'project:create a new Android project'
|
||||
'test-project:create a new Android project for a test package'
|
||||
'lib-project:create a new Android library project'
|
||||
)
|
||||
_describe -t entities 'entity' entities "$@"
|
||||
}
|
||||
|
||||
(( $+functions[_android_update_entities] )) ||
|
||||
_android_update_entities() {
|
||||
local entities; entities=(
|
||||
'avd:update an Android Virtual Device to match the folders of a new SDK'
|
||||
'project:update an Android project'
|
||||
'test-project:update the Android project for a test package'
|
||||
'lib-project:update an Android library project'
|
||||
'adb:update adb to support the USB devices declared in the SDK add-ons'
|
||||
'sdk:update the SDK by suggesting new platforms to install if available'
|
||||
)
|
||||
_describe -t entities 'entity' entities "$@"
|
||||
}
|
||||
|
||||
(( $+functions[_android_move_entities] )) ||
|
||||
_android_move_entities() {
|
||||
local entities; entities=(
|
||||
'avd:move or rename an Android Virtual Device'
|
||||
)
|
||||
_describe -t entities 'entity' commands "$@"
|
||||
}
|
||||
|
||||
(( $+functions[_android_delete_entities] )) ||
|
||||
_android_delete_entities() {
|
||||
local entities; entities=(
|
||||
'avd:delete an Android Virtual Device'
|
||||
)
|
||||
_describe -t entities 'entity' entities "$@"
|
||||
}
|
||||
|
||||
(( $+functions[_android_display_entities] )) ||
|
||||
_android_display_entities() {
|
||||
local entities; entities=(
|
||||
'sdk:display the SDK Manager window'
|
||||
'avd:display the AVD Manager window'
|
||||
)
|
||||
_describe -t entities 'entity' entities "$@"
|
||||
}
|
||||
|
||||
(( $+functions[_android_targets] )) ||
|
||||
_android_targets() {
|
||||
local targets; targets=(${(f)"$(_call_program targets $service list target --compact)"//:/\\:})
|
||||
_describe -t targets 'target' targets "$@"
|
||||
}
|
||||
|
||||
(( $+functions[_android_avd_names] )) ||
|
||||
_android_avd_names() {
|
||||
local avd_names; avd_names=(${(f)"$(_call_program targets $service list avd --compact)"//:/\\:})
|
||||
_describe -t avd-names 'AVD name' avd_names "$@"
|
||||
}
|
||||
|
||||
(( $+functions[_android_sdk_update_filters] )) ||
|
||||
_android_sdk_update_filters() {
|
||||
local filters; filters=(platform tool platform-tool doc sample extra)
|
||||
_values $@ 'filter' "${filters[@]}"
|
||||
}
|
||||
|
||||
_android "$@"
|
||||
|
||||
# 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
|
||||
709
.zprezto/modules/completion/external/src/_ansible
vendored
709
.zprezto/modules/completion/external/src/_ansible
vendored
@@ -1,709 +0,0 @@
|
||||
#compdef ansible
|
||||
# ------------------------------------------------------------------------------
|
||||
# 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 ansible v2.0.0.2 (http://ansible.org)
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
# Authors
|
||||
# -------
|
||||
#
|
||||
# * Romain Bossart (https://github.com/bosr)
|
||||
# * Adam Stevko (https://github.com/xen0l)
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
#
|
||||
# Needs either ANSIBLE_HOSTS or /etc/ansible/hosts on linux
|
||||
# (or /usr/local/etc/ansible/hosts on macOS)
|
||||
#
|
||||
# Note 1: the following gist (https://gist.github.com/15ed54a438a36d67fd99.git)
|
||||
# has some files to help improve the hostfile shell parsing
|
||||
#
|
||||
# Note 2: I tried to use `_arguments --`, but the output of `ansible --help`
|
||||
# is not parsed entirely correctly, and anyway no modules or host would available.
|
||||
#
|
||||
|
||||
|
||||
# ansible zsh completion
|
||||
#
|
||||
|
||||
__host_file_location () {
|
||||
# find the location of the host file:
|
||||
# 1. check $ANSIBLE_HOSTS
|
||||
# 2. else check /etc/ansible/hosts or /usr/local/etc/...
|
||||
# (depending on platform)
|
||||
#
|
||||
[[ "$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}
|
||||
}
|
||||
|
||||
__ll_group_list () {
|
||||
# parses the ini hostfile for groups only: [...]
|
||||
HOST_FILE=$(__host_file_location)
|
||||
|
||||
local -a group_list
|
||||
group_list=$(command \
|
||||
cat ${HOST_FILE} \
|
||||
| awk '$1 ~ /^\[.*\]$/ && !/=/ && !/:vars/ \
|
||||
{ gsub(/[\[\]]/, "", $1); gsub(/:children/, "", $1) ; print $1 }' \
|
||||
| uniq )
|
||||
|
||||
echo ${group_list}
|
||||
}
|
||||
|
||||
|
||||
__host_list ()
|
||||
{
|
||||
# parses the ini hostfile for hosts only
|
||||
# but then has to remove all group occurrences
|
||||
HOST_FILE=$(__host_file_location)
|
||||
|
||||
# this will also contain groups if they are referenced in other groups
|
||||
local -a mixed_host_list
|
||||
mixed_host_list=$(command \
|
||||
cat ${HOST_FILE} \
|
||||
| awk 'NF && $1 !~ /^[[:space:]]*#|[\[:=]/ { print $1 }' \
|
||||
| sort | uniq)
|
||||
|
||||
# compute set difference h1 - h2
|
||||
local -a h1 h2 host_list
|
||||
h1=${mixed_host_list}
|
||||
h2=$(__ll_group_list)
|
||||
host_list=($(command \
|
||||
sort <(echo $h1) <(echo $h2) <(echo $h2) \
|
||||
| uniq -u \
|
||||
| paste -s -d ' ' - )
|
||||
)
|
||||
|
||||
_wanted application expl 'hosts' compadd ${host_list}
|
||||
|
||||
# method that delegates to ansible (slow)
|
||||
# _wanted application expl 'hosts' compadd $(command ansible \
|
||||
# all --list-hosts\
|
||||
# 2>/dev/null)
|
||||
}
|
||||
|
||||
__group_list ()
|
||||
{
|
||||
gl=($(command echo $(__ll_group_list) | paste -s -d ' ' - )) # 'a\nb\nc' -> (a b c)
|
||||
_wanted application2 expl 'groups' compadd $gl
|
||||
}
|
||||
|
||||
|
||||
_modules=(
|
||||
'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: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'
|
||||
'apt_rpm:apt_rpm package manager'
|
||||
'assemble:Assembles a configuration file from fragments'
|
||||
'assert:Fail with custom message'
|
||||
'async_status:Obtain status of asynchronous task'
|
||||
'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: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: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:Manages Perl library dependencies.'
|
||||
'cron:Manage cron.d and crontab entries.'
|
||||
'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: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: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_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'
|
||||
'ec2_vpc_dhcp_options:Manages DHCP Options, and can ensure the DHCP options for the given VPC match what’s 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.'
|
||||
'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: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: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:a wrapper to the unix getent utility'
|
||||
'git:Deploy software (or files) from git checkouts'
|
||||
'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: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: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'
|
||||
'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: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:Publish a message on an MQTT topic for the IoT'
|
||||
'mysql_db:Add or remove MySQL databases from a remote host.'
|
||||
'mysql_replication:Manage MySQL replication'
|
||||
'mysql_user:Adds or removes a user from a MySQL database.'
|
||||
'mysql_variables:Manage MySQL global variables'
|
||||
'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 VM’s'
|
||||
'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 macOS user defaults from Ansible'
|
||||
'osx_say:Makes a macOS computer 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'
|
||||
'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: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 FreeBSD’s ports system'
|
||||
'postgresql_db:Add or remove PostgreSQL databases from a remote host.'
|
||||
'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.'
|
||||
'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 subnet’s 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'
|
||||
'rax_cbs_attachments:Manipulate Rackspace Cloud Block Storage Volume Attachments'
|
||||
'rax_cdb:create/delete or resize a Rackspace Cloud Databases instance'
|
||||
'rax_cdb_database:create / delete a database in the Cloud Databases'
|
||||
'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'
|
||||
'rax_files:Manipulate Rackspace Cloud Files Containers'
|
||||
'rax_files_objects:Upload, download, and delete objects in Rackspace Cloud Files'
|
||||
'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'
|
||||
'rax_scaling_policy:Manipulate Rackspace Cloud Autoscale Scaling Policy'
|
||||
'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 ``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 ``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: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:Send Slack notifications'
|
||||
'slackpkg:Package manager for Slackware >= 12.2'
|
||||
'slurp:Slurps a file from remote nodes'
|
||||
'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: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: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:Urpmi manager'
|
||||
'user:Manage user accounts'
|
||||
'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.'
|
||||
'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_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'
|
||||
'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'
|
||||
)
|
||||
|
||||
|
||||
_ansible ()
|
||||
{
|
||||
local curcontext="$curcontext" state line
|
||||
typeset -A opt_args
|
||||
|
||||
_arguments -s -C -W \
|
||||
'1:pattern:->pattern'\
|
||||
"(-a --args)"{-a,--args}"[ARGS module arguments]:arguments:(ARG)"\
|
||||
'--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}"[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,--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]'\
|
||||
"(-m --module-name)"{-m,--module-name}"[MODULE_NAME module name (default=command)]:module name:->module"\
|
||||
"*"{-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'\
|
||||
'--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})"\
|
||||
"*--vault-password-file[VAULT_PASSWORD_FILE vault password file]:vault password file:_files"\
|
||||
"*"{-v,--verbose}"[verbose mode (-vvv for more, -vvvv to enable connection debugging)]"\
|
||||
"--version[show program's version number and exit]"\
|
||||
|
||||
case $state in
|
||||
pattern)
|
||||
_arguments '*:feature:__host_list'
|
||||
_arguments '*:feature:__group_list'
|
||||
;;
|
||||
module)
|
||||
_describe -t commands "modules" _modules
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
_ansible "$@"
|
||||
|
||||
# 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
|
||||
@@ -1,183 +0,0 @@
|
||||
#compdef ansible-galaxy
|
||||
# ------------------------------------------------------------------------------
|
||||
# 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 ansible-galaxy v2.0.0.2 (http://ansible.org)
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
# Authors
|
||||
# -------
|
||||
#
|
||||
# * Romain Bossart (https://github.com/bosr)
|
||||
# * Adam Stevko (https://github.com/xen0l)
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
#
|
||||
# Note: I tried to use `_arguments --`, but the output of `ansible --help`
|
||||
# is not parsed entirely correctly, and anyway no modules or host would available.
|
||||
#
|
||||
|
||||
# ansible-galaxy zsh completion
|
||||
#
|
||||
_ansible-galaxy ()
|
||||
{
|
||||
local context curcontext="$curcontext" state line
|
||||
typeset -A opt_args
|
||||
|
||||
_arguments -C \
|
||||
"1:command:(delete import info init install list login remove search setup)" \
|
||||
"*::option:->option"
|
||||
|
||||
case $state in
|
||||
option)
|
||||
case $line[1] in
|
||||
delete)
|
||||
_arguments \
|
||||
"(-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]" \
|
||||
":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}"[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)" \
|
||||
"(-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
|
||||
}
|
||||
|
||||
_ansible-galaxy "$@"
|
||||
|
||||
# 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
|
||||
@@ -1,191 +0,0 @@
|
||||
#compdef ansible-playbook
|
||||
# ------------------------------------------------------------------------------
|
||||
# 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 ansible-playbook v2.0.0.2 (http://ansible.org)
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
# Authors
|
||||
# -------
|
||||
#
|
||||
# * Romain Bossart (https://github.com/bosr)
|
||||
# * Adam Stevko (https://github.com/xen0l)
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
#
|
||||
# Needs either ANSIBLE_HOSTS or /etc/ansible/hosts on linux
|
||||
# (or /usr/local/etc/ansible/hosts on macOS)
|
||||
#
|
||||
# Note 1: the following gist (https://gist.github.com/15ed54a438a36d67fd99.git)
|
||||
# has some files to help improve the hostfile shell parsing
|
||||
#
|
||||
# Note 2: I tried to use `_arguments --`, but the output of `ansible --help`
|
||||
# is not parsed entirely correctly, and anyway no modules or host would available.
|
||||
#
|
||||
|
||||
# ansible-playbook zsh completion
|
||||
#
|
||||
__host_file_location () {
|
||||
# find the location of the host file:
|
||||
# 1. check $ANSIBLE_HOSTS
|
||||
# 2. else check /etc/ansible/hosts or /usr/local/etc/...
|
||||
# (depending on platform)
|
||||
#
|
||||
|
||||
[[ "$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}
|
||||
}
|
||||
|
||||
__ll_group_list () {
|
||||
# parses the ini hostfile for groups only: [...]
|
||||
HOST_FILE=$(__host_file_location)
|
||||
|
||||
local -a group_list
|
||||
group_list=$(command \
|
||||
cat ${HOST_FILE} \
|
||||
| awk '$1 ~ /^\[.*\]$/ && !/=/ && !/:vars/ \
|
||||
{ gsub(/[\[\]]/, "", $1); gsub(/:children/, "", $1) ; print $1 }' \
|
||||
| uniq )
|
||||
|
||||
echo ${group_list}
|
||||
}
|
||||
|
||||
|
||||
__host_list ()
|
||||
{
|
||||
# parses the ini hostfile for hosts only
|
||||
# but then has to remove all group occurrences
|
||||
HOST_FILE=$(__host_file_location)
|
||||
|
||||
# this will also contain groups if they are referenced in other groups
|
||||
local -a mixed_host_list
|
||||
mixed_host_list=$(command \
|
||||
cat ${HOST_FILE} \
|
||||
| awk 'NF && $1 !~ /[\[:=]/ { print $1 }' \
|
||||
| sort | uniq)
|
||||
|
||||
# compute set difference h1 - h2
|
||||
local -a h1 h2 host_list
|
||||
h1=${mixed_host_list}
|
||||
h2=$(__ll_group_list)
|
||||
host_list=($(command \
|
||||
sort <(echo $h1) <(echo $h2) <(echo $h2) \
|
||||
| uniq -u \
|
||||
| paste -s -d ' ' - )
|
||||
)
|
||||
|
||||
_wanted application expl 'hosts' compadd ${host_list}
|
||||
|
||||
# method that delegates to ansible (slow)
|
||||
# _wanted application expl 'hosts' compadd $(command ansible \
|
||||
# all --list-hosts\
|
||||
# 2>/dev/null)
|
||||
}
|
||||
|
||||
__group_list ()
|
||||
{
|
||||
gl=($(command echo $(__ll_group_list) | paste -s -d ' ' - )) # 'a\nb\nc' -> (a b c)
|
||||
_wanted application2 expl 'groups' compadd $gl
|
||||
}
|
||||
|
||||
|
||||
|
||||
_ansible-playbook ()
|
||||
{
|
||||
local curcontext="$curcontext" state line
|
||||
typeset -A opt_args
|
||||
|
||||
_arguments -s -C -W \
|
||||
"*: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)]"\
|
||||
"*"{-e,--extra-vars}"[EXTRA_VARS set additional variables as key=value or YAML/JSON]:extra vars:(EXTRA_VARS)"\
|
||||
'--flush-cache[clear the fact cache]'\
|
||||
'--force-handlers[run handlers even if a task fails]'\
|
||||
"(-f --forks)"{-f,--forks}"[FORKS number of parallel processes to use (default=5)]:forks:(5)"\
|
||||
"(-h --help)"{-h,--help}"[help message]"\
|
||||
"*"{-i,--inventory,--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}"[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'\
|
||||
'--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 (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}"[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)"\
|
||||
"(-u --user)"{-u,--user}"[REMOTE_USER connect as this user (default=${USER})]:connect as user:(${USER})"\
|
||||
"*--vault-password-file[VAULT_PASSWORD_FILE vault password file]:vault password file:_files"\
|
||||
"*"{-v,--verbose}"[verbose mode (-vvv for more, -vvvv to enable connection debugging)]"\
|
||||
"--version[show program's version number and exit]"\
|
||||
|
||||
case $state in
|
||||
pattern)
|
||||
_arguments '*:feature:__host_list'
|
||||
_arguments '*:feature:__group_list'
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
_ansible-playbook "$@"
|
||||
|
||||
# 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
|
||||
@@ -1,94 +0,0 @@
|
||||
#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
|
||||
@@ -1,85 +0,0 @@
|
||||
#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
|
||||
@@ -1,63 +0,0 @@
|
||||
#compdef artisan
|
||||
# ------------------------------------------------------------------------------
|
||||
# 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 artisan (http://laravel.com/docs/artisan).
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
# Authors
|
||||
# -------
|
||||
#
|
||||
# * loranger (https://github.com/loranger)
|
||||
# * Yohan Tambè (https://github.com/Cronos87)
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
|
||||
_artisan_get_command_list () {
|
||||
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
|
||||
local -a commands
|
||||
IFS=$'\n'
|
||||
commands=(`_artisan_get_command_list`)
|
||||
_describe 'commands' commands
|
||||
fi
|
||||
}
|
||||
|
||||
compdef _artisan php artisan
|
||||
compdef _artisan artisan
|
||||
71
.zprezto/modules/completion/external/src/_atach
vendored
71
.zprezto/modules/completion/external/src/_atach
vendored
@@ -1,71 +0,0 @@
|
||||
#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
|
||||
# -----------
|
||||
#
|
||||
# Completion script for atach (https://github.com/sorin-ionescu/atach).
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
# Authors
|
||||
# -------
|
||||
#
|
||||
# * Sorin Ionescu <sorin.ionescu@gmail.com>
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
local state mode_values existing_sessions ret=1
|
||||
|
||||
mode_values=(
|
||||
"none:disable redrawing"
|
||||
"ctrl_l:use ctrl + l to redraw"
|
||||
"winch:use sigwinch to redraw"
|
||||
)
|
||||
|
||||
existing_sessions=($(_call_program session atach))
|
||||
|
||||
_arguments -C -s -S \
|
||||
'(--list -l)'{--list,-l}'[list sessions]' \
|
||||
'(--sockets -L)'{--sockets,-L}'[list sockets]' \
|
||||
'(--session -s)'{--session=,-s+}'[set the session name]:session' \
|
||||
'(--char -c)'{--char=,-c+}'[set the detach character (default: ^\\)]:char' \
|
||||
'(--redraw -r)'{--redraw=,-r+}'[set the redraw method (none, ctrl_l, or winch)]:mode:->mode' \
|
||||
'(--detached -d)'{--detached,-d}'[start the session detached]' \
|
||||
'(--no-detach -D)'{--no-detach,-D}'[disable detaching]' \
|
||||
'(--no-suspend -Z)'{--no-suspend,-Z}'[disable suspending]' \
|
||||
'(--version -v)'{--version,-v}'[display version and copyright]' \
|
||||
'(--help -h)'{--help,-h}'[display help]' \
|
||||
'(-)::args:->session-or-command' && ret=0
|
||||
|
||||
case "$state" in
|
||||
(mode)
|
||||
_describe -t mode 'redraw mode' mode_values && ret=0
|
||||
;;
|
||||
(session-or-command)
|
||||
_describe -t 'session' 'sessions' existing_sessions && ret=0
|
||||
_path_commands && ret=0
|
||||
;;
|
||||
esac
|
||||
|
||||
return $ret
|
||||
|
||||
@@ -1,182 +0,0 @@
|
||||
#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
|
||||
163
.zprezto/modules/completion/external/src/_bower
vendored
163
.zprezto/modules/completion/external/src/_bower
vendored
@@ -1,163 +0,0 @@
|
||||
#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
|
||||
# -----------
|
||||
#
|
||||
# Completion script for Bower (http://bower.io).
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
# Authors
|
||||
# -------
|
||||
#
|
||||
# * Joe Lencioni (https://github.com/lencioni)
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
|
||||
local curcontext="$curcontext" state line _opts ret=1
|
||||
|
||||
_arguments -C \
|
||||
'(- 1 *)'{-v,--version}'[display version information]' \
|
||||
'1: :->cmds' \
|
||||
'*:: :->args' && ret=0
|
||||
|
||||
case $state in
|
||||
cmds)
|
||||
_values "bower command" \
|
||||
"cache[manage bower cache]" \
|
||||
"help[display help information about Bower]" \
|
||||
"home[opens a package homepage into your favorite browser]" \
|
||||
"info[info of a particular package]" \
|
||||
"init[interactively create a bower.json file]" \
|
||||
"install[install a package locally]" \
|
||||
"link[symlink a package folder]" \
|
||||
"list[list local packages - and possible updates]" \
|
||||
"login[authenticate with GitHub and store credentials]" \
|
||||
"lookup[look up a package URL by name]" \
|
||||
"prune[removes local extraneous packages]" \
|
||||
"register[register a package]" \
|
||||
"search[search for a package by name]" \
|
||||
"update[update a local package]" \
|
||||
"uninstall[remove a local package]" \
|
||||
"unregister[remove a package from the registry]" \
|
||||
"version[bump a package version]" && ret=0
|
||||
_arguments \
|
||||
'(--force)--force[make various commands more forceful]' \
|
||||
'(--json)--json[output consumable JSON]' \
|
||||
'(--log-level)--log-level[what level of logs to report]' \
|
||||
"(--offline)--offline[don't hit the network]" \
|
||||
'(--quiet)--quiet[only output important information]' \
|
||||
"(--silent)--silent[don't output anything, besides errors]" \
|
||||
'(--verbose)--verbose[make output more verbose]' \
|
||||
'(--allow-root)--allow-root[allow running commands as root]' \
|
||||
'(--version)--version[output Bower version]' \
|
||||
'(--no-color)--no-color[disable colors]' && ret=0
|
||||
;;
|
||||
args)
|
||||
case $line[1] in
|
||||
help)
|
||||
_values 'commands' \
|
||||
'cache' \
|
||||
'home' \
|
||||
'info' \
|
||||
'init' \
|
||||
'install' \
|
||||
'link' \
|
||||
'list' \
|
||||
'login' \
|
||||
'lookup' \
|
||||
'prune' \
|
||||
'register' \
|
||||
'search' \
|
||||
'update' \
|
||||
'uninstall' \
|
||||
'unregister' \
|
||||
'version' && ret=0
|
||||
;;
|
||||
(home|info|init|link|lookup|prune|register|search|unregister)
|
||||
_arguments \
|
||||
'(--help)--help[show help message]' && ret=0
|
||||
;;
|
||||
install)
|
||||
_arguments \
|
||||
'(--force-latest)--force-latest[force latest version on conflict]' \
|
||||
'(--help)--help[show help message]' \
|
||||
"(--production)--production[don't install project devDependencies]" \
|
||||
"(--save)--save[save installed packages into the project's bower.json dependencies]" \
|
||||
"(--save-dev)--save-dev[save installed packages into the project's bower.json devDependencies]" && ret=0
|
||||
;;
|
||||
list)
|
||||
_arguments \
|
||||
'(--help)--help[show help message]' \
|
||||
'(--paths)--paths[generate a simple JSON source mapping]' \
|
||||
'(--relative)--relative[make paths relative to the directory config property, which defaults to bower_components]' && ret=0
|
||||
;;
|
||||
login)
|
||||
_arguments \
|
||||
'(--help)--help[show help message]' \
|
||||
'(-t --token)'{-t,--token}'[Pass GitHub auth token (will not prompt for username/password)]' && ret=0
|
||||
;;
|
||||
uninstall)
|
||||
_arguments \
|
||||
'(--help)--help[show help message]' \
|
||||
"(--save)--save[save installed packages into the project's bower.json dependencies]" \
|
||||
"(--save-dev)--save-dev[save installed packages into the project's bower.json devDependencies]" && ret=0
|
||||
;;
|
||||
update)
|
||||
_arguments \
|
||||
'(--force-latest)--force-latest[force latest version on conflict]' \
|
||||
'(--help)--help[show help message]' \
|
||||
"(--production)--production[don't install project devDependencies]" && ret=0
|
||||
;;
|
||||
version)
|
||||
_arguments \
|
||||
'(--message)--message[custom git commit and tag message]' && ret=0
|
||||
;;
|
||||
exec)
|
||||
_normal && ret=0
|
||||
;;
|
||||
*)
|
||||
_opts=( $(bower help $line[1] | sed -e '/^ \[-/!d; s/^ \[\(-[^=]*\)=.*/\1/') )
|
||||
_opts+=( $(bower help $line[1] | sed -e '/^ -/!d; s/^ \(-.\), \[\(-[^=]*\)=.*/\1 \2/') )
|
||||
if [[ $_opts != "" ]]; then
|
||||
_values 'option' $_opts && ret=0
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
|
||||
return ret
|
||||
|
||||
# Local Variables:
|
||||
# mode: Shell-Script
|
||||
# sh-indentation: 2
|
||||
# indent-tabs-mode: nil
|
||||
# sh-basic-offset: 2
|
||||
# End:
|
||||
# vim: ft=zsh sw=2 ts=2 et
|
||||
129
.zprezto/modules/completion/external/src/_bundle
vendored
129
.zprezto/modules/completion/external/src/_bundle
vendored
@@ -1,129 +0,0 @@
|
||||
#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
|
||||
# -----------
|
||||
#
|
||||
# Completion script for Bundler (http://gembundler.com).
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
# Authors
|
||||
# -------
|
||||
#
|
||||
# * Bruno Michel (https://github.com/nono)
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
|
||||
local curcontext="$curcontext" state line _gems _opts ret=1
|
||||
|
||||
_arguments -C -A "-v" -A "--version" \
|
||||
'(- 1 *)'{-v,--version}'[display version information]' \
|
||||
'1: :->cmds' \
|
||||
'*:: :->args' && ret=0
|
||||
|
||||
case $state in
|
||||
cmds)
|
||||
_values "bundle command" \
|
||||
"install[Install the gems specified by the Gemfile or Gemfile.lock]" \
|
||||
"update[Update dependencies to their latest versions]" \
|
||||
"package[Package the .gem files required by your application]" \
|
||||
"exec[Execute a script in the context of the current bundle]" \
|
||||
"config[Specify and read configuration options for bundler]" \
|
||||
"check[Determine whether the requirements for your application are installed]" \
|
||||
"list[Show all of the gems in the current bundle]" \
|
||||
"show[Show the source location of a particular gem in the bundle]" \
|
||||
"console[Start an IRB session in the context of the current bundle]" \
|
||||
"open[Open an installed gem in the editor]" \
|
||||
"viz[Generate a visual representation of your dependencies]" \
|
||||
"init[Generate a simple Gemfile, placed in the current directory]" \
|
||||
"gem[Create a simple gem, suitable for development with bundler]" \
|
||||
"help[Describe available tasks or one specific task]" \
|
||||
"platform[Displays platform compatibility information]" \
|
||||
"outdated[Show all of the outdated gems in the current bundle]"
|
||||
ret=0
|
||||
;;
|
||||
args)
|
||||
case $line[1] in
|
||||
help)
|
||||
_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]' \
|
||||
'(--quiet)--quiet[only output warnings and errors]' \
|
||||
'(--gemfile)--gemfile=-[use the specified gemfile instead of Gemfile]:gemfile' \
|
||||
'(--system)--system[install to the system location]' \
|
||||
'(--deployment)--deployment[install using defaults tuned for deployment environments]' \
|
||||
'(--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' \
|
||||
'(--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)
|
||||
_normal && ret=0
|
||||
;;
|
||||
(open|show)
|
||||
_gems=( $(bundle show 2> /dev/null | sed -e '/^ \*/!d; s/^ \* \([^ ]*\) .*/\1/') )
|
||||
if [[ $_gems != "" ]]; then
|
||||
_values 'gems' $_gems && ret=0
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
_opts=( $(bundle help $line[1] | sed -e '/^ \[-/!d; s/^ \[\(-[^=]*\)=.*/\1/') )
|
||||
_opts+=( $(bundle help $line[1] | sed -e '/^ -/!d; s/^ \(-.\), \[\(-[^=]*\)=.*/\1 \2/') )
|
||||
if [[ $_opts != "" ]]; then
|
||||
_values 'options' $_opts && ret=0
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
|
||||
return ret
|
||||
|
||||
# Local Variables:
|
||||
# mode: Shell-Script
|
||||
# sh-indentation: 2
|
||||
# indent-tabs-mode: nil
|
||||
# sh-basic-offset: 2
|
||||
# End:
|
||||
# vim: ft=zsh sw=2 ts=2 et
|
||||
@@ -1,50 +0,0 @@
|
||||
#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 macOS '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'
|
||||
81
.zprezto/modules/completion/external/src/_cap
vendored
81
.zprezto/modules/completion/external/src/_cap
vendored
@@ -1,81 +0,0 @@
|
||||
#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
|
||||
# -----------
|
||||
#
|
||||
# Completion script for Capistrano (http://capify.org).
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
# Authors
|
||||
# -------
|
||||
#
|
||||
# * Bruno Michel (https://github.com/nono)
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
|
||||
local curcontext="$curcontext" state line cmds ret=1
|
||||
|
||||
_arguments -C \
|
||||
{-d,--debug}'[Prompts before each remote command execution]' \
|
||||
{-e,--explain}'[Displays help (if available) for the task]:task' \
|
||||
{-F,--default-config}'[Always use default config, even with -f]' \
|
||||
{-f,--file}'[A recipe file to load. May be given more than once]:file:_files' \
|
||||
{-H,--long-help}'[Explain these options and environment variables]' \
|
||||
{-h,--help}'[Display this help message]' \
|
||||
{-l,--logger}'[Choose logger method. STDERR used by default]:file:_files' \
|
||||
{-n,--dry-run}'[Prints out commands without running them]' \
|
||||
{-p,--password}'[Immediately prompt for the password]' \
|
||||
{-q,--quiet}'[Make the output as quiet as possible]' \
|
||||
{-r,--preserve-roles}'[Preserve task roles]' \
|
||||
{-S,--set-before}'[Set a variable before the recipes are loaded]:variable' \
|
||||
{-s,--set}'[Set a variable after the recipes are loaded]:variable' \
|
||||
{-T,--tasks}'[List all tasks (matching optional PATTERN) in the loaded recipe files]:pattern' \
|
||||
{-t,--tool}'[Abbreviates the output of -T for tool integration]' \
|
||||
{-V,--version}'[Display the Capistrano version, and exit]' \
|
||||
{-v,--verbose}'[Be more verbose. May be given more than once]' \
|
||||
{-X,--skip-system-config}'[Do not load the system config file (capistrano.conf)]' \
|
||||
{-x,--skip-user-config}'[Do not load the user config file (.caprc)]' \
|
||||
'*: :->cmds' && ret=0
|
||||
|
||||
case $state in
|
||||
cmds)
|
||||
cmds=( ${(f)"$(_call_program commands cap -T 2> /dev/null | sed -e '/ # /!d; s/:/\\:/g; s/cap \([A-Za-z0-9\\:_-]*\) .*# /\1:/')"} )
|
||||
_describe -t commands 'cap command' cmds && ret=0
|
||||
;;
|
||||
esac
|
||||
|
||||
return ret
|
||||
|
||||
# Local Variables:
|
||||
# mode: Shell-Script
|
||||
# sh-indentation: 2
|
||||
# indent-tabs-mode: nil
|
||||
# sh-basic-offset: 2
|
||||
# End:
|
||||
# vim: ft=zsh sw=2 ts=2 et
|
||||
89
.zprezto/modules/completion/external/src/_cask
vendored
89
.zprezto/modules/completion/external/src/_cask
vendored
@@ -1,89 +0,0 @@
|
||||
#compdef cask
|
||||
# ------------------------------------------------------------------------------
|
||||
# Copyright (c) 2014 Github zsh-users - http://github.com/zsh-users
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of the zsh-users nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL ZSH-USERS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
# ------------------------------------------------------------------------------
|
||||
# Description
|
||||
# -----------
|
||||
#
|
||||
# Completion script for cask (http://cask.readthedocs.org)
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
# Authors
|
||||
# -------
|
||||
#
|
||||
# * ptrv <mail@petervasil.net>
|
||||
# * Johan Andersson <johan.rejeep@gmail.com>
|
||||
# * Sebastien Duthil <duthils@free.fr>
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
function _cask() {
|
||||
local ret=1 state
|
||||
_arguments \
|
||||
':subcommand:->subcommand' \
|
||||
'*:: :->subcmds' && ret=0
|
||||
|
||||
case $state in
|
||||
subcommand)
|
||||
subcommands=(
|
||||
"build:build all Elisp files in the files directive"
|
||||
"clean-elc:remove all byte compiled Elisp files in the files directive"
|
||||
"exec:execute command with correct 'exec-path' and 'load-path'"
|
||||
"exec-path:print 'exec-path' for all packages and dependencies"
|
||||
"files:print list of files specified in the files directive"
|
||||
"help:display usage information or documentation for specified command"
|
||||
"info:show info about the current package"
|
||||
"init:initialize the current directory with a Cask-file"
|
||||
"install:install all packages specified in the Cask-file"
|
||||
"link:manage links"
|
||||
"list:list dependencies"
|
||||
"load-path:print 'load-path' for all packages and dependencies"
|
||||
"outdated:print list of outdated packages"
|
||||
"package:build package and put in specified directory (default: dist)"
|
||||
"package-directory:print current package installation directory"
|
||||
"path:print 'exec-path' for all packages and dependencies"
|
||||
"pkg-file:write a 'define-package' file"
|
||||
"update:update package version"
|
||||
"upgrade-cask:upgrade Cask itself and its dependencies"
|
||||
"upgrade:upgrade Cask itself and its dependencies"
|
||||
"version:print program version"
|
||||
)
|
||||
_describe -t subcommands 'cask subcommands' subcommands && ret=0
|
||||
esac
|
||||
|
||||
case "$words[1]" in
|
||||
init)
|
||||
_arguments \
|
||||
'(--dev)--dev[Run in dev mode]' && ret=0 ;;
|
||||
exec)
|
||||
_generic
|
||||
;;
|
||||
esac
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
_cask "$@"
|
||||
325
.zprezto/modules/completion/external/src/_ccache
vendored
325
.zprezto/modules/completion/external/src/_ccache
vendored
@@ -1,325 +0,0 @@
|
||||
#compdef ccache -P -value-,CCACHE_*,-default-
|
||||
|
||||
# zsh completion script for ccache
|
||||
|
||||
# Copyright 2018 CERN for the benefit of the LHCb Collaboration.
|
||||
|
||||
# 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 copyright holder 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 THE COPYRIGHT HOLDER OR CONTRIBUTORS 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.
|
||||
#
|
||||
# In applying this licence, CERN does not waive the privileges and immunities
|
||||
# granted to it by virtue of its status as an Intergovernmental Organization
|
||||
# or submit itself to any jurisdiction.
|
||||
|
||||
# allow users to define their better compilers
|
||||
# inspired by _cmake_compilers
|
||||
# users could override with
|
||||
#
|
||||
# _ccache_compilers() {
|
||||
# local -a _ccache_compilers
|
||||
# _ccache_compilers=(gcc g++ clang clang++)
|
||||
# _wanted compilers expl "compiler" compadd -- $_ccache_compilers
|
||||
# }
|
||||
(( $+functions[_ccache_compilers] )) ||
|
||||
_ccache_compilers() {
|
||||
_command_names -e
|
||||
}
|
||||
|
||||
_ccache_booleans() {
|
||||
_message 'There are no "false" values, unset variable to disable'
|
||||
local description; description=${1:-boolean}
|
||||
local booleans; booleans=(
|
||||
'true'
|
||||
'yes'
|
||||
)
|
||||
_describe -t booeans "$description" booleans
|
||||
}
|
||||
|
||||
(( $+functions[_ccache_compressionlevels] )) ||
|
||||
_ccache_compressionlevels() {
|
||||
local -a one_nine
|
||||
one_nine=(1 2 3 4 5 6 7 8 9)
|
||||
_describe -t onetonine "compression level (if using compression)" one_nine
|
||||
}
|
||||
|
||||
(( $+functions[_ccache_sloppiness] )) ||
|
||||
_ccache_sloppiness() {
|
||||
_values -s ',' \
|
||||
"file_macro[ignore __FILE__]" \
|
||||
"file_stat_matches[rely on mtimes and ctimes]" \
|
||||
"include_file_ctime[ignore headers' ctime too new]" \
|
||||
"include_file_mtime[ignore headers' mtime too new]" \
|
||||
"no_system_headers[exclude system headers from cache]" \
|
||||
"pch_defines[be sloppy about #defines in pch]" \
|
||||
"time_macros[ignore __date__ and __time__]"
|
||||
}
|
||||
|
||||
(( $+functions[_ccache_compilerchecks] )) ||
|
||||
_ccache_compilerchecks() {
|
||||
local -a compiler_check_values
|
||||
compiler_check_values=(
|
||||
'content: the actual compiler binary'
|
||||
'mtime: mtime and size of the compiler'
|
||||
'none: ignore compiler for hashing'
|
||||
'string\:: any hard coded string (pre-computed version)'
|
||||
'%compiler%\ -v:any compiler invocation output'
|
||||
)
|
||||
_describe -t compilerchecks "compiler information included in the hash" compiler_check_values
|
||||
}
|
||||
|
||||
(( $+functions[_ccache_dirlevels] )) ||
|
||||
_ccache_dirlevels() {
|
||||
local -a one_eight
|
||||
one_eight=(1 2 3 4 5 6 7 8)
|
||||
_describe -t onetoeight "directory levels in the cache directory" one_eight
|
||||
}
|
||||
|
||||
if [[ "$service" = -value-* ]]; then
|
||||
case $service in
|
||||
*CCACHE_*DIR*)
|
||||
# CCACHE_BASEDIR: relative to which top level paths are hashed
|
||||
# CCACHE_DIR: where the cache and config are kept
|
||||
# CCACHE_TEMPDIR: where temporary files are kept
|
||||
# all: a single path
|
||||
_path_files -/
|
||||
;;
|
||||
*CCACHE_NLEVELS*)
|
||||
_ccache_dirlevels
|
||||
;;
|
||||
*CCACHE_CC*)
|
||||
_ccache_compilers
|
||||
;;
|
||||
*CCACHE_COMPILERCHECK*)
|
||||
_ccache_compilerchecks
|
||||
;;
|
||||
*CCACHE_*COMPRESS*)
|
||||
_ccache_booleans "write compressed cache"
|
||||
;;
|
||||
*CCACHE_COMPRESSLEVEL*)
|
||||
_ccache_compressionlevels
|
||||
;;
|
||||
*CCACHE_EXTENSION*)
|
||||
_alternative ':set extension for intermediate files: '
|
||||
;;
|
||||
*CCACHE_*DIRECT*)
|
||||
_ccache_booleans "use direct mode"
|
||||
;;
|
||||
*CCACHE_*DISABLE*)
|
||||
_ccache_booleans "disable cache usage"
|
||||
;;
|
||||
*CCACHE_EXTRAFILES*)
|
||||
local sep=:
|
||||
compset -P "*${sep}"
|
||||
compset -S "${sep}*" || suf="$sep"
|
||||
|
||||
_files "" -r "${sep}"' /\t\t\-' "$@"
|
||||
;;
|
||||
*CCACHE_*HARDLINK*)
|
||||
_ccache_booleans "create hard links rather than copies"
|
||||
;;
|
||||
*CCACHE_*HASHDIR*)
|
||||
_ccache_booleans "include the cwd in the hash"
|
||||
;;
|
||||
*CCACHE_IGNOREHEADERS*)
|
||||
_dir_list
|
||||
;;
|
||||
*CCACHE_*COMMENTS*)
|
||||
_ccache_booleans "consider comments in hashing"
|
||||
;;
|
||||
*CCACHE_LIMIT_MULTIPLE*)
|
||||
_alternative ":clean up down to level (e.g. 0.8): "
|
||||
;;
|
||||
*CCACHE_LOGFILE*)
|
||||
_path_files -g "*(/) *.log"
|
||||
;;
|
||||
*CCACHE_MAXFILES*)
|
||||
_alternative ":maximum number of files in the cache (0= no limit): "
|
||||
;;
|
||||
*CCACHE_MAXSIZE*)
|
||||
_alternative ':maximum cache size (0= no limit) with suffix k,M,G,T or Ki,Mi,Gi,Ti: '
|
||||
;;
|
||||
*CCACHE_PATH*)
|
||||
_alternative ':PATH for compiler lookup (instead of $PATH):_dir_list'
|
||||
;;
|
||||
*CCACHE_PREFIX*)
|
||||
_alternative ':prefixes for compiler invokation: '
|
||||
;;
|
||||
*CCACHE_PREFIX_CPP*)
|
||||
_alternative ':prefixes for preprocessor invokation: '
|
||||
;;
|
||||
*CCACHE_*READONLY*)
|
||||
_ccache_booleans "treat cache as read-only"
|
||||
;;
|
||||
*CCACHE_*READONLY_DIRECT*)
|
||||
_ccache_booleans "retrieve from read-only cache in direct mode"
|
||||
;;
|
||||
*CCACHE_*RECACHE*)
|
||||
_ccache_booleans "use cache in write-only mode"
|
||||
;;
|
||||
*CCACHE_*CPP2*)
|
||||
_ccache_booleans "pass originial rather than preprocessed source code to compiler"
|
||||
;;
|
||||
*CCACHE_SLOPPINESS*)
|
||||
_ccache_sloppiness
|
||||
;;
|
||||
*CCACHE_*STATS*)
|
||||
_ccache_booleans "update statistics counters"
|
||||
;;
|
||||
*CCACHE_UMASK*)
|
||||
_alternative ":umask value (octal): "
|
||||
;;
|
||||
*CCACHE_*UNIFY*)
|
||||
_ccache_booleans "normalise sources prior to processing"
|
||||
;;
|
||||
esac
|
||||
|
||||
return
|
||||
fi
|
||||
|
||||
__ccache_config_keys() {
|
||||
local -a keys
|
||||
keys=(
|
||||
'compression:write compressed cache'
|
||||
'direct_mode:use direct mode'
|
||||
'disable:disable cache usage'
|
||||
'hard_link:create hard links rather than copies'
|
||||
'hash_dir:include the cwd in the hash'
|
||||
'keep_comments_cpp:consider comments in hashing'
|
||||
'read_only:treat cache as read-only'
|
||||
'read_only_direct:retrieve from read-only cache in direct mode'
|
||||
'recache:use cache in write-only mode'
|
||||
'run_second_cpp:pass originial rather than preprocessed source code to compiler'
|
||||
'stats:update statistics counters'
|
||||
'unify:normalise sources prior to processing'
|
||||
'base_dir:specify relative to which top level paths are hashed'
|
||||
'temporary_dir:specify where temporary files are kept'
|
||||
'cache_dir:specify where the cache is kept'
|
||||
'compiler:specify compiler'
|
||||
'cache_dir_levels:directory levels in the cache directory'
|
||||
'compiler_check:compiler information included in the hash'
|
||||
'compression_level:cache compression level'
|
||||
'cpp_extension:set extensions for intermediate files'
|
||||
'extra_files_to_hash:additional files to consider in hashing'
|
||||
'ignore_headers_in_manifest:set paths to headers to ignore in hashing'
|
||||
'limit_multiple:cleanup level'
|
||||
'log_file:specify a log file'
|
||||
'max_files:maximum number of files in the cache'
|
||||
'max_size:maximum size of the cache'
|
||||
'path:PATH for compiler lookup (instead of $PATH)'
|
||||
'prefix_command:prefixes for compiler invokation'
|
||||
'prefix_command_cpp:prefixes for preprocessor invokation'
|
||||
'sloppiness:hash files sloppy'
|
||||
'umask:set umask for ccache and child processes (e.g. for sharing cache)'
|
||||
)
|
||||
_describe -t configkeys "configuration keys" keys -S '='
|
||||
}
|
||||
|
||||
if compset -P '--set-config=*='; then
|
||||
case $IPREFIX in
|
||||
*=compression= | *=direct_mode= | *=disable= | *=hard_link= | *=hash_dir= | *=keep_comments_cpp= | *=read_only= | *=read_only_direct= | *=recache= | *=run_second_cpp= | *=stats= | *=unify= )
|
||||
local booleans; booleans=(
|
||||
'true'
|
||||
'false'
|
||||
)
|
||||
_describe -t booleans 'boolean' booleans
|
||||
;;
|
||||
*=base_dir= | *=temporary_dir= | *=cache_dir=)
|
||||
_path_files -/
|
||||
;;
|
||||
*=compiler=)
|
||||
_ccache_compilers
|
||||
;;
|
||||
*=cache_dir_levels=)
|
||||
_ccache_dirlevels
|
||||
;;
|
||||
*=compiler_check=)
|
||||
_ccache_compilerchecks
|
||||
;;
|
||||
*=compression_level=)
|
||||
_ccache_compressionlevels
|
||||
;;
|
||||
*=cpp_extension=)
|
||||
_alternative ':set extension for intermediate files: '
|
||||
;;
|
||||
*=extra_files_to_hash=)
|
||||
local sep=:
|
||||
compset -P "*${sep}"
|
||||
compset -S "${sep}*" || suf="$sep"
|
||||
|
||||
_files "" -r "${sep}"' /\t\t\-' "$@"
|
||||
;;
|
||||
*=ignore_headers_in_manifest=)
|
||||
_dir_list
|
||||
;;
|
||||
*=limit_multiple=)
|
||||
_alternative ":clean up down to level (e.g. 0.8): "
|
||||
;;
|
||||
*=log_file=)
|
||||
_path_files -g "*(/) *.log"
|
||||
;;
|
||||
*=max_files=)
|
||||
_alternative ":maximum number of files in the cache (0= no limit): "
|
||||
;;
|
||||
*=max_size=)
|
||||
_alternative ':maximum cache size (0= no limit) with suffix k,M,G,T or Ki,Mi,Gi,Ti: '
|
||||
;;
|
||||
*=path=)
|
||||
_alternative ':PATH for compiler lookup (instead of $PATH):_dir_list'
|
||||
;;
|
||||
*=prefix_command=)
|
||||
_alternative ':prefixes for compiler invokation: '
|
||||
;;
|
||||
*=prefix_command_cpp=)
|
||||
_alternative ':prefixes for preprocessor invokation: '
|
||||
;;
|
||||
*=sloppiness=)
|
||||
_ccache_sloppiness
|
||||
;;
|
||||
*=umask=)
|
||||
_alternative ":umask value (octal): "
|
||||
;;
|
||||
esac
|
||||
elif [[ $words[2] == -* ]]; then
|
||||
# if the first argument starts with -, we are in configure-ccache mode
|
||||
_arguments \
|
||||
'*'{-o,--set-config=}"[set configuration key]:keys:__ccache_config_keys" \
|
||||
'(: -)'{-h,--help}'[show help message]' \
|
||||
'(: -)'{-V,--version}'[print version and copyright information]' \
|
||||
'(-z --zero-stats)'{-z,--zero-stats}'[zero statistics counters]' \
|
||||
'(-c --cleanup)'{-c,--cleanup}'[delete old files and recalculate size counters]' \
|
||||
'(-C --clear)'{-C,--clear}'[clear the cache completely (except configuration)]' \
|
||||
'(-p --print-config)'{-p,--print-config}'[print current configuration options]' \
|
||||
'(-s --show-stats)'{-s,--show-stats}'[show statistics summary]' \
|
||||
'(-F --max-files=)'{-F,--max-files=}'[set maximum number of files in cache]:number of files in cache: ' \
|
||||
'(-M --max-size=)'{-M,--max-size=}'[set maximum size of cache]:cache size: '
|
||||
elif [[ $CURRENT -eq 2 ]]; then
|
||||
_ccache_compilers
|
||||
else
|
||||
# the command line already looks like 'ccache <compiler> ...'
|
||||
# forward to the completion function of the compiler
|
||||
(( CURRENT-- ))
|
||||
shift words
|
||||
_normal
|
||||
fi
|
||||
994
.zprezto/modules/completion/external/src/_cf
vendored
994
.zprezto/modules/completion/external/src/_cf
vendored
@@ -1,994 +0,0 @@
|
||||
#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
|
||||
77
.zprezto/modules/completion/external/src/_chattr
vendored
77
.zprezto/modules/completion/external/src/_chattr
vendored
@@ -1,77 +0,0 @@
|
||||
#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
|
||||
|
||||
73
.zprezto/modules/completion/external/src/_cheat
vendored
73
.zprezto/modules/completion/external/src/_cheat
vendored
@@ -1,73 +0,0 @@
|
||||
#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
|
||||
|
||||
60
.zprezto/modules/completion/external/src/_choc
vendored
60
.zprezto/modules/completion/external/src/_choc
vendored
@@ -1,60 +0,0 @@
|
||||
#compdef choc
|
||||
# ------------------------------------------------------------------------------
|
||||
# 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 choc (http://chocolatapp.com)
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
# Authors
|
||||
# -------
|
||||
#
|
||||
# * Nicholas Penree (https://github.com/drudge)
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
local curcontext="$curcontext" state line ret=1
|
||||
typeset -A opt_args
|
||||
|
||||
_arguments -C \
|
||||
'(-a --async)'{-a,--async}'[do not wait for the user to close the file in Chocolat]' \
|
||||
'(-w --wait)'{-w,--wait}'[wait for file to be closed by Chocolat]' \
|
||||
'(-n --no-reactivation)'{-n,--no-reactivation}'[after editing with -w, do not reactivate the calling app]' \
|
||||
'(-h --help)'{-h,--help}'[show help information]' \
|
||||
'(-v --version)'{-v,--version}'[print version information]' \
|
||||
'*:script or directory:_files' && ret=0
|
||||
|
||||
return ret
|
||||
|
||||
# Local Variables:
|
||||
# mode: Shell-Script
|
||||
# sh-indentation: 2
|
||||
# indent-tabs-mode: nil
|
||||
# sh-basic-offset: 2
|
||||
# End:
|
||||
# vim: ft=zsh sw=2 ts=2 et
|
||||
211
.zprezto/modules/completion/external/src/_chromium
vendored
211
.zprezto/modules/completion/external/src/_chromium
vendored
@@ -1,211 +0,0 @@
|
||||
#compdef chromium
|
||||
|
||||
# Copyright 2018 CERN for the benefit of the LHCb Collaboration
|
||||
|
||||
# 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 CERN 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 THE COPYRIGHT
|
||||
# OWNER OR CONTRIBUTORS 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.
|
||||
#
|
||||
# In applying this licence, CERN does not waive the privileges and immunities
|
||||
# granted to it by virtue of its status as an Intergovernmental Organization
|
||||
# or submit itself to any jurisdiction.
|
||||
|
||||
_arguments \
|
||||
"--user-data-dir=[Specify the directory that user data is kept in]:directory:_path_files -/" \
|
||||
"--app=[Runs URL in app mode]:url:_urls" \
|
||||
"--incognito[Open in incognito mode]" \
|
||||
"--new-window[open in new window]" \
|
||||
"(--no-proxy-server --proxy-auto-detect --proxy-pac-url --password-store)--proxy-server=[specify proxy server]:[<proxy-scheme>\://]<proxy-host>[\:<proxy-port>]:_chromium_proxyurls" \
|
||||
"--no-proxy-server[Disables the proxy server]" \
|
||||
"--proxy-auto-detect[Autodetect proxy configuration]" \
|
||||
"--proxy-pac-url=[Specify proxy autoconfiguration URL]:proxy autoconfiguration url:_urls" \
|
||||
"--password-store=[Set the password store to use]:password store: _wanted arguments expl 'wallet store' compadd -- basic gnome kwallet" \
|
||||
"--version[print version]" \
|
||||
"*:: :{ _alternative _urls _files }"
|
||||
|
||||
# excerpt from the chromium help message:
|
||||
#
|
||||
# Specify the HTTP/SOCKS4/SOCKS5 proxy server to use for requests. This overrides any environment variables or settings picked via the options dialog. An individual proxy server is specified
|
||||
# using the format:
|
||||
#
|
||||
#
|
||||
#
|
||||
# Where <proxy-scheme> is the protocol of the proxy server, and is one of:
|
||||
#
|
||||
# "http", "socks", "socks4", "socks5".
|
||||
#
|
||||
# If the <proxy-scheme> is omitted, it defaults to "http". Also note that "socks" is equivalent to "socks5".
|
||||
#
|
||||
# Examples:
|
||||
#
|
||||
# --proxy-server="foopy:99"
|
||||
# Use the HTTP proxy "foopy:99" to load all URLs.
|
||||
#
|
||||
# --proxy-server="socks://foobar:1080"
|
||||
# Use the SOCKS v5 proxy "foobar:1080" to load all URLs.
|
||||
#
|
||||
# --proxy-server="socks4://foobar:1080"
|
||||
# Use the SOCKS v4 proxy "foobar:1080" to load all URLs.
|
||||
#
|
||||
# --proxy-server="socks5://foobar:66"
|
||||
# Use the SOCKS v5 proxy "foobar:66" to load all URLs.
|
||||
#
|
||||
# It is also possible to specify a separate proxy server for different URL types, by prefixing the proxy server specifier with a URL specifier:
|
||||
#
|
||||
# Example:
|
||||
#
|
||||
# --proxy-server="https=proxy1:80;http=socks4://baz:1080"
|
||||
# Load https://* URLs using the HTTP proxy "proxy1:80". And load http://*
|
||||
# URLs using the SOCKS v4 proxy "baz:1080".
|
||||
#
|
||||
|
||||
_chromium_proxyurls () {
|
||||
#TODO: semicolon separated urls not yet implemented
|
||||
# mostly copied from _urls
|
||||
local ipre scheme host user uhosts ret=1 expl match glob suf
|
||||
local localhttp
|
||||
zstyle -a ":completion:${curcontext}:urls" local localhttp
|
||||
local localhttp_servername="$localhttp[1]"
|
||||
local localhttp_documentroot="$localhttp[2]"
|
||||
local localhttp_userdir="$localhttp[3]"
|
||||
zstyle -a ":completion:${curcontext}:urls" urls urls
|
||||
if [[ $#urls -gt 1 || ( $#urls -eq 1 && ! -d $urls[1] ) ]]
|
||||
then
|
||||
[[ $#urls -eq 1 && -f $urls[1] ]] && urls=($(< $urls[1]))
|
||||
_wanted urls expl 'URL' compadd "$@" -a urls && return 0
|
||||
urls=()
|
||||
fi
|
||||
urls="$urls[1]"
|
||||
glob=(-g '*(^/)')
|
||||
zparseopts -D -K -E 'g:=glob'
|
||||
ipre="$IPREFIX"
|
||||
if ! compset -P '(#b)([-+.a-z0-9]#):'
|
||||
then
|
||||
_tags -C argument prefixes
|
||||
while _tags
|
||||
do
|
||||
while _next_label prefixes expl 'URL prefix' -S '' "$@"
|
||||
do
|
||||
compset -S '[^:/]*' && compstate[to_end]=''
|
||||
compadd "$expl[@]" http:// socks:// socks4:// socks5:// && ret=0
|
||||
done
|
||||
(( ret )) || return 0
|
||||
done
|
||||
return 1
|
||||
fi
|
||||
scheme="$match[1]"
|
||||
case "$scheme" in
|
||||
(http(|s)|socks(|4|5)) if ! compset -P //
|
||||
then
|
||||
_wanted -C "$scheme" prefixes expl 'end of prefix' compadd -S '' "$@" //
|
||||
return
|
||||
fi ;;
|
||||
(file) [[ -prefix //(127.0.0.1|localhost)/ ]] && compset -P '//(127.0.0.1|localhost)'
|
||||
[[ -prefix /// ]] && compset -P //
|
||||
if ! compset -P //
|
||||
then
|
||||
_tags -C file files
|
||||
while _tags
|
||||
do
|
||||
while _next_label files expl 'local file'
|
||||
do
|
||||
if [[ -prefix / ]]
|
||||
then
|
||||
_path_files "$expl[@]" -S '' "${glob[@]}" && ret=0
|
||||
_path_files "$expl[@]" -S/ -r '/' -/ && ret=0
|
||||
elif [[ -z "$PREFIX" ]]
|
||||
then
|
||||
compadd -S '/' -r '/' "$expl[@]" "$@" - "${PWD%/}" && ret=0
|
||||
fi
|
||||
done
|
||||
(( ret )) || return 0
|
||||
done
|
||||
return 1
|
||||
fi ;;
|
||||
esac
|
||||
if ! compset -P '(#b)([^:/]#)([:/])'
|
||||
then
|
||||
uhosts=($urls/$scheme/$PREFIX*$SUFFIX(/:t))
|
||||
_tags hosts
|
||||
while _tags
|
||||
do
|
||||
while _next_label hosts expl host
|
||||
do
|
||||
compset -S '[:/]*' || suf="/"
|
||||
(( $#uhosts )) || _hosts -S "$suf" -r '/:' "$expl[@]" && ret=0
|
||||
[[ "$scheme" = http ]] && uhosts=($uhosts $localhttp_servername)
|
||||
compadd -S "$suf" -r '/:' "$expl[@]" -a uhosts && ret=0
|
||||
done
|
||||
(( ret )) || return 0
|
||||
done
|
||||
return 1
|
||||
fi
|
||||
host="$match[1]"
|
||||
[[ $match[2] = ':' ]] && ! compset -P '<->/' && _message -e ports 'port number' && return 0
|
||||
_tags remote-files files || return 1
|
||||
if [[ "$localhttp_servername" = "$host" ]]
|
||||
then
|
||||
if compset -P \~
|
||||
then
|
||||
if ! compset -P '(#b)([^/]#)/'
|
||||
then
|
||||
_users -S/ "$@"
|
||||
return
|
||||
fi
|
||||
user="$match[1]"
|
||||
while _tags
|
||||
do
|
||||
while _next_label files expl 'local file'
|
||||
do
|
||||
_path_files "$expl[@]" "$@" -W ~$user/$localhttp_userdir "${glob[@]}" && ret=0
|
||||
_path_files -S/ -r '/' "$expl[@]" -W ~$user/$localhttp_userdir-/ && ret=0
|
||||
done
|
||||
(( ret )) || return 0
|
||||
done
|
||||
else
|
||||
while _tags
|
||||
do
|
||||
while _next_label files expl 'local file'
|
||||
do
|
||||
_path_files "$expl[@]" "$@" -W $localhttp_documentroot "${glob[@]}" && ret=0
|
||||
_path_files -S/ -r '/' "$expl[@]" -W $localhttp_documentroot -/ && ret=0
|
||||
done
|
||||
(( ret )) || return 0
|
||||
done
|
||||
fi
|
||||
else
|
||||
while _tags
|
||||
do
|
||||
(( $#urls )) && while _next_label files expl 'local file'
|
||||
do
|
||||
_path_files "$expl[@]" "$@" -W $urls/$scheme/$host "${glob[@]}" && ret=0
|
||||
_path_files -S/ -r '/' "$expl[@]" -W $urls/$scheme/$host -/ && ret=0
|
||||
done
|
||||
[[ $scheme = (scp|sftp) ]] && _requested remote-files && _remote_files -h $host -- ssh && ret=0
|
||||
(( ret )) || return 0
|
||||
done
|
||||
fi
|
||||
return $ret
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user