summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorTuowen Zhao <ztuowen@gmail.com>2020-01-02 15:46:19 -0500
committerTuowen Zhao <ztuowen@gmail.com>2020-01-02 15:46:19 -0500
commitff9208623b3573c736ae9118947aaf0c7e752998 (patch)
tree45977b00446155003d486c04c3b891a5b7c88441 /plugins
parent1456610ebd292625fdc34fa3167c9c0f67d85228 (diff)
parentca627655dbd1d110dbea34ec4a8c1964a1da83d2 (diff)
downloadzsh-ff9208623b3573c736ae9118947aaf0c7e752998.tar.gz
zsh-ff9208623b3573c736ae9118947aaf0c7e752998.tar.bz2
zsh-ff9208623b3573c736ae9118947aaf0c7e752998.zip
Merge branch 'master' of https://github.com/ohmyzsh/ohmyzsh
Diffstat (limited to 'plugins')
-rw-r--r--plugins/codeclimate/README.md8
-rw-r--r--plugins/colorize/README.md43
-rw-r--r--plugins/colorize/colorize.plugin.zsh128
-rw-r--r--plugins/dotnet/README.md21
-rw-r--r--plugins/dotnet/dotnet.plugin.zsh117
-rw-r--r--plugins/extract/README.md6
-rw-r--r--plugins/extract/_extract2
-rw-r--r--plugins/extract/extract.plugin.zsh8
-rw-r--r--plugins/fasd/README.md4
-rw-r--r--plugins/fastfile/README.md84
-rw-r--r--plugins/fastfile/fastfile.plugin.zsh39
-rw-r--r--plugins/firewalld/README.md (renamed from plugins/firewalld/readme.md)0
-rw-r--r--plugins/fzf/fzf.plugin.zsh1
-rw-r--r--plugins/gas/README.md9
-rw-r--r--plugins/git-prompt/gitstatus.py19
-rw-r--r--plugins/glassfish/README.md9
-rw-r--r--plugins/glassfish/glassfish.plugin.zsh3
-rw-r--r--plugins/gnu-utils/README.md38
-rw-r--r--plugins/gnu-utils/gnu-utils.plugin.zsh130
-rw-r--r--plugins/hitokoto/README.md15
-rw-r--r--plugins/hitokoto/hitokoto.plugin.zsh14
-rw-r--r--plugins/ionic/README.md30
-rw-r--r--plugins/ionic/ionic.plugin.zsh15
-rw-r--r--plugins/knife/README.md25
-rw-r--r--plugins/knife/_knife215
-rw-r--r--plugins/knife_ssh/README.md14
-rw-r--r--plugins/knife_ssh/knife_ssh.plugin.zsh8
-rw-r--r--plugins/kubectl/kubectl.plugin.zsh14
-rw-r--r--plugins/laravel/README.md17
-rw-r--r--plugins/laravel/laravel.plugin.zsh15
-rw-r--r--plugins/magic-enter/README.md (renamed from plugins/magic-enter/Readme.md)0
-rw-r--r--plugins/microk8s/README.md24
-rw-r--r--plugins/microk8s/microk8s.plugin.zsh82
-rw-r--r--plugins/osx/spotify17
-rw-r--r--plugins/otp/README.md22
-rw-r--r--plugins/otp/otp.plugin.zsh19
-rw-r--r--plugins/paver/README.md12
-rw-r--r--plugins/paver/paver.plugin.zsh6
-rw-r--r--plugins/rbfu/README.md17
-rw-r--r--plugins/repo/repo.plugin.zsh12
-rw-r--r--plugins/ros/README.md (renamed from plugins/ros/README.mkd)0
-rw-r--r--plugins/sfffe/README.md17
-rw-r--r--plugins/svn-fast-info/README.md55
-rw-r--r--plugins/svn-fast-info/svn-fast-info.plugin.zsh42
-rw-r--r--plugins/tmux-cssh/README.md10
-rw-r--r--plugins/tmux-cssh/_tmux-cssh24
-rw-r--r--plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh10
-rw-r--r--plugins/yarn/README.md1
-rw-r--r--plugins/yarn/yarn.plugin.zsh1
-rw-r--r--plugins/zeus/README.md1
-rw-r--r--plugins/zeus/zeus.plugin.zsh1
51 files changed, 1094 insertions, 330 deletions
diff --git a/plugins/codeclimate/README.md b/plugins/codeclimate/README.md
new file mode 100644
index 000000000..0d712ac63
--- /dev/null
+++ b/plugins/codeclimate/README.md
@@ -0,0 +1,8 @@
+# codeclimate plugin
+
+This plugin adds autocompletion for the [`codeclimate` CLI](https://github.com/codeclimate/codeclimate).
+
+To use it, add `codeclimate` to the plugins array in your zshrc file:
+```zsh
+plugins=(... codeclimate)
+```
diff --git a/plugins/colorize/README.md b/plugins/colorize/README.md
index 32dc97b6e..ee4ab8036 100644
--- a/plugins/colorize/README.md
+++ b/plugins/colorize/README.md
@@ -6,30 +6,43 @@ Colorize will highlight the content based on the filename extension. If it can't
method for a given extension, it will try to find one by looking at the file contents. If no highlight method
is found it will just cat the file normally, without syntax highlighting.
-To use it, add colorize to the plugins array of your zshrc file:
+## Setup
+
+To use it, add colorize to the plugins array of your `~/.zshrc` file:
```
plugins=(... colorize)
```
-## Styles
+## Configuration
-Pygments offers multiple styles. By default, the `default` style is used, but you can choose another theme by setting the `ZSH_COLORIZE_STYLE` environment variable:
+### Requirements
-`ZSH_COLORIZE_STYLE="colorful"`
+This plugin requires that at least one of the following tools is installed:
-## Usage
+* [Chroma](https://github.com/alecthomas/chroma)
+* [Pygments](https://pygments.org/download/)
+
+### Colorize tool
-* `ccat <file> [files]`: colorize the contents of the file (or files, if more than one are provided).
- If no arguments are passed it will colorize the standard input or stdin.
+Colorize supports `pygmentize` and `chroma` as syntax highlighter. By default colorize uses `pygmentize` unless it's not installed and `chroma` is. This can be overridden by the `ZSH_COLORIZE_TOOL` environment variable:
+
+```
+ZSH_COLORIZE_TOOL=chroma
+```
-* `cless <file> [files]`: colorize the contents of the file (or files, if more than one are provided) and
- open less. If no arguments are passed it will colorize the standard input or stdin.
+### Styles
-Note that `cless` will behave as less when provided more than one file: you have to navigate files with
-the commands `:n` for next and `:p` for previous. The downside is that less options are not supported.
-But you can circumvent this by either using the LESS environment variable, or by running `ccat file1 file2|less --opts`.
-In the latter form, the file contents will be concatenated and presented by less as a single file.
+Pygments offers multiple styles. By default, the `default` style is used, but you can choose another theme by setting the `ZSH_COLORIZE_STYLE` environment variable:
+
+```
+ZSH_COLORIZE_STYLE="colorful"
+```
+
+## Usage
-## Requirements
+* `ccat <file> [files]`: colorize the contents of the file (or files, if more than one are provided).
+ If no files are passed it will colorize the standard input.
-You have to install Pygments first: [pygments.org](http://pygments.org/download.html)
+* `cless [less-options] <file> [files]`: colorize the contents of the file (or files, if more than one are provided) and open less.
+ If no files are passed it will colorize the standard input.
+ The LESSOPEN and LESSCLOSE will be overwritten for this to work, but only in a local scope.
diff --git a/plugins/colorize/colorize.plugin.zsh b/plugins/colorize/colorize.plugin.zsh
index 565ba5a36..6ed9739fa 100644
--- a/plugins/colorize/colorize.plugin.zsh
+++ b/plugins/colorize/colorize.plugin.zsh
@@ -1,57 +1,113 @@
-# easier alias to use the plugin
-alias ccat='colorize_via_pygmentize'
-alias cless='colorize_via_pygmentize_less'
+# Easier alias to use the plugin
+alias ccat="colorize_cat"
+alias cless="colorize_less"
-colorize_via_pygmentize() {
- if ! (( $+commands[pygmentize] )); then
- echo "package 'Pygments' is not installed!"
+# '$0:A' gets the absolute path of this file
+ZSH_COLORIZE_PLUGIN_PATH=$0:A
+
+colorize_check_requirements() {
+ local available_tools=("chroma" "pygmentize")
+
+ if [ -z "$ZSH_COLORIZE_TOOL" ]; then
+ if (( $+commands[pygmentize] )); then
+ ZSH_COLORIZE_TOOL="pygmentize"
+ elif (( $+commands[chroma] )); then
+ ZSH_COLORIZE_TOOL="chroma"
+ else
+ echo "Neither 'pygments' nor 'chroma' is installed!" >&2
+ return 1
+ fi
+ fi
+
+ if [[ ${available_tools[(Ie)$ZSH_COLORIZE_TOOL]} -eq 0 ]]; then
+ echo "ZSH_COLORIZE_TOOL '$ZSH_COLORIZE_TOOL' not recognized. Available options are 'pygmentize' and 'chroma'." >&2
+ return 1
+ elif (( $+commands["$ZSH_COLORIZE_TOOL"] )); then
+ echo "Package '$ZSH_COLORIZE_TOOL' is not installed!" >&2
+ return 1
+ fi
+}
+
+colorize_cat() {
+ if ! colorize_check_requirements; then
return 1
fi
- # If the environment varianle ZSH_COLORIZE_STYLE
+ # If the environment variable ZSH_COLORIZE_STYLE
# is set, use that theme instead. Otherwise,
# use the default.
- if [ -z $ZSH_COLORIZE_STYLE ]; then
- ZSH_COLORIZE_STYLE="default"
+ if [ -z "$ZSH_COLORIZE_STYLE" ]; then
+ # Both pygmentize & chroma support 'emacs'
+ ZSH_COLORIZE_STYLE="emacs"
fi
- # pygmentize stdin if no arguments passed
+ # Use stdin if no arguments have been passed.
if [ $# -eq 0 ]; then
- pygmentize -O style="$ZSH_COLORIZE_STYLE" -g
+ if [[ "$ZSH_COLORIZE_TOOL" == "pygmentize" ]]; then
+ pygmentize -O style="$ZSH_COLORIZE_STYLE" -g
+ else
+ chroma --style="$ZSH_COLORIZE_STYLE"
+ fi
return $?
fi
- # guess lexer from file extension, or
- # guess it from file contents if unsuccessful
-
+ # Guess lexer from file extension, or guess it from file contents if unsuccessful.
local FNAME lexer
- for FNAME in "$@"
- do
- lexer=$(pygmentize -N "$FNAME")
- if [[ $lexer != text ]]; then
- pygmentize -O style="$ZSH_COLORIZE_STYLE" -l "$lexer" "$FNAME"
+ for FNAME in "$@"; do
+ if [[ "$ZSH_COLORIZE_TOOL" == "pygmentize" ]]; then
+ lexer=$(pygmentize -N "$FNAME")
+ if [[ $lexer != text ]]; then
+ pygmentize -O style="$ZSH_COLORIZE_STYLE" -l "$lexer" "$FNAME"
+ else
+ pygmentize -O style="$ZSH_COLORIZE_STYLE" -g "$FNAME"
+ fi
else
- pygmentize -O style="$ZSH_COLORIZE_STYLE" -g "$FNAME"
+ chroma --style="$ZSH_COLORIZE_STYLE" "$FNAME"
fi
done
}
-colorize_via_pygmentize_less() (
- # this function is a subshell so tmp_files can be shared to cleanup function
- declare -a tmp_files
+# The less option 'F - Forward forever; like "tail -f".' will not work in this implementation
+# caused by the lack of the ability to follow the file within pygmentize.
+colorize_less() {
+ if ! colorize_check_requirements; then
+ return 1
+ fi
- cleanup () {
- [[ ${#tmp_files} -gt 0 ]] && rm -f "${tmp_files[@]}"
- exit
- }
- trap 'cleanup' EXIT HUP TERM INT
+ _cless() {
+ # LESS="-R $LESS" enables raw ANSI colors, while maintain already set options.
+ local LESS="-R $LESS"
- while (( $# != 0 )); do #TODO: filter out less opts
- tmp_file="$(mktemp -t "tmp.colorize.XXXX.$(sed 's/\//./g' <<< "$1")")"
- tmp_files+=("$tmp_file")
- colorize_via_pygmentize "$1" > "$tmp_file"
- shift 1
- done
+ # This variable tells less to pipe every file through the specified command
+ # (see the man page of less INPUT PREPROCESSOR).
+ # 'zsh -ic "colorize_cat %s 2> /dev/null"' would not work for huge files like
+ # the ~/.zsh_history. For such files the tty of the preprocessor will be supended.
+ # Therefore we must source this file to make colorize_cat available in the
+ # preprocessor without the interactive mode.
+ # `2>/dev/null` will suppress the error for large files 'broken pipe' of the python
+ # script pygmentize, which will show up if less has not fully "loaded the file"
+ # (e.g. when not scrolled to the bottom) while already the next file will be displayed.
+ local LESSOPEN="| zsh -c 'source \"$ZSH_COLORIZE_PLUGIN_PATH\"; \
+ ZSH_COLORIZE_TOOL=$ZSH_COLORIZE_TOOL ZSH_COLORIZE_STYLE=$ZSH_COLORIZE_STYLE \
+ colorize_cat %s 2> /dev/null'"
- less -f "${tmp_files[@]}"
-)
+ # LESSCLOSE will be set to prevent any errors by executing a user script
+ # which assumes that his LESSOPEN has been executed.
+ local LESSCLOSE=""
+
+ LESS="$LESS" LESSOPEN="$LESSOPEN" LESSCLOSE="$LESSCLOSE" less "$@"
+ }
+
+ if [ -t 0 ]; then
+ _cless "$@"
+ else
+ # The input is not associated with a terminal, therefore colorize_cat will
+ # colorize this input and pass it to less.
+ # Less has now to decide what to use. If any files have been provided, less
+ # will ignore the input by default, otherwise the colorized input will be used.
+ # If files have been supplied and the input has been redirected, this will
+ # lead to unnecessary overhead, but retains the ability to use the less options
+ # without checking for them inside this script.
+ colorize_cat | _cless "$@"
+ fi
+}
diff --git a/plugins/dotnet/README.md b/plugins/dotnet/README.md
new file mode 100644
index 000000000..7a6d6a995
--- /dev/null
+++ b/plugins/dotnet/README.md
@@ -0,0 +1,21 @@
+# .NET Core CLI plugin
+
+This plugin provides completion and useful aliases for [.NET Core CLI](https://dotnet.microsoft.com/).
+
+To use it, add `dotnet` to the plugins array in your zshrc file.
+
+```
+plugins=(... dotnet)
+```
+
+## Aliases
+
+| Alias | Command | Description |
+|-------|--------------|-------------------------------------------------------------------|
+| dn | dotnet new | Create a new .NET project or file. |
+| dr | dotnet run | Build and run a .NET project output. |
+| dt | dotnet test | Run unit tests using the test runner specified in a .NET project. |
+| ds | dotnet sln | Modify Visual Studio solution files. |
+| da | dotnet add | Add a package or reference to a .NET project. |
+| dp | dotnet pack | Create a NuGet package. |
+| dng | dotnet nuget | Provides additional NuGet commands. | \ No newline at end of file
diff --git a/plugins/dotnet/dotnet.plugin.zsh b/plugins/dotnet/dotnet.plugin.zsh
new file mode 100644
index 000000000..8b9a45a97
--- /dev/null
+++ b/plugins/dotnet/dotnet.plugin.zsh
@@ -0,0 +1,117 @@
+# --------------------------------------------------------------------- #
+# Aliases and Completions for .NET Core (https://dotnet.microsoft.com/) #
+# Author: Shaun Tabone (https://github.com/xontab) #
+# --------------------------------------------------------------------- #
+
+# Helper function to cache and load completions
+local cache_base_path="${ZSH_CACHE_DIR}/dotnet_"
+_dotnet_cache_completion() {
+ local cache="${cache_base_path}$(echo $1)_completion"
+ if [[ ! -f $cache ]]; then
+ $2 $cache
+ fi
+
+ [[ -f $cache ]] && cat $cache
+}
+
+_dotnet_cache_completion_cleanup() {
+ local cache="${cache_base_path}$(echo $1)_completion"
+ rm -f $cache
+}
+
+# --------------------------------------------------------------------- #
+# dotnet new #
+# ALIAS: dn #
+# --------------------------------------------------------------------- #
+_dotnet_new_completion() {
+ if [ $commands[dotnet] ]; then
+ dotnet new -l | tail -n +21 | sed 's/ \+/:/g' | cut -d : -f 2 >$1
+ fi
+}
+
+_dotnet_new_completion_cached() {
+ _dotnet_cache_completion 'new' _dotnet_new_completion
+}
+
+_dotnet_cache_completion_cleanup 'new'
+
+alias dn='dotnet new'
+
+# --------------------------------------------------------------------- #
+# dotnet #
+# --------------------------------------------------------------------- #
+_dotnet() {
+ if [ $CURRENT -eq 2 ]; then
+ _arguments \
+ '--diagnostics[Enable diagnostic output.]' \
+ '--help[Show command line help.]' \
+ '--info[Display .NET Core information.]' \
+ '--list-runtimes[Display the installed runtimes.]' \
+ '--list-sdks[Display the installed SDKs.]' \
+ '--version[Display .NET Core SDK version in use.]'
+
+ _values \
+ 'add[Add a package or reference to a .NET project.]' \
+ 'build[Build a .NET project.]' \
+ 'build-server[Interact with servers started by a build.]' \
+ 'clean[Clean build outputs of a .NET project.]' \
+ 'help[Show command line help.]' \
+ 'list[List project references of a .NET project.]' \
+ 'msbuild[Run Microsoft Build Engine (MSBuild) commands.]' \
+ 'new[Create a new .NET project or file.]' \
+ 'nuget[Provides additional NuGet commands.]' \
+ 'pack[Create a NuGet package.]' \
+ 'publish[Publish a .NET project for deployment.]' \
+ 'remove[Remove a package or reference from a .NET project.]' \
+ 'restore[Restore dependencies specified in a .NET project.]' \
+ 'run[Build and run a .NET project output.]' \
+ 'sln[Modify Visual Studio solution files.]' \
+ 'store[Store the specified assemblies in the runtime package store.]' \
+ 'test[Run unit tests using the test runner specified in a .NET project.]' \
+ 'tool[Install or manage tools that extend the .NET experience.]' \
+ 'vstest[Run Microsoft Test Engine (VSTest) commands.]' \
+ 'dev-certs[Create and manage development certificates.]' \
+ 'fsi[Start F# Interactive / execute F# scripts.]' \
+ 'sql-cache[SQL Server cache command-line tools.]' \
+ 'user-secrets[Manage development user secrets.]' \
+ 'watch[Start a file watcher that runs a command when files change.]'
+ return
+ fi
+
+ if [ $CURRENT -eq 3 ]; then
+ case ${words[2]} in
+ "new")
+ compadd -X ".NET Installed Templates" $(_dotnet_new_completion_cached)
+ return
+ ;;
+ "sln")
+ _values \
+ 'add[Add one or more projects to a solution file.]' \
+ 'list[List all projects in a solution file.]' \
+ 'remove[Remove one or more projects from a solution file.]'
+ return
+ ;;
+ "nuget")
+ _values \
+ 'delete[Deletes a package from the server.]' \
+ 'locals[Clears or lists local NuGet resources such as http requests cache, packages folder, plugin operations cache or machine-wide global packages folder.]' \
+ 'push[Pushes a package to the server and publishes it.]'
+ return
+ ;;
+ esac
+ fi
+
+ _arguments '*::arguments: _normal'
+}
+
+compdef _dotnet dotnet
+
+# --------------------------------------------------------------------- #
+# Other Aliases #
+# --------------------------------------------------------------------- #
+alias dr='dotnet run'
+alias dt='dotnet test'
+alias ds='dotnet sln'
+alias da='dotnet add'
+alias dp='dotnet pack'
+alias dng='dotnet nuget'
diff --git a/plugins/extract/README.md b/plugins/extract/README.md
index 41b6a61f1..a6630de3f 100644
--- a/plugins/extract/README.md
+++ b/plugins/extract/README.md
@@ -25,6 +25,7 @@ plugins=(... extract)
| `gz` | Gzip file |
| `ipsw` | iOS firmware file |
| `jar` | Java Archive |
+| `lrz` | LRZ archive |
| `lzma` | LZMA archive |
| `rar` | WinRAR archive |
| `rpm` | RPM package |
@@ -32,17 +33,22 @@ plugins=(... extract)
| `tar` | Tarball |
| `tar.bz2` | Tarball with bzip2 compression |
| `tar.gz` | Tarball with gzip compression |
+| `tar.lrz` | Tarball with lrzip compression |
+| `tar.lz` | Tarball with lzip compression |
| `tar.xz` | Tarball with lzma2 compression |
| `tar.zma` | Tarball with lzma compression |
+| `tar.zst` | Tarball with zstd compression |
| `tbz` | Tarball with bzip compression |
| `tbz2` | Tarball with bzip2 compression |
| `tgz` | Tarball with gzip compression |
| `tlz` | Tarball with lzma compression |
| `txz` | Tarball with lzma2 compression |
+| `tzst` | Tarball with zstd compression |
| `war` | Web Application archive (Java-based) |
| `xpi` | Mozilla XPI module file |
| `xz` | LZMA2 archive |
| `zip` | Zip archive |
+| `zst` | Zstandard file (zstd) |
See [list of archive formats](https://en.wikipedia.org/wiki/List_of_archive_formats) for
more information regarding archive formats.
diff --git a/plugins/extract/_extract b/plugins/extract/_extract
index 0257ce231..034fe6df0 100644
--- a/plugins/extract/_extract
+++ b/plugins/extract/_extract
@@ -3,5 +3,5 @@
_arguments \
'(-r --remove)'{-r,--remove}'[Remove archive.]' \
- "*::archive file:_files -g '(#i)*.(7z|Z|apk|aar|bz2|deb|gz|ipsw|jar|lzma|rar|rpm|sublime-package|tar|tar.bz2|tar.gz|tar.xz|tar.zma|tbz|tbz2|tgz|tlz|txz|war|whl|xpi|xz|zip)(-.)'" \
+ "*::archive file:_files -g '(#i)*.(7z|Z|apk|aar|bz2|deb|gz|ipsw|jar|lrz|lzma|rar|rpm|sublime-package|tar|tar.bz2|tar.gz|tar.lrz|tar.lz|tar.xz|tar.zma|tar.zst|tbz|tbz2|tgz|tlz|txz|tzst|war|whl|xpi|xz|zip|zst)(-.)'" \
&& return 0
diff --git a/plugins/extract/extract.plugin.zsh b/plugins/extract/extract.plugin.zsh
index 27b9e50f1..349c9a776 100644
--- a/plugins/extract/extract.plugin.zsh
+++ b/plugins/extract/extract.plugin.zsh
@@ -40,10 +40,17 @@ extract() {
tar --lzma --help &> /dev/null \
&& tar --lzma -xvf "$1" \
|| lzcat "$1" | tar xvf - ;;
+ (*.tar.zst|*.tzst)
+ tar --zstd --help &> /dev/null \
+ && tar --zstd -xvf "$1" \
+ || zstdcat "$1" | tar xvf - ;;
(*.tar) tar xvf "$1" ;;
+ (*.tar.lz) (( $+commands[lzip] )) && tar xvf "$1" ;;
+ (*.tar.lrz) (( $+commands[lrzuntar] )) && lrzuntar "$1" ;;
(*.gz) (( $+commands[pigz] )) && pigz -dk "$1" || gunzip -k "$1" ;;
(*.bz2) bunzip2 "$1" ;;
(*.xz) unxz "$1" ;;
+ (*.lrz) (( $+commands[lrunzip] )) && lrunzip "$1" ;;
(*.lzma) unlzma "$1" ;;
(*.z) uncompress "$1" ;;
(*.zip|*.war|*.jar|*.sublime-package|*.ipsw|*.xpi|*.apk|*.aar|*.whl) unzip "$1" -d $extract_dir ;;
@@ -59,6 +66,7 @@ extract() {
cd ..; rm *.tar.* debian-binary
cd ..
;;
+ (*.zst) unzstd "$1" ;;
(*)
echo "extract: '$1' cannot be extracted" >&2
success=1
diff --git a/plugins/fasd/README.md b/plugins/fasd/README.md
index 1641a92d0..a5c74e5b8 100644
--- a/plugins/fasd/README.md
+++ b/plugins/fasd/README.md
@@ -5,7 +5,7 @@
To use it, add `fasd` to the plugins array in your zshrc file:
```zsh
-plugins=(... fd)
+plugins=(... fasd)
```
## Installation
@@ -18,4 +18,4 @@ Please find detailed installation guide [`here`](https://github.com/clvv/fasd#in
|-------|-------------------------------------------|-------------------------------------------------------------|
| v | `fasd -f -e "$EDITOR"` | List frequent/recent files matching the given filename. |
| o | `fasd -a -e xdg-open` | List frequent/recent files and directories matching. |
-| j | `fasd_cd -d -i` | cd with interactive selection | \ No newline at end of file
+| j | `fasd_cd -d -i` | cd with interactive selection |
diff --git a/plugins/fastfile/README.md b/plugins/fastfile/README.md
new file mode 100644
index 000000000..37f5b2f53
--- /dev/null
+++ b/plugins/fastfile/README.md
@@ -0,0 +1,84 @@
+# Fastfile plugin
+
+This plugin adds a way to reference certain files or folders used frequently using
+a global alias or shortcut.
+
+To use it, add `fastfile` to the plugins array in your zshrc file:
+```zsh
+plugins=(... fastfile)
+```
+
+## Usage
+
+Example: you access folder `/code/project/backend/database` very frequently.
+
+First, generate a shortcut with the name `pjdb`:
+```zsh
+$ fastfile pjdb /code/project/backend/database
+```
+
+Next time you want to access it, use `§pjdb`. For example:
+```zsh
+$ cd §pjdb
+$ subl §pjdb
+```
+where § is the fastfile prefix (see [below](#options) for how to change).
+
+**Note:** shortcuts with spaces in the name are assigned a global alias
+where the spaces have been substituted with underscores (`_`). For example:
+a shortcut named `"hello world"` corresponds with `§hello_world`.
+
+
+## Functions
+
+- `fastfile <shortcut_name> <path/to/file/or/folder>`: generate a shortcut.
+
+- `fastfile_print <shortcut_name>`: prints a shortcut, with the format
+ `<prefix><shortcut_name> -> <shortcut_path>`.
+
+- `fastfile_ls`: lists all shortcuts.
+
+- `fastfile_rm <shortcut_name> `: remove a shortcut.
+
+- `fastfile_sync`: generates the global aliases for the shortcuts.
+
+
+### Internal functions
+
+- `fastfile_resolv <shortcut_name>`: resolves the location of the shortcut
+ file, i.e., the file in the fastfile directory where the shortcut path
+ is stored.
+
+- `fastfile_get <shortcut_name>`: get the real path of the shortcut.
+
+
+## Aliases
+
+| Alias | Function |
+|--------|------------------|
+| ff | `fastfile` |
+| ffp | `fastfile_print` |
+| ffrm | `fastfile_rm` |
+| ffls | `fastfile_ls` |
+| ffsync | `fastfile_sync` |
+
+
+## Options
+
+These are options you can set to change certain parts of the plugin. To change
+them, add `<variable>=<value>` to your zshrc file, before Oh My Zsh is sourced.
+For example: `fastfile_var_prefix='@'`.
+
+- `fastfile_var_prefix`: prefix for the global aliases created. Controls the prefix of the
+ created global aliases.
+ **Default:** `§` (section sign), easy to type in a german keyboard via the combination
+ [`⇧ Shift`+`3`](https://en.wikipedia.org/wiki/German_keyboard_layout#/media/File:KB_Germany.svg),
+ or using `⌥ Option`+`6` in macOS.
+
+- `fastfile_dir`: directory where the fastfile shortcuts are stored. Needs to end
+ with a trailing slash.
+ **Default:** `$HOME/.fastfile/`.
+
+## Author
+
+- [Karolin Varner](https://github.com/koraa)
diff --git a/plugins/fastfile/fastfile.plugin.zsh b/plugins/fastfile/fastfile.plugin.zsh
index 775e9483e..a4229e4c2 100644
--- a/plugins/fastfile/fastfile.plugin.zsh
+++ b/plugins/fastfile/fastfile.plugin.zsh
@@ -1,15 +1,5 @@
-################################################################################
-# FILE: fastfile.plugin.zsh
-# DESCRIPTION: oh-my-zsh plugin file.
-# AUTHOR: Michael Varner (musikmichael@web.de)
-# VERSION: 1.0.0
-#
-# This plugin adds the ability to on the fly generate and access file shortcuts.
-#
-################################################################################
-
###########################
-# Settings
+# Settings
# These can be overwritten any time.
# If they are not set yet, they will be
@@ -33,7 +23,7 @@ default fastfile_var_prefix "§"
function fastfile() {
test "$2" || 2="."
file=$(readlink -f "$2")
-
+
test "$1" || 1="$(basename "$file")"
name=$(echo "$1" | tr " " "_")
@@ -51,7 +41,7 @@ function fastfile() {
# Arguments:
# 1. name - The name of the shortcut
# STDOUT:
-# The path
+# The path to the shortcut file
#
function fastfile_resolv() {
echo "${fastfile_dir}${1}"
@@ -88,12 +78,12 @@ function fastfile_print() {
# (=> fastfle_print) for each shortcut
#
function fastfile_ls() {
- for f in "${fastfile_dir}"/*; do
- file=`basename "$f"` # To enable simpler handeling of spaces in file names
- varkey=`echo "$file" | tr " " "_"`
+ for f in "${fastfile_dir}"/*; do
+ file=`basename "$f"` # To enable simpler handeling of spaces in file names
+ varkey=`echo "$file" | tr " " "_"`
- # Special format for colums
- echo "${fastfile_var_prefix}${varkey}|->|$(fastfile_get "$file")"
+ # Special format for colums
+ echo "${fastfile_var_prefix}${varkey}|->|$(fastfile_get "$file")"
done | column -t -s "|"
}
@@ -102,7 +92,6 @@ function fastfile_ls() {
#
# Arguments:
# 1. name - The name of the shortcut (default: name of the file)
-# 2. file - The file or directory to make the shortcut for
# STDOUT:
# => fastfle_print
#
@@ -115,11 +104,11 @@ function fastfile_rm() {
# Generate the aliases for the shortcuts
#
function fastfile_sync() {
- for f in "${fastfile_dir}"/*; do
- file=`basename "$f"` # To enable simpler handeling of spaces in file names
- varkey=`echo "$file" | tr " " "_"`
+ for f in "${fastfile_dir}"/*; do
+ file=`basename "$f"` # To enable simpler handeling of spaces in file names
+ varkey=`echo "$file" | tr " " "_"`
- alias -g "${fastfile_var_prefix}${varkey}"="'$(fastfile_get "$file")'"
+ alias -g "${fastfile_var_prefix}${varkey}"="'$(fastfile_get "$file")'"
done
}
@@ -133,6 +122,6 @@ alias ffls=fastfile_ls
alias ffsync=fastfile_sync
##################################
-# Init
+# Init
-fastfile_sync \ No newline at end of file
+fastfile_sync
diff --git a/plugins/firewalld/readme.md b/plugins/firewalld/README.md
index 8b5bc74d4..8b5bc74d4 100644
--- a/plugins/firewalld/readme.md
+++ b/plugins/firewalld/README.md
diff --git a/plugins/fzf/fzf.plugin.zsh b/plugins/fzf/fzf.plugin.zsh
index 83626009d..c8aefd7ab 100644
--- a/plugins/fzf/fzf.plugin.zsh
+++ b/plugins/fzf/fzf.plugin.zsh
@@ -12,6 +12,7 @@ function setup_using_base_dir() {
"${HOME}/.fzf"
"/usr/local/opt/fzf"
"/usr/share/fzf"
+ "/usr/local/share/examples/fzf"
)
for dir in ${fzfdirs}; do
if [[ -d "${dir}" ]]; then
diff --git a/plugins/gas/README.md b/plugins/gas/README.md
new file mode 100644
index 000000000..cd8800e7d
--- /dev/null
+++ b/plugins/gas/README.md
@@ -0,0 +1,9 @@
+# Gas plugin
+
+This plugin adds autocompletion for the [gas](http://walle.github.com/gas) command,
+a utility to manage Git authors.
+
+To use it, add `gas` to the plugins array of your zshrc file:
+```zsh
+plugins=(... gas)
+```
diff --git a/plugins/git-prompt/gitstatus.py b/plugins/git-prompt/gitstatus.py
index 390a50a6f..300365d71 100644
--- a/plugins/git-prompt/gitstatus.py
+++ b/plugins/git-prompt/gitstatus.py
@@ -4,26 +4,21 @@ from __future__ import print_function
import os
import sys
import re
-import shlex
from subprocess import Popen, PIPE, check_output
def get_tagname_or_hash():
"""return tagname if exists else hash"""
- cmd = 'git log -1 --format="%h%d"'
- output = check_output(shlex.split(cmd)).decode('utf-8').strip()
- hash_, tagname = None, None
# get hash
- m = re.search('\(.*\)$', output)
- if m:
- hash_ = output[:m.start()-1]
+ hash_cmd = ['git', 'rev-parse', '--short', 'HEAD']
+ hash_ = check_output(hash_cmd).strip()
+
# get tagname
- m = re.search('tag: .*[,\)]', output)
- if m:
- tagname = 'tags/' + output[m.start()+len('tag: '): m.end()-1]
+ tags_cmd = ['git', 'for-each-ref', '--points-at=HEAD', '--count=2', '--sort=-version:refname', '--format=%(refname:short)', 'refs/tags']
+ tags = check_output(tags_cmd).split()
- if tagname:
- return tagname.replace(' ', '')
+ if tags:
+ return tags[0] + ('+' if len(tags) > 1 else '')
elif hash_:
return hash_
return None
diff --git a/plugins/glassfish/README.md b/plugins/glassfish/README.md
new file mode 100644
index 000000000..1f4a8be34
--- /dev/null
+++ b/plugins/glassfish/README.md
@@ -0,0 +1,9 @@
+# glassfish
+
+The glassfish plugin adds completion for the `asadmin` utility, a command to manage
+[Oracle GlassFish](https://docs.oracle.com/cd/E18930_01/html/821-2416/giobi.html) servers.
+
+To use it, add `glassfish` to the plugins array in your zshrc file:
+```zsh
+plugins=(... glassfish)
+```
diff --git a/plugins/glassfish/glassfish.plugin.zsh b/plugins/glassfish/glassfish.plugin.zsh
index fde2edb2a..e69de29bb 100644
--- a/plugins/glassfish/glassfish.plugin.zsh
+++ b/plugins/glassfish/glassfish.plugin.zsh
@@ -1,3 +0,0 @@
-# if there is a user named 'glassfish' on the system, we'll assume
-# that is the user asadmin should be run as
-# grep -e '^glassfish' /etc/passwd > /dev/null && alias asadmin='sudo -u glassfish asadmin' \ No newline at end of file
diff --git a/plugins/gnu-utils/README.md b/plugins/gnu-utils/README.md
new file mode 100644
index 000000000..f5fa81e2f
--- /dev/null
+++ b/plugins/gnu-utils/README.md
@@ -0,0 +1,38 @@
+# gnu-utils plugin
+
+This plugin binds GNU coreutils to their default names, so that you don't have
+to call them using their prefixed name, which starts with `g`. This is useful
+in systems which don't have GNU coreutils installed by default, mainly macOS
+or FreeBSD, which use BSD coreutils.
+
+To use it, add `gnu-utils` to the plugins array in your zshrc file:
+```zsh
+plugins=(... gnu-utils)
+```
+
+The plugin works by changing the path that the command hash points to, so
+instead of `ls` pointing to `/bin/ls`, it points to wherever `gls` is
+installed.
+
+Since `hash -rf` or `rehash` refreshes the command hashes, it also wraps
+`hash` and `rehash` so that the coreutils binding is always done again
+after calling these two commands.
+
+Look at the source code of the plugin to see which GNU coreutils are tried
+to rebind. Open an issue if there are some missing.
+
+## Other methods
+
+The plugin also documents two other ways to do this:
+
+1. Using a function wrapper, such that, for example, there exists a function
+named `ls` which calls `gls` instead. Since functions have a higher preference
+than commands, this ends up calling the GNU coreutil. It has also a higher
+preference over shell builtins (`gecho` is called instead of the builtin `echo`).
+
+2. Using an alias. This has an even higher preference than functions, but they
+could be overridden because of a user setting.
+
+## Author
+
+- [Sorin Ionescu](https://github.com/sorin-ionescu).
diff --git a/plugins/gnu-utils/gnu-utils.plugin.zsh b/plugins/gnu-utils/gnu-utils.plugin.zsh
index b66e25d7f..967b8b4ea 100644
--- a/plugins/gnu-utils/gnu-utils.plugin.zsh
+++ b/plugins/gnu-utils/gnu-utils.plugin.zsh
@@ -5,79 +5,79 @@
# VERSION: 1.0.0
# ------------------------------------------------------------------------------
+# Detect if GNU coreutils are installed by looking for gwhoami
+if [[ ! -x "${commands[gwhoami]}" ]]; then
+ return
+fi
-if [[ -x "${commands[gwhoami]}" ]]; then
- __gnu_utils() {
- emulate -L zsh
- local gcmds
- local gcmd
- local cmd
- local prefix
+__gnu_utils() {
+ emulate -L zsh
+ local gcmds
+ local gcmd
+ local cmd
+ local prefix
- # coreutils
- gcmds=('g[' 'gbase64' 'gbasename' 'gcat' 'gchcon' 'gchgrp' 'gchmod'
- 'gchown' 'gchroot' 'gcksum' 'gcomm' 'gcp' 'gcsplit' 'gcut' 'gdate'
- 'gdd' 'gdf' 'gdir' 'gdircolors' 'gdirname' 'gdu' 'gecho' 'genv' 'gexpand'
- 'gexpr' 'gfactor' 'gfalse' 'gfmt' 'gfold' 'ggroups' 'ghead' 'ghostid'
- 'gid' 'ginstall' 'gjoin' 'gkill' 'glink' 'gln' 'glogname' 'gls' 'gmd5sum'
- 'gmkdir' 'gmkfifo' 'gmknod' 'gmktemp' 'gmv' 'gnice' 'gnl' 'gnohup' 'gnproc'
- 'god' 'gpaste' 'gpathchk' 'gpinky' 'gpr' 'gprintenv' 'gprintf' 'gptx' 'gpwd'
- 'greadlink' 'grm' 'grmdir' 'gruncon' 'gseq' 'gsha1sum' 'gsha224sum'
- 'gsha256sum' 'gsha384sum' 'gsha512sum' 'gshred' 'gshuf' 'gsleep' 'gsort'
- 'gsplit' 'gstat' 'gstty' 'gsum' 'gsync' 'gtac' 'gtail' 'gtee' 'gtest'
- 'gtimeout' 'gtouch' 'gtr' 'gtrue' 'gtruncate' 'gtsort' 'gtty' 'guname'
- 'gunexpand' 'guniq' 'gunlink' 'guptime' 'gusers' 'gvdir' 'gwc' 'gwho'
- 'gwhoami' 'gyes')
+ # coreutils
+ gcmds=('g[' 'gbase64' 'gbasename' 'gcat' 'gchcon' 'gchgrp' 'gchmod'
+ 'gchown' 'gchroot' 'gcksum' 'gcomm' 'gcp' 'gcsplit' 'gcut' 'gdate'
+ 'gdd' 'gdf' 'gdir' 'gdircolors' 'gdirname' 'gdu' 'gecho' 'genv' 'gexpand'
+ 'gexpr' 'gfactor' 'gfalse' 'gfmt' 'gfold' 'ggroups' 'ghead' 'ghostid'
+ 'gid' 'ginstall' 'gjoin' 'gkill' 'glink' 'gln' 'glogname' 'gls' 'gmd5sum'
+ 'gmkdir' 'gmkfifo' 'gmknod' 'gmktemp' 'gmv' 'gnice' 'gnl' 'gnohup' 'gnproc'
+ 'god' 'gpaste' 'gpathchk' 'gpinky' 'gpr' 'gprintenv' 'gprintf' 'gptx' 'gpwd'
+ 'greadlink' 'grm' 'grmdir' 'gruncon' 'gseq' 'gsha1sum' 'gsha224sum'
+ 'gsha256sum' 'gsha384sum' 'gsha512sum' 'gshred' 'gshuf' 'gsleep' 'gsort'
+ 'gsplit' 'gstat' 'gstty' 'gsum' 'gsync' 'gtac' 'gtail' 'gtee' 'gtest'
+ 'gtimeout' 'gtouch' 'gtr' 'gtrue' 'gtruncate' 'gtsort' 'gtty' 'guname'
+ 'gunexpand' 'guniq' 'gunlink' 'guptime' 'gusers' 'gvdir' 'gwc' 'gwho'
+ 'gwhoami' 'gyes')
- # findutils
- gcmds+=('gfind' 'gxargs' 'glocate')
+ # findutils
+ gcmds+=('gfind' 'gxargs' 'glocate')
- # Not part of either coreutils or findutils, installed separately.
- gcmds+=('gsed' 'gtar' 'gtime')
+ # Not part of either coreutils or findutils, installed separately.
+ gcmds+=('gsed' 'gtar' 'gtime')
- for gcmd in "${gcmds[@]}"; do
- #
- # This method allows for builtin commands to be primary but it's
- # lost if hash -r or rehash -f is executed. Thus, those two
- # functions have to be wrapped.
- #
- (( ${+commands[$gcmd]} )) && hash ${gcmd[2,-1]}=${commands[$gcmd]}
+ for gcmd in "${gcmds[@]}"; do
+ # Do nothing if the command isn't found
+ (( ${+commands[$gcmd]} )) || continue
+
+ # This method allows for builtin commands to be primary but it's
+ # lost if hash -r or rehash -f is executed. Thus, those two
+ # functions have to be wrapped.
+ #
+ hash ${gcmd[2,-1]}=${commands[$gcmd]}
- #
- # This method generates wrapper functions.
- # It will override shell builtins.
- #
- # (( ${+commands[$gcmd]} )) && \
- # eval "function $gcmd[2,-1]() { \"${prefix}/${gcmd//"["/"\\["}\" \"\$@\"; }"
+ # This method generates wrapper functions.
+ # It will override shell builtins.
+ #
+ # eval "function $gcmd[2,-1]() { \"${prefix}/${gcmd//"["/"\\["}\" \"\$@\"; }"
- #
- # This method is inflexible since the aliases are at risk of being
- # overridden resulting in the BSD coreutils being called.
- #
- # (( ${+commands[$gcmd]} )) && \
- # alias "$gcmd[2,-1]"="${prefix}/${gcmd//"["/"\\["}"
- done
+ # This method is inflexible since the aliases are at risk of being
+ # overridden resulting in the BSD coreutils being called.
+ #
+ # alias "$gcmd[2,-1]"="${prefix}/${gcmd//"["/"\\["}"
+ done
- return 0
- }
- __gnu_utils;
+ return 0
+}
+__gnu_utils
- function hash() {
- if [[ "$*" =~ "-(r|f)" ]]; then
- builtin hash "$@"
- __gnu_utils
- else
- builtin hash "$@"
- fi
- }
+function hash() {
+ if [[ "$*" =~ "-(r|f)" ]]; then
+ builtin hash "$@"
+ __gnu_utils
+ else
+ builtin hash "$@"
+ fi
+}
- function rehash() {
- if [[ "$*" =~ "-f" ]]; then
- builtin rehash "$@"
- __gnu_utils
- else
- builtin rehash "$@"
- fi
- }
-fi
+function rehash() {
+ if [[ "$*" =~ "-f" ]]; then
+ builtin rehash "$@"
+ __gnu_utils
+ else
+ builtin rehash "$@"
+ fi
+}
diff --git a/plugins/hitokoto/README.md b/plugins/hitokoto/README.md
new file mode 100644
index 000000000..3a8758f56
--- /dev/null
+++ b/plugins/hitokoto/README.md
@@ -0,0 +1,15 @@
+# hitokoto plugin
+
+Displays a random quote taken from [hitokoto.cn](https://v1.hitokoto.cn/)
+
+Created by [Sinrimin](https://github.com/sinrimin)
+
+## Usage
+
+Add the plugin to the plugins array in your zshrc file and restart zsh:
+
+```zsh
+plugins=(... hitokoto)
+```
+
+Then, run `hitokoto` to get a new random quote.
diff --git a/plugins/hitokoto/hitokoto.plugin.zsh b/plugins/hitokoto/hitokoto.plugin.zsh
new file mode 100644
index 000000000..8646ebf3b
--- /dev/null
+++ b/plugins/hitokoto/hitokoto.plugin.zsh
@@ -0,0 +1,14 @@
+if ! (( $+commands[curl] )); then
+ echo "hitokoto plugin needs curl to work" >&2
+ return
+fi
+
+function hitokoto {
+ emulate -L zsh
+ Q=$(curl -s --connect-timeout 2 "https://v1.hitokoto.cn" | jq -j '.hitokoto+"\t"+.from')
+
+ TXT=$(echo "$Q" | awk -F '\t' '{print $1}')
+ WHO=$(echo "$Q" | awk -F '\t' '{print $2}')
+
+ [[ -n "$WHO" && -n "$TXT" ]] && print -P "%F{3}${WHO}%f: “%F{5}${TXT}%f”"
+}
diff --git a/plugins/ionic/README.md b/plugins/ionic/README.md
new file mode 100644
index 000000000..3ec4fc8b7
--- /dev/null
+++ b/plugins/ionic/README.md
@@ -0,0 +1,30 @@
+# Ionic plugin
+
+This plugin adds completion for the [Ionic CLI](https://ionicframework.com/docs/cli),
+as well as some aliases for common Ionic commands.
+
+To use it, add `ionic` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... ionic)
+```
+
+## Aliases
+
+| Alias | Command | Description |
+|-------|--------------------------------------|------------------------------------------------------------------|
+| iv | `ionic --version` | Check Ionic version |
+| ih | `ionic --help` | Ionic help command |
+| ist | `ionic start` | Create a new project |
+| ii | `ionic info` | Print system/environment info |
+| is | `ionic serve` | Start a local dev server for app dev/testing |
+| icba | `ionic cordova build android` | Build web assets and prepare app for android platform targets |
+| icbi | `ionic cordova build ios` | Build web assets and prepare app for ios platform targets |
+| icra | `ionic cordova run android` | Run an Ionic project on a connected android device |
+| icri | `ionic cordova run ios` | Run an Ionic project on a connected ios device |
+| icrsa | `ionic cordova resources android` | Automatically create icon and splash screen resources for android|
+| icrsi | `ionic cordova resources ios` | Automatically create icon and splash screen resources for ios |
+| icpaa | `ionic cordova platform add android` | Add Cordova android platform targets |
+| icpai | `ionic cordova platform add ios` | Add Cordova ios platform targets |
+| icpra | `ionic cordova platform rm android` | Remove Cordova platform targets |
+| icpri | `ionic cordova platform rm ios` | Remove Cordova platform targets |
diff --git a/plugins/ionic/ionic.plugin.zsh b/plugins/ionic/ionic.plugin.zsh
new file mode 100644
index 000000000..cf388af1b
--- /dev/null
+++ b/plugins/ionic/ionic.plugin.zsh
@@ -0,0 +1,15 @@
+alias iv="ionic --version"
+alias ih="ionic --help"
+alias ist="ionic start"
+alias ii="ionic info"
+alias is="ionic serve"
+alias icba="ionic cordova build android"
+alias icbi="ionic cordova build ios"
+alias icra="ionic cordova run android"
+alias icri="ionic cordova run ios"
+alias icrsa="ionic cordova resources android"
+alias icrsi="ionic cordova resources ios"
+alias icpaa="ionic cordova platform add android"
+alias icpai="ionic cordova platform add ios"
+alias icpra="ionic cordova platform rm android"
+alias icpri="ionic cordova platform rm ios"
diff --git a/plugins/knife/README.md b/plugins/knife/README.md
new file mode 100644
index 000000000..b167f1655
--- /dev/null
+++ b/plugins/knife/README.md
@@ -0,0 +1,25 @@
+# knife plugin
+
+This plugin adds completion for [knife](https://docs.chef.io/knife.html), a command-line tool
+to interact with [Chef](https://chef.io), a platform to automate and manage infrastructure via
+code.
+
+To use it, add `knife` to the plugins array in your zshrc file:
+```zsh
+plugins=(... knife)
+```
+
+## Options
+
+- `KNIFE_RELATIVE_PATH`: if set to `true`, the completion script will look for local cookbooks
+ under the `cookbooks` folder in the chef root directory. It has preference over the other two
+ options below. **Default:** empty.
+
+- `KNIFE_COOKBOOK_PATH`: if set, it points to the folder that contains local cookbooks, for
+ example: `/path/to/my/chef/cookbooks`. **Default:** `cookbook_path` field in `knife.rb`
+ (see below).
+
+- `KNIFE_CONF_PATH`: variable pointing to the `knife.rb` configuration file, for example
+ `/path/to/my/.chef/knife.rb`. Only used if `$KNIFE_COOKBOOK_PATH` isn't set. If it exists,
+ `$PWD/.chef/knife.rb` is used instead. Otherwise, if it's set, its value is used.
+ **Default**: `$HOME/.chef/knife.rb`.
diff --git a/plugins/knife/_knife b/plugins/knife/_knife
index 0d61ff15c..06b12a3b0 100644
--- a/plugins/knife/_knife
+++ b/plugins/knife/_knife
@@ -3,13 +3,13 @@
# You can override the path to knife.rb and your cookbooks by setting
# KNIFE_CONF_PATH=/path/to/my/.chef/knife.rb
# KNIFE_COOKBOOK_PATH=/path/to/my/chef/cookbooks
-# If you want your local cookbooks path to be calculated relative to where you are then
+# If you want your local cookbooks path to be calculated relative to where you are then
# set the below option
-# KNIFE_RELATIVE_PATH=true
+# KNIFE_RELATIVE_PATH=true
# Read around where these are used for more detail.
# These flags should be available everywhere according to man knife
-knife_general_flags=( --help --server-url --key --config --editor --format --log_level --logfile --no-editor --user --print-after --version --yes )
+knife_general_flags=(--help --server-url --key --config --editor --format --log_level --logfile --no-editor --user --print-after --version --yes)
# knife has a very special syntax, some example calls are:
# knife status
@@ -25,183 +25,191 @@ _knife() {
typeset -A opt_args
cloudproviders=(bluebox ec2 rackspace slicehost terremark)
_arguments \
- '1: :->knifecmd'\
- '2: :->knifesubcmd'\
+ '1: :->knifecmd' \
+ '2: :->knifesubcmd' \
'3: :->knifesubcmd2' \
'4: :->knifesubcmd3' \
'5: :->knifesubcmd4' \
'6: :->knifesubcmd5'
-
+
case $state in
knifecmd)
compadd -Q "$@" bootstrap client configure cookbook "cookbook site" "data bag" diff exec environment index node recipe role search ssh status upload vault windows $cloudproviders
- ;;
+ ;;
knifesubcmd)
case $words[2] in
- (bluebox|ec2|rackspace|slicehost|terremark)
+ bluebox|ec2|rackspace|slicehost|terremark)
compadd "$@" server images
- ;;
+ ;;
client)
compadd -Q "$@" "bulk delete" list create show delete edit reregister
- ;;
+ ;;
configure)
compadd "$@" client
- ;;
+ ;;
cookbook)
compadd -Q "$@" test list create download delete "metadata from" show "bulk delete" metadata upload
- ;;
+ ;;
diff)
_arguments '*:file or directory:_files -g "*"'
- ;;
+ ;;
environment)
compadd -Q "$@" list create delete edit show "from file"
- ;;
+ ;;
node)
- compadd -Q "$@" "from file" create show edit delete list run_list "bulk delete"
- ;;
+ compadd -Q "$@" "from file" create show edit delete list run_list "bulk delete"
+ ;;
recipe)
- compadd "$@" list
- ;;
+ compadd "$@" list
+ ;;
role)
compadd -Q "$@" "bulk delete" create delete edit "from file" list show
- ;;
+ ;;
upload)
- _arguments '*:file or directory:_files -g "*"'
- ;;
+ _arguments '*:file or directory:_files -g "*"'
+ ;;
vault)
compadd -Q "$@" create decrypt delete edit remove "rotate all keys" "rotate keys" show update
- ;;
+ ;;
windows)
compadd "$@" bootstrap
- ;;
+ ;;
*)
- _arguments '2:Subsubcommands:($(_knife_options1))'
+ _arguments '2:Subsubcommands:($(_knife_options1))'
+ ;;
esac
- ;;
- knifesubcmd2)
+ ;;
+ knifesubcmd2)
case $words[3] in
- server)
+ server)
compadd "$@" list create delete
- ;;
- images)
+ ;;
+ images)
compadd "$@" list
- ;;
- site)
+ ;;
+ site)
compadd "$@" vendor show share search download list unshare
- ;;
- (show|delete|edit)
- _arguments '3:Subsubcommands:($(_chef_$words[2]s_remote))'
- ;;
- (upload|test)
- _arguments '3:Subsubcommands:($(_chef_$words[2]s_local) --all)'
- ;;
+ ;;
+ show|delete|edit)
+ _arguments '3:Subsubcommands:($(_chef_$words[2]s_remote))'
+ ;;
+ upload|test)
+ _arguments '3:Subsubcommands:($(_chef_$words[2]s_local) --all)'
+ ;;
list)
- compadd -a "$@" knife_general_flags
- ;;
+ compadd -a "$@" knife_general_flags
+ ;;
bag)
compadd -Q "$@" show edit list "from file" create delete
- ;;
+ ;;
*)
_arguments '3:Subsubcommands:($(_knife_options2))'
+ ;;
esac
- ;;
- knifesubcmd3)
- case $words[3] in
- show)
- case $words[2] in
- cookbook)
- versioncomp=1
- _arguments '4:Cookbookversions:($(_cookbook_versions) latest)'
- ;;
- (node|client|role)
- compadd "$@" --attribute
- esac
- esac
- case $words[4] in
- (show|edit)
- _arguments '4:Subsubsubcommands:($(_chef_$words[2]_$words[3]s_remote))'
;;
- file)
+ knifesubcmd3)
+ case $words[3] in
+ show)
+ case $words[2] in
+ cookbook)
+ versioncomp=1
+ _arguments '4:Cookbookversions:($(_cookbook_versions) latest)'
+ ;;
+ node|client|role)
+ compadd "$@" --attribute
+ ;;
+ esac
+ ;;
+ esac
+ case $words[4] in
+ show|edit)
+ _arguments '4:Subsubsubcommands:($(_chef_$words[2]_$words[3]s_remote))'
+ ;;
+ file)
case $words[2] in
environment)
_arguments '*:files:_path_files -g "*.(rb|json)" -W "$(_chef_root)/environments"'
- ;;
+ ;;
node)
_arguments '*:files:_path_files -g "*.(rb|json)" -W "$(_chef_root)/nodes"'
- ;;
+ ;;
role)
_arguments '*:files:_path_files -g "*.(rb|json)" -W "$(_chef_root)/roles"'
- ;;
+ ;;
*)
_arguments '*:Subsubcommands:($(_knife_options3))'
- esac
- ;;
- list)
- compadd -a "$@" knife_general_flags
- ;;
- *)
- _arguments '*:Subsubcommands:($(_knife_options3))'
- esac
- ;;
- knifesubcmd4)
- if (( versioncomp > 0 )); then
- compadd "$@" attributes definitions files libraries providers recipes resources templates
- else
- case $words[5] in
- file)
- _arguments '*:directory:_path_files -/ -W "$(_chef_root)/data_bags" -qS \ '
;;
- *) _arguments '*:Subsubcommands:($(_knife_options2))'
esac
- fi
- ;;
- knifesubcmd5)
- case $words[5] in
- file)
- _arguments '*:files:_path_files -g "*.json" -W "$(_chef_root)/data_bags/$words[6]"'
+ ;;
+ list)
+ compadd -a "$@" knife_general_flags
+ ;;
+ *)
+ _arguments '*:Subsubcommands:($(_knife_options3))'
+ ;;
+ esac
+ ;;
+ knifesubcmd4)
+ if ((versioncomp > 0)); then
+ compadd "$@" attributes definitions files libraries providers recipes resources templates
+ else
+ case $words[5] in
+ file)
+ _arguments '*:directory:_path_files -/ -W "$(_chef_root)/data_bags" -qS \ '
;;
- *)
- _arguments '*:Subsubcommands:($(_knife_options3))'
+ *) _arguments '*:Subsubcommands:($(_knife_options2))' ;;
esac
- esac
+ fi
+ ;;
+ knifesubcmd5)
+ case $words[5] in
+ file)
+ _arguments '*:files:_path_files -g "*.json" -W "$(_chef_root)/data_bags/$words[6]"'
+ ;;
+ *)
+ _arguments '*:Subsubcommands:($(_knife_options3))'
+ ;;
+ esac
+ ;;
+ esac
}
# Helper functions to provide the argument completion for several depths of commands
_knife_options1() {
- ( for line in $( knife $words[2] --help | grep -v "^knife" ); do echo $line | grep "\-\-"; done )
+ (for line in $(knife $words[2] --help | grep -v "^knife"); do echo $line | grep "\-\-"; done)
}
_knife_options2() {
- ( for line in $( knife $words[2] $words[3] --help | grep -v "^knife" ); do echo $line | grep "\-\-"; done )
+ (for line in $(knife $words[2] $words[3] --help | grep -v "^knife"); do echo $line | grep "\-\-"; done)
}
_knife_options3() {
- ( for line in $( knife $words[2] $words[3] $words[4] --help | grep -v "^knife" ); do echo $line | grep "\-\-"; done )
+ (for line in $(knife $words[2] $words[3] $words[4] --help | grep -v "^knife"); do echo $line | grep "\-\-"; done)
}
# The chef_x_remote functions use knife to get a list of objects of type x on the server
_chef_roles_remote() {
- (knife role list --format json | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
+ (knife role list --format json | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
}
_chef_clients_remote() {
- (knife client list --format json | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
+ (knife client list --format json | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
}
_chef_nodes_remote() {
- (knife node list --format json | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
+ (knife node list --format json | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
}
_chef_cookbooks_remote() {
- (knife cookbook list --format json | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
+ (knife cookbook list --format json | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
}
_chef_sitecookbooks_remote() {
- (knife cookbook site list --format json | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
+ (knife cookbook site list --format json | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
}
_chef_data_bags_remote() {
- (knife data bag list --format json | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
+ (knife data bag list --format json | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
}
_chef_environments_remote() {
@@ -210,14 +218,14 @@ _chef_environments_remote() {
# The chef_x_local functions use the knife config to find the paths of relevant objects x to be uploaded to the server
_chef_cookbooks_local() {
- if [ $KNIFE_RELATIVE_PATH ]; then
+ if [ $KNIFE_RELATIVE_PATH ]; then
local cookbook_path="$(_chef_root)/cookbooks"
- else
+ else
local knife_rb=${KNIFE_CONF_PATH:-${HOME}/.chef/knife.rb}
if [ -f ./.chef/knife.rb ]; then
knife_rb="./.chef/knife.rb"
fi
- local cookbook_path=${KNIFE_COOKBOOK_PATH:-$(grep cookbook_path $knife_rb | awk 'BEGIN {FS = "[" }; {print $2}' | sed 's/\,//g' | sed "s/'//g" | sed 's/\(.*\)]/\1/' )}
+ local cookbook_path=${KNIFE_COOKBOOK_PATH:-$(grep cookbook_path $knife_rb | awk 'BEGIN {FS = "[" }; {print $2}' | sed 's/\,//g' | sed "s/'//g" | sed 's/\(.*\)]/\1/')}
fi
(for i in $cookbook_path; do ls $i; done)
}
@@ -227,12 +235,11 @@ _cookbook_versions() {
(knife cookbook show $words[4] | grep -v $words[4] | grep -v -E '\]|\[|\{|\}' | sed 's/ //g' | sed 's/"//g')
}
-# Searches up from current directory to find the closest folder that has a .chef folder
-# Useful for the knife upload/from file commands
-_chef_root () {
+# Searches up from current directory to find the closest folder that has a .chef folder
+# Useful for the knife upload/from file commands
+_chef_root() {
directory="$PWD"
- while [ $directory != '/' ]
- do
+ while [ $directory != '/' ]; do
test -e "$directory/.chef" && echo "$directory" && return
directory="${directory:h}"
done
diff --git a/plugins/knife_ssh/README.md b/plugins/knife_ssh/README.md
new file mode 100644
index 000000000..cb836b7f3
--- /dev/null
+++ b/plugins/knife_ssh/README.md
@@ -0,0 +1,14 @@
+# knife_ssh plugin
+
+This plugin adds a `knife_ssh` function as well as completion for it, to allow
+connecting via ssh to servers managed with [Chef](https://www.chef.io/).
+
+To use it, add `knife_ssh` to the plugins array in your zshrc file:
+```zsh
+plugins=(... knife_ssh)
+```
+
+The plugin creates a cache of the Chef node list via `knife`, and stores it
+in `$HOME/.knife_comp~`, when first triggering knife_ssh completion.
+
+**Requirements:** `knife` has to be installed.
diff --git a/plugins/knife_ssh/knife_ssh.plugin.zsh b/plugins/knife_ssh/knife_ssh.plugin.zsh
index 7fdd42a1e..dc425a33e 100644
--- a/plugins/knife_ssh/knife_ssh.plugin.zsh
+++ b/plugins/knife_ssh/knife_ssh.plugin.zsh
@@ -1,17 +1,17 @@
function knife_ssh() {
- grep -q $1 ~/.knife_comp~ 2> /dev/null || rm -f ~/.knife_comp~;
+ grep -q $1 ~/.knife_comp~ 2> /dev/null || rm -f ~/.knife_comp~
ssh $(knife node show $1 | awk '/IP:/{print $2}')
}
_knife_ssh() {
if hash knife 2>/dev/null; then
if [[ ! -f ~/.knife_comp~ ]]; then
- echo "\nGenerating ~/.knife_comp~..." >/dev/stderr
+ echo "\nGenerating ~/.knife_comp~..." >&2
knife node list > ~/.knife_comp~
fi
- compadd $(<~/.knife_comp~)
+ compadd $(< ~/.knife_comp~)
else
- echo "Could not find knife" > /dev/stderr;
+ echo "Could not find knife" >&2
fi
}
diff --git a/plugins/kubectl/kubectl.plugin.zsh b/plugins/kubectl/kubectl.plugin.zsh
index 6c1696d5e..cc447b87e 100644
--- a/plugins/kubectl/kubectl.plugin.zsh
+++ b/plugins/kubectl/kubectl.plugin.zsh
@@ -37,6 +37,7 @@ alias kdelf='kubectl delete -f'
# Pod management.
alias kgp='kubectl get pods'
+alias kgpa='kubectl get pods --all-namespaces'
alias kgpw='kgp --watch'
alias kgpwide='kgp -o wide'
alias kep='kubectl edit pods'
@@ -48,6 +49,7 @@ alias kgpl='kgp -l'
# Service management.
alias kgs='kubectl get svc'
+alias kgsa='kubectl get svc --all-namespaces'
alias kgsw='kgs --watch'
alias kgswide='kgs -o wide'
alias kes='kubectl edit svc'
@@ -56,6 +58,7 @@ alias kdels='kubectl delete svc'
# Ingress management
alias kgi='kubectl get ingress'
+alias kgia='kubectl get ingress --all-namespaces'
alias kei='kubectl edit ingress'
alias kdi='kubectl describe ingress'
alias kdeli='kubectl delete ingress'
@@ -69,17 +72,20 @@ alias kcn='kubectl config set-context $(kubectl config current-context) --namesp
# ConfigMap management
alias kgcm='kubectl get configmaps'
+alias kgcma='kubectl get configmaps --all-namespaces'
alias kecm='kubectl edit configmap'
alias kdcm='kubectl describe configmap'
alias kdelcm='kubectl delete configmap'
# Secret management
alias kgsec='kubectl get secret'
+alias kgseca='kubectl get secret --all-namespaces'
alias kdsec='kubectl describe secret'
alias kdelsec='kubectl delete secret'
# Deployment management.
alias kgd='kubectl get deployment'
+alias kgda='kubectl get deployment --all-namespaces'
alias kgdw='kgd --watch'
alias kgdwide='kgd -o wide'
alias ked='kubectl edit deployment'
@@ -98,6 +104,7 @@ alias kru='kubectl rollout undo'
# Statefulset management.
alias kgss='kubectl get statefulset'
+alias kgssa='kubectl get statefulset --all-namespaces'
alias kgssw='kgss --watch'
alias kgsswide='kgss -o wide'
alias kess='kubectl edit statefulset'
@@ -115,7 +122,13 @@ alias kgaa='kubectl get all --all-namespaces'
# Logs
alias kl='kubectl logs'
+alias kl1h='kubectl logs --since 1h'
+alias kl1m='kubectl logs --since 1m'
+alias kl1s='kubectl logs --since 1s'
alias klf='kubectl logs -f'
+alias klf1h='kubectl logs --since 1h -f'
+alias klf1m='kubectl logs --since 1m -f'
+alias klf1s='kubectl logs --since 1s -f'
# File copy
alias kcp='kubectl cp'
@@ -128,6 +141,7 @@ alias kdelno='kubectl delete node'
# PVC management.
alias kgpvc='kubectl get pvc'
+alias kgpvca='kubectl get pvc --all-namespaces'
alias kgpvcw='kgpvc --watch'
alias kepvc='kubectl edit pvc'
alias kdpvc='kubectl describe pvc'
diff --git a/plugins/laravel/README.md b/plugins/laravel/README.md
index 44798b68d..95f590191 100644
--- a/plugins/laravel/README.md
+++ b/plugins/laravel/README.md
@@ -29,6 +29,12 @@ plugins=(... laravel)
| `pamc` | `php artisan make:controller` |
| `pams` | `php artisan make:seeder` |
| `pamt` | `php artisan make:test` |
+| `pamfa` | `php artisan make:factory` |
+| `pamp` | `php artisan make:policy` |
+| `pame` | `php artisan make:event` |
+| `pamj` | `php artisan make:job` |
+| `paml` | `php artisan make:listener` |
+| `pamn` | `php artisan make:notification` |
## Clears
@@ -38,3 +44,14 @@ plugins=(... laravel)
| `pacoc` | `php artisan config:clear` |
| `pavic` | `php artisan view:clear` |
| `paroc` | `php artisan route:clear` |
+
+## Queues
+
+| Alias | Description |
+|:-:|:-:|
+| `paqf` | `php artisan queue:failed` |
+| `paqft` | `php artisan queue:failed-table` |
+| `paql` | `php artisan queue:listen` |
+| `paqr` | `php artisan queue:retry` |
+| `paqt` | `php artisan queue:table` |
+| `paqw` | `php artisan queue:work` |
diff --git a/plugins/laravel/laravel.plugin.zsh b/plugins/laravel/laravel.plugin.zsh
index 7ddfd85ba..a8382d3c9 100644
--- a/plugins/laravel/laravel.plugin.zsh
+++ b/plugins/laravel/laravel.plugin.zsh
@@ -17,6 +17,13 @@ alias pamm='php artisan make:model'
alias pamc='php artisan make:controller'
alias pams='php artisan make:seeder'
alias pamt='php artisan make:test'
+alias pamfa='php artisan make:factory'
+alias pamp='php artisan make:policy'
+alias pame='php artisan make:event'
+alias pamj='php artisan make:job'
+alias paml='php artisan make:listener'
+alias pamn='php artisan make:notification'
+alias pampp='php artisan make:provider'
# Clears
@@ -24,3 +31,11 @@ alias pacac='php artisan cache:clear'
alias pacoc='php artisan config:clear'
alias pavic='php artisan view:clear'
alias paroc='php artisan route:clear'
+
+# queues
+alias paqf='php artisan queue:failed'
+alias paqft='php artisan queue:failed-table'
+alias paql='php artisan queue:listen'
+alias paqr='php artisan queue:retry'
+alias paqt='php artisan queue:table'
+alias paqw='php artisan queue:work'
diff --git a/plugins/magic-enter/Readme.md b/plugins/magic-enter/README.md
index 78514c67d..78514c67d 100644
--- a/plugins/magic-enter/Readme.md
+++ b/plugins/magic-enter/README.md
diff --git a/plugins/microk8s/README.md b/plugins/microk8s/README.md
new file mode 100644
index 000000000..2b4ea206f
--- /dev/null
+++ b/plugins/microk8s/README.md
@@ -0,0 +1,24 @@
+# MicroK8s plugin
+
+This plugin provides completion and useful aliases for [MicroK8s](https://microk8s.io/).
+
+To use it, add `microk8s` to the plugins array in your zshrc file.
+
+```zsh
+plugins=(... microk8s)
+```
+
+## Aliases
+
+| Alias | Command | Description |
+|-------|------------------|----------------------------------------------------------------------------------------------------------|
+| mco | microk8s.config | Shows the Kubernetes config file. |
+| mct | microk8s.ctr | Interact with containerd CLI. |
+| mdi | microk8s.disable | Disables an addon. |
+| me | microk8s.enable | Enables an addon. |
+| mh | microk8s.helm | Interact with Helm CLI. |
+| mis | microk8s.istio | Interact with Istio CLI. |
+| mk | microk8s.kubectl | Interact with Kubernetes CLI. |
+| msp | microk8s.stop | Stops all Kubernetes services. |
+| mst | microk8s.start | Starts MicroK8s after it is being stopped. |
+| msts | microk8s.status | Provides an overview of the MicroK8s state (running / not running) as well as the set of enabled addons. | \ No newline at end of file
diff --git a/plugins/microk8s/microk8s.plugin.zsh b/plugins/microk8s/microk8s.plugin.zsh
new file mode 100644
index 000000000..048a9ab83
--- /dev/null
+++ b/plugins/microk8s/microk8s.plugin.zsh
@@ -0,0 +1,82 @@
+# ---------------------------------------------------------- #
+# Aliases and Completions for MicroK8s (https://microk8s.io) #
+# Author: Shaun Tabone (https://github.com/xontab) #
+# ---------------------------------------------------------- #
+
+# Helper function to cache and load completions
+_microk8s_cache_completion() {
+ local cache="${ZSH_CACHE_DIR}/microk8s_$(echo $1)_completion"
+ if [[ ! -f $cache ]]; then
+ $2 $cache
+ fi
+
+ [[ -f $cache ]] && source $cache
+}
+
+# ---------------------------------------------------------- #
+# microk8s.enable #
+# ALIAS: me #
+# ---------------------------------------------------------- #
+_microk8s_enable_get_command_list() {
+ microk8s.enable --help | tail -n +7 | awk '{$1=$1;print}'
+}
+
+_microk8s_enable() {
+ compadd -X "MicroK8s Addons" $(_microk8s_enable_get_command_list)
+}
+
+compdef _microk8s_enable microk8s.enable
+alias me='microk8s.enable'
+
+# ---------------------------------------------------------- #
+# microk8s.disable #
+# ALIAS: mdi #
+# ---------------------------------------------------------- #
+_microk8s_disable_get_command_list() {
+ microk8s.disable --help | tail -n +7 | awk '{$1=$1;print}'
+}
+
+_microk8s_disable() {
+ compadd -X "MicroK8s Addons" $(_microk8s_disable_get_command_list)
+}
+
+compdef _microk8s_disable microk8s.disable
+alias mdi='microk8s.disable'
+
+# ---------------------------------------------------------- #
+# microk8s.kubectl #
+# ALIAS: mk #
+# ---------------------------------------------------------- #
+_microk8s_kubectl_completion() {
+ if [ $commands[microk8s.kubectl] ]; then
+ microk8s.kubectl 2>/dev/null >/dev/null && microk8s.kubectl completion zsh | sed 's/__start_kubectl kubectl/__start_kubectl microk8s.kubectl/g' >$1
+ fi
+}
+
+_microk8s_cache_completion 'kubectl' _microk8s_kubectl_completion
+
+alias mk='microk8s.kubectl'
+
+# ---------------------------------------------------------- #
+# microk8s.helm #
+# ALIAS: mh #
+# ---------------------------------------------------------- #
+_microk8s_helm_completion() {
+ if [ $commands[microk8s.helm] ]; then
+ microk8s.helm completion zsh | sed 's/__start_helm helm/__start_helm microk8s.helm/g' >$1
+ fi
+}
+
+_microk8s_cache_completion 'helm' _microk8s_helm_completion
+
+alias mh='microk8s.helm'
+
+# ---------------------------------------------------------- #
+# Other Aliases #
+# ---------------------------------------------------------- #
+alias mco='microk8s.config'
+alias mct='microk8s.ctr'
+alias mis='microk8s.istio'
+alias mst='microk8s.start'
+alias msts='microk8s.status'
+alias msp='microk8s.stop'
diff --git a/plugins/osx/spotify b/plugins/osx/spotify
index 78d6c7d0f..663215a74 100644
--- a/plugins/osx/spotify
+++ b/plugins/osx/spotify
@@ -148,11 +148,11 @@ if [ $# = 0 ]; then
else
if [ ! -d /Applications/Spotify.app ] && [ ! -d $HOME/Applications/Spotify.app ]; then
echo "The Spotify application must be installed."
- exit 1
+ return 1
fi
if [ $(osascript -e 'application "Spotify" is running') = "false" ]; then
- osascript -e 'tell application "Spotify" to activate' || exit 1
+ osascript -e 'tell application "Spotify" to activate' || return 1
sleep 2
fi
fi
@@ -170,12 +170,12 @@ while [ $# -gt 0 ]; do
if [ -z "${CLIENT_ID}" ]; then
cecho "Invalid Client ID, please update ${USER_CONFIG_FILE}";
showAPIHelp;
- exit 1;
+ return 1
fi
if [ -z "${CLIENT_SECRET}" ]; then
cecho "Invalid Client Secret, please update ${USER_CONFIG_FILE}";
showAPIHelp;
- exit 1;
+ return 1
fi
SHPOTIFY_CREDENTIALS=$(printf "${CLIENT_ID}:${CLIENT_SECRET}" | base64 | tr -d "\n"|tr -d '\r');
SPOTIFY_PLAY_URI="";
@@ -194,7 +194,7 @@ while [ $# -gt 0 ]; do
cecho "Autorization failed, please check ${USER_CONFG_FILE}"
cecho "${SPOTIFY_TOKEN_RESPONSE_DATA}"
showAPIHelp
- exit 1
+ return 1
fi
SPOTIFY_ACCESS_TOKEN=$( \
printf "${SPOTIFY_TOKEN_RESPONSE_DATA}" \
@@ -307,7 +307,7 @@ while [ $# -gt 0 ]; do
"quit" ) cecho "Quitting Spotify.";
osascript -e 'tell application "Spotify" to quit';
- exit 0 ;;
+ break ;;
"next" ) cecho "Going to next track." ;
osascript -e 'tell application "Spotify" to next track';
@@ -358,7 +358,7 @@ while [ $# -gt 0 ]; do
echo " vol down # Decreases the volume by 10%.";
echo " vol [amount] # Sets the volume to an amount between 0 and 100.";
echo " vol # Shows the current Spotify volume.";
- exit 1;
+ return 1
fi
osascript -e "tell application \"Spotify\" to set sound volume to $newvol";
@@ -468,9 +468,10 @@ while [ $# -gt 0 ]; do
"help" )
showHelp;
break ;;
+
* )
showHelp;
- break;
+ return 1 ;;
esac
done
diff --git a/plugins/otp/README.md b/plugins/otp/README.md
new file mode 100644
index 000000000..8331fd02b
--- /dev/null
+++ b/plugins/otp/README.md
@@ -0,0 +1,22 @@
+# otp plugin
+
+This plugin allows you to create one-time passwords using [`oathtool`](https://www.nongnu.org/oath-toolkit/man-oathtool.html),
+able to replace MFA devices. The oathtool key is kept in a GPG-encrypted file so the codes
+can only be generated by a user able to decrypt it.
+
+To use it, add `otp` to the plugins array in your zshrc file:
+```zsh
+plugins=(... otp)
+```
+
+Provided aliases:
+
+- `otp_add_device`: creates a new encrypted storage for an oathtool key and stores it
+ on the disk. For encrypting the key, it will ask for a GPG user ID (your GPG key's
+ email address). Then the OTP key needs to be pasted, followed by a CTRL+D character
+ inserted on an empty line.
+
+- `ot`: generates a MFA code based on the given key and copies it to the clipboard
+ (on Linux it relies on xsel, on MacOS X it uses pbcopy instead).
+
+The plugin uses `$HOME/.otp` to store its internal files.
diff --git a/plugins/otp/otp.plugin.zsh b/plugins/otp/otp.plugin.zsh
index 4bce34fd3..8be125c93 100644
--- a/plugins/otp/otp.plugin.zsh
+++ b/plugins/otp/otp.plugin.zsh
@@ -12,32 +12,23 @@ function ot () {
return 1
fi
- if [[ `uname` == 'Darwin' ]] then # MacOS X
- export COPY_CMD='pbcopy'
- elif command -v xsel > /dev/null 2>&1; then # Any Unix with xsel installed
- export COPY_CMD='xsel --clipboard --input'
- else
- COPY_CMD='true'
- fi
+ COPY_CMD='true'
- if [[ "x$1" == "x" ]]; then
- echo "usage: otpw <profile.name>"
+ if [[ -z "$1" ]]; then
+ echo "usage: $0 <profile.name>"
return 1
elif [ ! -f $OTP_HOME/$1.otp.asc ]; then
echo "missing profile $1, you might need to create it first using otp_add_device"
return 1
else
totpkey=$(gpg --decrypt $OTP_HOME/$1.otp.asc)
- oathtool --totp --b $totpkey | tee /dev/stderr | `echo $COPY_CMD`
- if [[ $COPY_CMD == 'true' ]] then
- echo "Note: you might consider installing xsel for clipboard integration"
- fi
+ oathtool --totp --b $totpkey | tee /dev/stderr | clipcopy
fi
}
function otp_add_device () {
if [[ "x$1" == "x" ]] then
- echo "usage: otp_add <profile.name>"
+ echo "usage: $0 <profile.name>"
return 1
else
echo "Enter an email address attached to your GPG private key, then paste the secret configuration key followed by ^D"
diff --git a/plugins/paver/README.md b/plugins/paver/README.md
new file mode 100644
index 000000000..c38d898ba
--- /dev/null
+++ b/plugins/paver/README.md
@@ -0,0 +1,12 @@
+# Paver
+
+This plugin adds completion for the `paver` command-line tool of [Paver](https://pythonhosted.org/Paver/).
+
+To use it, add `paver` to the plugins array of your zshrc file:
+```zsh
+plugins=(... paver)
+```
+
+The completion function creates a cache of paver tasks with the name `.paver_tasks`,
+in the current working directory. It regenerates that cache when the `pavement.py`
+changes.
diff --git a/plugins/paver/paver.plugin.zsh b/plugins/paver/paver.plugin.zsh
index 40bdbd12f..7e70ea37c 100644
--- a/plugins/paver/paver.plugin.zsh
+++ b/plugins/paver/paver.plugin.zsh
@@ -1,7 +1,7 @@
_paver_does_target_list_need_generating () {
- [ ! -f .paver_targets ] && return 0;
- [ pavement.py -nt .paver_targets ] && return 0;
- return 1;
+ [ ! -f .paver_targets ] && return 0
+ [ pavement.py -nt .paver_targets ] && return 0
+ return 1
}
_paver () {
diff --git a/plugins/rbfu/README.md b/plugins/rbfu/README.md
new file mode 100644
index 000000000..f1f9fa2f7
--- /dev/null
+++ b/plugins/rbfu/README.md
@@ -0,0 +1,17 @@
+# rbfu plugin
+
+This plugin starts [rbfu](https://github.com/hmans/rbfu), a minimal Ruby version
+manager, and adds some useful functions.
+
+To use it, add `rbfu` to the plugins array in your zshrc file:
+```zsh
+plugins=(... rbfu)
+```
+
+**Note: `rbfu` is deprecated and should no longer be used.**
+
+## Functions
+
+- `rbfu-rubies`: lists all installed rubies available to rbfu.
+
+- `rvm_prompt_info`: shows the Ruby version being used with rbfu.
diff --git a/plugins/repo/repo.plugin.zsh b/plugins/repo/repo.plugin.zsh
index 33f4195c7..51cd32fc4 100644
--- a/plugins/repo/repo.plugin.zsh
+++ b/plugins/repo/repo.plugin.zsh
@@ -16,3 +16,15 @@ compdef _repo ru='repo upload'
alias rst='repo status'
compdef _repo rst='repo status'
+
+alias rsto='repo status -o'
+compdef _repo rsto='repo status -o'
+
+alias rfa='repo forall -c'
+compdef _repo rfa='repo forall -c'
+
+alias rfap='repo forall -p -c'
+compdef _repo rfap='repo forall -p -c'
+
+alias rinf='repo info'
+compdef _repo rinf='repo info'
diff --git a/plugins/ros/README.mkd b/plugins/ros/README.md
index 83573e499..83573e499 100644
--- a/plugins/ros/README.mkd
+++ b/plugins/ros/README.md
diff --git a/plugins/sfffe/README.md b/plugins/sfffe/README.md
new file mode 100644
index 000000000..29044e85b
--- /dev/null
+++ b/plugins/sfffe/README.md
@@ -0,0 +1,17 @@
+# "Search files for Front-End"
+
+This plugin adds a few functions for searching files used in Front-End web development.
+
+To use it, add `sfffe` to the plugins array in your zshrc file:
+```zsh
+plugins=(... sfffe)
+```
+
+**Requires:** `ack`
+
+## Functions
+
+- `ajs`: look for string in `.js` files.
+- `acss`: look for string in `.css` files.
+- `fjs`: search for `.js` files under the current working directory.
+- `fcss`: search for `.css` files under the current working directory.
diff --git a/plugins/svn-fast-info/README.md b/plugins/svn-fast-info/README.md
new file mode 100644
index 000000000..04c596fd8
--- /dev/null
+++ b/plugins/svn-fast-info/README.md
@@ -0,0 +1,55 @@
+# svn-fast-info plugin
+
+Faster alternative to the main SVN plugin implementation. Works with svn 1.6 and newer.
+Use as a drop-in replacement to the svn plugin, not as complementary.
+
+To use it, add `svn-fast-info` to the plugins array in your zshrc file:
+```zsh
+plugins=(... svn-fast-info)
+```
+
+It's faster because his efficient use of svn (single svn call) which saves a lot on a huge codebase
+It displays the current status of the local files (added, deleted, modified, replaced, or else...)
+
+Use `svn_prompt_info` method to display the svn repository status in your theme.
+
+## Functions
+
+- `svn_prompt_info`: displays all the available information regarding the status of the svn repository.
+
+- `svn_repo_need_upgrade`: shows whether the repository needs upgrading. `svn_prompt_info` queries the
+ rest of functions or not based on the result of this function.
+
+- `svn_current_branch_name`: shows the current branch.
+
+- `svn_repo_root_name`: displays the repository root.
+
+- `svn_current_revision`: shows the currently checked-out revision.
+
+- `svn_status_info`: shows a bunch of symbols depending on the status of the files in the repository.
+
+## Options
+
+- `ZSH_THEME_SVN_PROMPT_PREFIX`: sequence displayed at the beginning of the prompt info output.
+
+- `ZSH_THEME_SVN_PROMPT_SUFFIX`: sequence displayed at the end of the prompt info output.
+
+- `ZSH_THEME_SVN_PROMPT_CLEAN`: sequence displayed when the status of the repository is clean.
+
+- `ZSH_THEME_SVN_PROMPT_ADDITIONS`: sequence displayed if there are added files in the repository.
+ **Default:** `+`.
+
+- `ZSH_THEME_SVN_PROMPT_DELETIONS`: sequence displayed if there are deleted files in the repository.
+ **Default:** `✖`.
+
+- `ZSH_THEME_SVN_PROMPT_MODIFICATIONS`: sequence displayed if there are modified files in the repository.
+ **Default:** `✎`.
+
+- `ZSH_THEME_SVN_PROMPT_REPLACEMENTS`: sequence displayed if there are replaced files in the repository.
+ **Default:** `∿`.
+
+- `ZSH_THEME_SVN_PROMPT_UNTRACKED`: sequence displayed if there are untracked files in the repository.
+ **Default:** `?`.
+
+- `ZSH_THEME_SVN_PROMPT_DIRTY`: sequence displayed if the repository is dirty.
+ **Default:** `!`.
diff --git a/plugins/svn-fast-info/svn-fast-info.plugin.zsh b/plugins/svn-fast-info/svn-fast-info.plugin.zsh
index fe5265315..f40a59685 100644
--- a/plugins/svn-fast-info/svn-fast-info.plugin.zsh
+++ b/plugins/svn-fast-info/svn-fast-info.plugin.zsh
@@ -1,17 +1,6 @@
-# vim:ft=zsh ts=2 sw=2 sts=2 et
-#
-# Faster alternative to the current SVN plugin implementation.
-#
-# Works with svn 1.6, 1.7, 1.8.
-# Use `svn_prompt_info` method to enquire the svn data.
-# It's faster because his efficient use of svn (single svn call) which saves a lot on a huge codebase
-# It displays the current status of the local files (added, deleted, modified, replaced, or else...)
-#
-# Use as a drop-in replacement of the svn plugin not as complementary plugin
-
function svn_prompt_info() {
local info
- info=$(svn info 2>&1) || return 1; # capture stdout and stderr
+ info=$(svn info 2>&1) || return 1 # capture stdout and stderr
local repo_need_upgrade=$(svn_repo_need_upgrade $info)
if [[ -n $repo_need_upgrade ]]; then
@@ -27,7 +16,6 @@ function svn_prompt_info() {
printf '%s%s%s%s %s%s%s:%s%s%s%s' \
"$ZSH_PROMPT_BASE_COLOR" \
"$ZSH_THEME_SVN_PROMPT_PREFIX" \
- \
"$(svn_status_info $info)" \
"$ZSH_PROMPT_BASE_COLOR" \
\
@@ -37,14 +25,13 @@ function svn_prompt_info() {
\
"$(svn_current_revision $info)" \
"$ZSH_PROMPT_BASE_COLOR" \
- \
"$ZSH_THEME_SVN_PROMPT_SUFFIX" \
"$ZSH_PROMPT_BASE_COLOR"
fi
}
function svn_repo_need_upgrade() {
- grep -q "E155036" <<< ${1:-$(svn info 2> /dev/null)} && \
+ grep -q "E155036" <<< "${1:-$(svn info 2> /dev/null)}" && \
echo "E155036: upgrade repo with svn upgrade"
}
@@ -63,12 +50,23 @@ function svn_current_revision() {
function svn_status_info() {
local svn_status_string="$ZSH_THEME_SVN_PROMPT_CLEAN"
local svn_status="$(svn status 2> /dev/null)";
- if command grep -E '^\s*A' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string${ZSH_THEME_SVN_PROMPT_ADDITIONS:-+}"; fi
- if command grep -E '^\s*D' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string${ZSH_THEME_SVN_PROMPT_DELETIONS:-✖}"; fi
- if command grep -E '^\s*M' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string${ZSH_THEME_SVN_PROMPT_MODIFICATIONS:-✎}"; fi
- if command grep -E '^\s*[R~]' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string${ZSH_THEME_SVN_PROMPT_REPLACEMENTS:-∿}"; fi
- if command grep -E '^\s*\?' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string${ZSH_THEME_SVN_PROMPT_UNTRACKED:-?}"; fi
- if command grep -E '^\s*[CI!L]' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string${ZSH_THEME_SVN_PROMPT_DIRTY:-!}"; fi
+ if command grep -E '^\s*A' &> /dev/null <<< $svn_status; then
+ svn_status_string="$svn_status_string${ZSH_THEME_SVN_PROMPT_ADDITIONS:-+}"
+ fi
+ if command grep -E '^\s*D' &> /dev/null <<< $svn_status; then
+ svn_status_string="$svn_status_string${ZSH_THEME_SVN_PROMPT_DELETIONS:-✖}"
+ fi
+ if command grep -E '^\s*M' &> /dev/null <<< $svn_status; then
+ svn_status_string="$svn_status_string${ZSH_THEME_SVN_PROMPT_MODIFICATIONS:-✎}"
+ fi
+ if command grep -E '^\s*[R~]' &> /dev/null <<< $svn_status; then
+ svn_status_string="$svn_status_string${ZSH_THEME_SVN_PROMPT_REPLACEMENTS:-∿}"
+ fi
+ if command grep -E '^\s*\?' &> /dev/null <<< $svn_status; then
+ svn_status_string="$svn_status_string${ZSH_THEME_SVN_PROMPT_UNTRACKED:-?}"
+ fi
+ if command grep -E '^\s*[CI!L]' &> /dev/null <<< $svn_status; then
+ svn_status_string="$svn_status_string${ZSH_THEME_SVN_PROMPT_DIRTY:-!}"
+ fi
echo $svn_status_string
}
-
diff --git a/plugins/tmux-cssh/README.md b/plugins/tmux-cssh/README.md
new file mode 100644
index 000000000..4602a502a
--- /dev/null
+++ b/plugins/tmux-cssh/README.md
@@ -0,0 +1,10 @@
+# tmux-cssh plugin
+
+This plugin adds autocompletion for [`tmux-cssh`](https://github.com/zinic/tmux-cssh/).
+
+To use it, add `tmux-cssh` to the plugins array in your zshrc file:
+```zsh
+plugins=(... tmux-cssh)
+```
+
+First upstream repo, now disappeared: https://github.com/dennishafemann/tmux-cssh.
diff --git a/plugins/tmux-cssh/_tmux-cssh b/plugins/tmux-cssh/_tmux-cssh
index 604e2e478..3e81b82ea 100644
--- a/plugins/tmux-cssh/_tmux-cssh
+++ b/plugins/tmux-cssh/_tmux-cssh
@@ -5,21 +5,21 @@
# Author: Manfred Touron (@moul)
_arguments \
-'(-h --help)'{-h,--help}'[This help.]' \
-'(-u --user)'{-u,--user}'[User to use.]' \
-'(-c --certificate)'{-c,--certificate}'[Path to ssh-certificate to use.]' \
-'(-sc --ssh)'{-sc,--ssh}'[SSH-connection-string, multiple.]' \
-'(-sa --ssh)'{-sa,--ssh}'[SSH connection arguments, used on every session.]' \
-'(-ts --tmux)'{-ts,--tmux}'[Alternative tmux-session-name, default: tmux-cssh]' \
-'(-ns --new)'{-ns,--new}'[Initializes a new session, like -ts \[name\].]' \
-'(-q --quiet)'{-q,--quiet}'[Quiet-mode.]' \
-'(-f --filename)'{-f,--filename}'[Filename of textfile to get -sc connection-strings from, line separated.]' \
-'(-cs --config)'{-cs,--config}'[Name of config-settings which should be get from config-file "$HOME/.tmux-cssh". Which can be a grep-regular expression to find the name(s).]' \
+ '(-h --help)'{-h,--help}'[This help.]' \
+ '(-u --user)'{-u,--user}'[User to use.]' \
+ '(-c --certificate)'{-c,--certificate}'[Path to ssh-certificate to use.]' \
+ '(-sc --ssh)'{-sc,--ssh}'[SSH-connection-string, multiple.]' \
+ '(-sa --ssh)'{-sa,--ssh}'[SSH connection arguments, used on every session.]' \
+ '(-ts --tmux)'{-ts,--tmux}'[Alternative tmux-session-name, default: tmux-cssh]' \
+ '(-ns --new)'{-ns,--new}'[Initializes a new session, like -ts \[name\].]' \
+ '(-q --quiet)'{-q,--quiet}'[Quiet-mode.]' \
+ '(-f --filename)'{-f,--filename}'[Filename of textfile to get -sc connection-strings from, line separated.]' \
+ '(-cs --config)'{-cs,--config}'[Name of config-settings which should be get from config-file "$HOME/.tmux-cssh". Which can be a grep-regular expression to find the name(s).]' \
':hosts:_hosts' \
'*:: :->subcmds' \
&& return 0
if (( CURRENT == 1 )); then
- _describe -t commands "tmux-cssh command"
- return
+ _describe -t commands "tmux-cssh command"
+ return
fi
diff --git a/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh b/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh
index 2a4b43189..b07b2a306 100644
--- a/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh
+++ b/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh
@@ -77,6 +77,12 @@ if [[ ! $DISABLE_VENV_CD -eq 1 ]]; then
else
ENV_NAME=""
fi
+
+ if [[ -n $CD_VIRTUAL_ENV && "$ENV_NAME" != "$CD_VIRTUAL_ENV" ]]; then
+ # We've just left the repo, deactivate the environment
+ # Note: this only happens if the virtualenv was activated automatically
+ deactivate && unset CD_VIRTUAL_ENV
+ fi
if [[ "$ENV_NAME" != "" ]]; then
# Activate the environment only if it is not already active
if [[ "$VIRTUAL_ENV" != "$WORKON_HOME/$ENV_NAME" ]]; then
@@ -86,10 +92,6 @@ if [[ ! $DISABLE_VENV_CD -eq 1 ]]; then
source $ENV_NAME/bin/activate && export CD_VIRTUAL_ENV="$ENV_NAME"
fi
fi
- elif [[ -n $CD_VIRTUAL_ENV && -n $VIRTUAL_ENV ]]; then
- # We've just left the repo, deactivate the environment
- # Note: this only happens if the virtualenv was activated automatically
- deactivate && unset CD_VIRTUAL_ENV
fi
fi
}
diff --git a/plugins/yarn/README.md b/plugins/yarn/README.md
index e6daae44f..05f18a499 100644
--- a/plugins/yarn/README.md
+++ b/plugins/yarn/README.md
@@ -27,6 +27,7 @@ plugins=(... yarn)
| yh | `yarn help` | Show help for a yarn command |
| yi | `yarn init` | Interactively creates or updates a package.json file |
| yin | `yarn install` | Install dependencies defined in `package.json` |
+| yln | `yarn lint` | Run the lint script defined in `package.json` |
| yls | `yarn list` | List installed packages |
| yout | `yarn outdated` | Check for outdated package dependencies |
| yp | `yarn pack` | Create a compressed gzip archive of package dependencies |
diff --git a/plugins/yarn/yarn.plugin.zsh b/plugins/yarn/yarn.plugin.zsh
index 18c5dcc89..9cfcb7539 100644
--- a/plugins/yarn/yarn.plugin.zsh
+++ b/plugins/yarn/yarn.plugin.zsh
@@ -12,6 +12,7 @@ alias ygu="yarn global upgrade"
alias yh="yarn help"
alias yi="yarn init"
alias yin="yarn install"
+alias yln="yarn lint"
alias yls="yarn list"
alias yout="yarn outdated"
alias yp="yarn pack"
diff --git a/plugins/zeus/README.md b/plugins/zeus/README.md
index 451880049..84ed70c91 100644
--- a/plugins/zeus/README.md
+++ b/plugins/zeus/README.md
@@ -24,6 +24,7 @@
* `zcu` aliases `zeus cucumber`
* `zucumber` aliases `zeus cucumber`
+* `zwip` aliases `zeus cucumber --profile wip`
* `zspec` aliases `zeus rspec`
diff --git a/plugins/zeus/zeus.plugin.zsh b/plugins/zeus/zeus.plugin.zsh
index 0c01083a5..5dec1a48c 100644
--- a/plugins/zeus/zeus.plugin.zsh
+++ b/plugins/zeus/zeus.plugin.zsh
@@ -33,6 +33,7 @@ alias zunner='zeus runner'
# Cucumber
alias zcu='zeus cucumber'
alias zucumber='zeus cucumber'
+alias zwip='zeus cucumber --profile wip'
# Rspec
alias zspec='zeus rspec'