From 67e0ef7aa6a494b2357c64a204214f7b19fb52e7 Mon Sep 17 00:00:00 2001 From: "GIL B. Chan" Date: Sun, 7 Apr 2019 18:48:22 +0900 Subject: edit colorize plugin: add `-f terminal` option The option (`pygmentize -f terminal <...>`) lets pygments use terminal color scheme. Otherwise, it would use its default colors, which might be unbalanced with that of terminal (e.g. not harmonious with background color of terminal). --- plugins/colorize/colorize.plugin.zsh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'plugins') diff --git a/plugins/colorize/colorize.plugin.zsh b/plugins/colorize/colorize.plugin.zsh index 8eede9a94..d52e95c49 100644 --- a/plugins/colorize/colorize.plugin.zsh +++ b/plugins/colorize/colorize.plugin.zsh @@ -9,7 +9,7 @@ colorize_via_pygmentize() { # pygmentize stdin if no arguments passed if [ $# -eq 0 ]; then - pygmentize -g + pygmentize -f terminal -g return $? fi @@ -20,9 +20,9 @@ colorize_via_pygmentize() { do lexer=$(pygmentize -N "$FNAME") if [[ $lexer != text ]]; then - pygmentize -l "$lexer" "$FNAME" + pygmentize -f terminal -l "$lexer" "$FNAME" else - pygmentize -g "$FNAME" + pygmentize -f terminal -g "$FNAME" fi done } -- cgit v1.2.3-70-g09d2 From 66e2284a08f86e5dcf661e3cf220483e1fb1f530 Mon Sep 17 00:00:00 2001 From: "Aaron N. Brock" Date: Fri, 15 Nov 2019 14:11:50 -0500 Subject: Add support for chroma --- plugins/colorize/colorize.plugin.zsh | 47 +++++++++++++++++++++++++++++------- 1 file changed, 38 insertions(+), 9 deletions(-) (limited to 'plugins') diff --git a/plugins/colorize/colorize.plugin.zsh b/plugins/colorize/colorize.plugin.zsh index 565ba5a36..051d2269c 100644 --- a/plugins/colorize/colorize.plugin.zsh +++ b/plugins/colorize/colorize.plugin.zsh @@ -3,21 +3,46 @@ alias ccat='colorize_via_pygmentize' alias cless='colorize_via_pygmentize_less' colorize_via_pygmentize() { - if ! (( $+commands[pygmentize] )); then - echo "package 'Pygments' is not installed!" + + if [[ $ZSH_COLORIZE_TOOL != "chroma" && $ZSH_COLORIZE_TOOL != "pygmentize" ]]; then + echo "ZSH_COLORIZE_TOOL not recognized. Options are 'pygmentize' or 'chroma'" return 1 fi - # If the environment varianle ZSH_COLORIZE_STYLE + if [ -z $ZSH_COLORIZE_TOOL ]; then + if (( $+commands[pygmentize] )); then + ZSH_COLORIZE_TOOL="pygmentize" + elif (( $+commands[chroma] )); then + ZSH_COLORIZE_TOOL="chroma" + else + echo "niether 'Pygments' nor 'chroma' is not installed!" + return 1 + fi + fi + + echo "Tool: $ZSH_COLORIZE_TOOL" + + # 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 [[ $ZSH_COLORIZE_TOOL == "pygmentize" ]]; then + ZSH_COLORIZE_STYLE="default" + else + # Choosing 'emacs' to match pygmentize's default as per: + # https://github.com/pygments/pygments/blob/master/pygments/styles/default.py#L19 + ZSH_COLORIZE_STYLE="emacs" + fi fi + echo "color style: $ZSH_COLORIZE_STYLE" # pygmentize stdin if no arguments 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 @@ -27,11 +52,15 @@ colorize_via_pygmentize() { local FNAME lexer for FNAME in "$@" do - lexer=$(pygmentize -N "$FNAME") - if [[ $lexer != text ]]; then - pygmentize -O style="$ZSH_COLORIZE_STYLE" -l "$lexer" "$FNAME" + 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 } -- cgit v1.2.3-70-g09d2 From 8aa070db0e1f8a5752f0e45834b7093b9b72860f Mon Sep 17 00:00:00 2001 From: "Aaron N. Brock" Date: Fri, 15 Nov 2019 15:34:24 -0500 Subject: Update README.md --- plugins/colorize/README.md | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'plugins') diff --git a/plugins/colorize/README.md b/plugins/colorize/README.md index d1f878e62..b6e27fd27 100644 --- a/plugins/colorize/README.md +++ b/plugins/colorize/README.md @@ -10,12 +10,23 @@ To use it, add colorize to the plugins array of your zshrc file: ``` plugins=(... colorize) ``` +## Configuration -## Styles +### Colorize tool + +Colorize supports using either the `pygmentize` tool or the `chroma` tool. By default colorize uses `pygmentize` unless it's not installed & `chroma` is installed. However, you can override this with the `ZSH_COLORIZE_TOOL` environment variable: + +``` +ZSH_COLORIZE_TOOL=chroma +``` + +### Styles 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"` +``` +ZSH_COLORIZE_STYLE="colorful" +``` ## Usage @@ -32,4 +43,6 @@ In the latter form, the file contents will be concatenated and presented by less ## Requirements -You have to install Pygments first: [pygments.org](http://pygments.org/download/) +You have to either install Pygments: [pygments.org](http://pygments.org/download/) + +Or install chroma: [https://github.com/alecthomas/chroma](https://github.com/alecthomas/chroma) \ No newline at end of file -- cgit v1.2.3-70-g09d2 From d08238fb0f5150bfd0be8201537a2a8ca6dbbdc9 Mon Sep 17 00:00:00 2001 From: Jakob Probst Date: Sat, 16 Nov 2019 13:10:02 +0100 Subject: Fix some comments and messages. Remove (probably) debug messages. Improve ZSH_COLORIZE_TOOL recognition. --- plugins/colorize/README.md | 4 ++-- plugins/colorize/colorize.plugin.zsh | 17 +++++++++-------- 2 files changed, 11 insertions(+), 10 deletions(-) (limited to 'plugins') diff --git a/plugins/colorize/README.md b/plugins/colorize/README.md index b6e27fd27..38d17dc76 100644 --- a/plugins/colorize/README.md +++ b/plugins/colorize/README.md @@ -14,7 +14,7 @@ plugins=(... colorize) ### Colorize tool -Colorize supports using either the `pygmentize` tool or the `chroma` tool. By default colorize uses `pygmentize` unless it's not installed & `chroma` is installed. However, you can override this with the `ZSH_COLORIZE_TOOL` environment variable: +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 @@ -30,7 +30,7 @@ ZSH_COLORIZE_STYLE="colorful" ## Usage -* `ccat [files]`: colorize the contents of the file (or files, if more than one are provided). +* `ccat [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. * `cless [files]`: colorize the contents of the file (or files, if more than one are provided) and diff --git a/plugins/colorize/colorize.plugin.zsh b/plugins/colorize/colorize.plugin.zsh index 051d2269c..ac826e44b 100644 --- a/plugins/colorize/colorize.plugin.zsh +++ b/plugins/colorize/colorize.plugin.zsh @@ -3,11 +3,7 @@ alias ccat='colorize_via_pygmentize' alias cless='colorize_via_pygmentize_less' colorize_via_pygmentize() { - - if [[ $ZSH_COLORIZE_TOOL != "chroma" && $ZSH_COLORIZE_TOOL != "pygmentize" ]]; then - echo "ZSH_COLORIZE_TOOL not recognized. Options are 'pygmentize' or 'chroma'" - return 1 - fi + local available_tools=("chroma" "pygmentize") if [ -z $ZSH_COLORIZE_TOOL ]; then if (( $+commands[pygmentize] )); then @@ -15,12 +11,18 @@ colorize_via_pygmentize() { elif (( $+commands[chroma] )); then ZSH_COLORIZE_TOOL="chroma" else - echo "niether 'Pygments' nor 'chroma' is not installed!" + echo "Neither 'pygments' nor 'chroma' is installed!" return 1 fi fi - echo "Tool: $ZSH_COLORIZE_TOOL" + 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'." + return 1 + elif (( $+commands[$ZSH_COLORIZE_TOOL] )); then + echo "Package '$ZSH_COLORIZE_TOOL' is not installed!" + return 1 + fi # If the environment variable ZSH_COLORIZE_STYLE # is set, use that theme instead. Otherwise, @@ -35,7 +37,6 @@ colorize_via_pygmentize() { fi fi - echo "color style: $ZSH_COLORIZE_STYLE" # pygmentize stdin if no arguments passed if [ $# -eq 0 ]; then if [[ $ZSH_COLORIZE_TOOL == "pygmentize" ]]; then -- cgit v1.2.3-70-g09d2 From b776f1d20f0537cefec9b58e41933dfd04334b62 Mon Sep 17 00:00:00 2001 From: "Aaron N. Brock" Date: Sun, 17 Nov 2019 14:03:14 -0500 Subject: Fix issue recognizing if tools are insalled --- plugins/colorize/colorize.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/colorize/colorize.plugin.zsh b/plugins/colorize/colorize.plugin.zsh index ac826e44b..2335113d5 100644 --- a/plugins/colorize/colorize.plugin.zsh +++ b/plugins/colorize/colorize.plugin.zsh @@ -19,7 +19,7 @@ colorize_via_pygmentize() { 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'." return 1 - elif (( $+commands[$ZSH_COLORIZE_TOOL] )); then + elif (( $+commands["$ZSH_COLORIZE_TOOL"] )); then echo "Package '$ZSH_COLORIZE_TOOL' is not installed!" return 1 fi -- cgit v1.2.3-70-g09d2 From c194b51560039707dc375412e70b6faa0d3ceaa5 Mon Sep 17 00:00:00 2001 From: "Aaron N. Brock" Date: Sun, 17 Nov 2019 14:10:03 -0500 Subject: Update default color to 'emacs' which both chroma & pygmentize support --- plugins/colorize/colorize.plugin.zsh | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'plugins') diff --git a/plugins/colorize/colorize.plugin.zsh b/plugins/colorize/colorize.plugin.zsh index 2335113d5..8edf81d54 100644 --- a/plugins/colorize/colorize.plugin.zsh +++ b/plugins/colorize/colorize.plugin.zsh @@ -28,13 +28,8 @@ colorize_via_pygmentize() { # is set, use that theme instead. Otherwise, # use the default. if [ -z $ZSH_COLORIZE_STYLE ]; then - if [[ $ZSH_COLORIZE_TOOL == "pygmentize" ]]; then - ZSH_COLORIZE_STYLE="default" - else - # Choosing 'emacs' to match pygmentize's default as per: - # https://github.com/pygments/pygments/blob/master/pygments/styles/default.py#L19 - ZSH_COLORIZE_STYLE="emacs" - fi + # Both pygmentize & chroma support 'emacs' + ZSH_COLORIZE_STYLE="emacs" fi # pygmentize stdin if no arguments passed -- cgit v1.2.3-70-g09d2 From 5d5d202794ad62c51435798fdd464245f928e5db Mon Sep 17 00:00:00 2001 From: Jakob Probst Date: Sun, 17 Nov 2019 21:40:42 +0100 Subject: Echo to Error-Stream. Double quote to prevent globbing and word splitting. --- plugins/colorize/colorize.plugin.zsh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'plugins') diff --git a/plugins/colorize/colorize.plugin.zsh b/plugins/colorize/colorize.plugin.zsh index 8edf81d54..e250397be 100644 --- a/plugins/colorize/colorize.plugin.zsh +++ b/plugins/colorize/colorize.plugin.zsh @@ -5,36 +5,36 @@ alias cless='colorize_via_pygmentize_less' colorize_via_pygmentize() { local available_tools=("chroma" "pygmentize") - if [ -z $ZSH_COLORIZE_TOOL ]; then + 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!" + 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'." + 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!" + echo "Package '$ZSH_COLORIZE_TOOL' is not installed!" >&2 return 1 fi # If the environment variable ZSH_COLORIZE_STYLE # is set, use that theme instead. Otherwise, # use the default. - if [ -z $ZSH_COLORIZE_STYLE ]; then + if [ -z "$ZSH_COLORIZE_STYLE" ]; then # Both pygmentize & chroma support 'emacs' ZSH_COLORIZE_STYLE="emacs" fi # pygmentize stdin if no arguments passed if [ $# -eq 0 ]; then - if [[ $ZSH_COLORIZE_TOOL == "pygmentize" ]]; then + if [[ "$ZSH_COLORIZE_TOOL" == "pygmentize" ]]; then pygmentize -O style="$ZSH_COLORIZE_STYLE" -g else chroma --style="$ZSH_COLORIZE_STYLE" @@ -48,7 +48,7 @@ colorize_via_pygmentize() { local FNAME lexer for FNAME in "$@" do - if [[ $ZSH_COLORIZE_TOOL == "pygmentize" ]]; then + if [[ "$ZSH_COLORIZE_TOOL" == "pygmentize" ]]; then lexer=$(pygmentize -N "$FNAME") if [[ $lexer != text ]]; then pygmentize -O style="$ZSH_COLORIZE_STYLE" -l "$lexer" "$FNAME" -- cgit v1.2.3-70-g09d2 From 1761685d3e8d0594ff580c968874665e64a9a9cb Mon Sep 17 00:00:00 2001 From: Filipe Nascimento Date: Tue, 17 Dec 2019 13:35:40 -0300 Subject: extract: add zstd support (#8469) --- plugins/extract/README.md | 3 +++ plugins/extract/_extract | 2 +- plugins/extract/extract.plugin.zsh | 5 +++++ 3 files changed, 9 insertions(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/extract/README.md b/plugins/extract/README.md index 41b6a61f1..aca300097 100644 --- a/plugins/extract/README.md +++ b/plugins/extract/README.md @@ -34,15 +34,18 @@ plugins=(... extract) | `tar.gz` | Tarball with gzip 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..47b918b29 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|lzma|rar|rpm|sublime-package|tar|tar.bz2|tar.gz|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..b7d4e3ba7 100644 --- a/plugins/extract/extract.plugin.zsh +++ b/plugins/extract/extract.plugin.zsh @@ -40,6 +40,10 @@ 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" ;; (*.gz) (( $+commands[pigz] )) && pigz -dk "$1" || gunzip -k "$1" ;; (*.bz2) bunzip2 "$1" ;; @@ -59,6 +63,7 @@ extract() { cd ..; rm *.tar.* debian-binary cd .. ;; + (*.zst) unzstd "$1" ;; (*) echo "extract: '$1' cannot be extracted" >&2 success=1 -- cgit v1.2.3-70-g09d2 From ad1169bf39d8cab3e0139299d8200dd18bdc2038 Mon Sep 17 00:00:00 2001 From: Mustaqim Malim Date: Wed, 18 Dec 2019 09:53:54 +0000 Subject: extract: add tar.lz support (#8479) --- plugins/extract/README.md | 1 + plugins/extract/_extract | 2 +- plugins/extract/extract.plugin.zsh | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/extract/README.md b/plugins/extract/README.md index aca300097..d6e4fa116 100644 --- a/plugins/extract/README.md +++ b/plugins/extract/README.md @@ -32,6 +32,7 @@ plugins=(... extract) | `tar` | Tarball | | `tar.bz2` | Tarball with bzip2 compression | | `tar.gz` | Tarball with gzip 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 | diff --git a/plugins/extract/_extract b/plugins/extract/_extract index 47b918b29..e9d12d4d3 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|tar.zst|tbz|tbz2|tgz|tlz|txz|tzst|war|whl|xpi|xz|zip|zst)(-.)'" \ + "*::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.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 b7d4e3ba7..5cc30d1ce 100644 --- a/plugins/extract/extract.plugin.zsh +++ b/plugins/extract/extract.plugin.zsh @@ -45,6 +45,7 @@ extract() { && tar --zstd -xvf "$1" \ || zstdcat "$1" | tar xvf - ;; (*.tar) tar xvf "$1" ;; + (*.tar.lz) (( $+commands[lzip] )) && tar xvf "$1" ;; (*.gz) (( $+commands[pigz] )) && pigz -dk "$1" || gunzip -k "$1" ;; (*.bz2) bunzip2 "$1" ;; (*.xz) unxz "$1" ;; -- cgit v1.2.3-70-g09d2 From 7dddfe0a39b75acbe265c47b6d1dc575d6dedd9f Mon Sep 17 00:00:00 2001 From: Anatoli Babenia Date: Wed, 18 Dec 2019 13:06:39 +0300 Subject: fasd: fix plugins name in README (#8483) --- plugins/fasd/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'plugins') 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 | -- cgit v1.2.3-70-g09d2 From 4338a731b77d9f7a73b554667626e35b3fb5f7e3 Mon Sep 17 00:00:00 2001 From: pprugger Date: Thu, 19 Dec 2019 10:50:20 +0100 Subject: fzf: add support for FreeBSD (#8474) --- plugins/fzf/fzf.plugin.zsh | 1 + 1 file changed, 1 insertion(+) (limited to 'plugins') 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 -- cgit v1.2.3-70-g09d2 From 3d6be08e71219e75405ef0d535cc9c3defbb3367 Mon Sep 17 00:00:00 2001 From: giovanepadawan <51273591+giovanepadawan@users.noreply.github.com> Date: Fri, 20 Dec 2019 03:35:50 +0100 Subject: yarn: add alias for yarn lint (#8481) --- plugins/yarn/README.md | 1 + plugins/yarn/yarn.plugin.zsh | 1 + 2 files changed, 2 insertions(+) (limited to 'plugins') 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" -- cgit v1.2.3-70-g09d2 From 1a0500b00dd417ea2d9d3ea12bbad5318f8d7e55 Mon Sep 17 00:00:00 2001 From: Jay Tavares Date: Sat, 21 Dec 2019 00:08:03 -0500 Subject: Change order of automatic virtualenv activation/deactivation (#6687) When navigating from a virtualenv project directory, first deactivate the virtualenv. Then, check to see if destination directory is also a virtualenv project directory. If it is activate that virtualenv. See #5817. --- plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'plugins') 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 } -- cgit v1.2.3-70-g09d2 From 16ef5cca44d23fbde33de77cf44d0f05804d43e9 Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Fri, 20 Dec 2019 21:45:39 -0800 Subject: Update link for Pygments Also moving the dependencies section up --- plugins/colorize/README.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'plugins') diff --git a/plugins/colorize/README.md b/plugins/colorize/README.md index 32dc97b6e..036724a1a 100644 --- a/plugins/colorize/README.md +++ b/plugins/colorize/README.md @@ -6,11 +6,17 @@ 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. +## Setup + To use it, add colorize to the plugins array of your zshrc file: ``` plugins=(... colorize) ``` +### Requirements + +This plugin requires that Pygments be installed: [pygments.org](https://pygments.org/) + ## Styles 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: @@ -29,7 +35,3 @@ Note that `cless` will behave as less when provided more than one file: you have 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. - -## Requirements - -You have to install Pygments first: [pygments.org](http://pygments.org/download.html) -- cgit v1.2.3-70-g09d2 From e204c596ef5a1075914c5e7810ec1eba4bbe7411 Mon Sep 17 00:00:00 2001 From: lieryan Date: Sat, 21 Dec 2019 18:33:39 +1100 Subject: Rewrite gitstatus collection to be more robust (#7322) Fix the finicky parsing logic and just ask git the necessary information directly. --- plugins/git-prompt/gitstatus.py | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) (limited to 'plugins') 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 -- cgit v1.2.3-70-g09d2 From e21fbe7dffff1619c2deb02eea8cccbd7e9814f4 Mon Sep 17 00:00:00 2001 From: ProbstDJakob Date: Sun, 22 Dec 2019 21:21:14 +0100 Subject: colorize: update plugin to support less options (#8392) --- plugins/colorize/README.md | 18 +++----- plugins/colorize/colorize.plugin.zsh | 83 +++++++++++++++++++++++++----------- 2 files changed, 64 insertions(+), 37 deletions(-) (limited to 'plugins') diff --git a/plugins/colorize/README.md b/plugins/colorize/README.md index d37443011..ee4ab8036 100644 --- a/plugins/colorize/README.md +++ b/plugins/colorize/README.md @@ -17,10 +17,10 @@ plugins=(... colorize) ### Requirements -This plugin requires that either of the following tools be installed: +This plugin requires that at least one of the following tools is installed: -* Chroma: [https://github.com/alecthomas/chroma](https://github.com/alecthomas/chroma) -* Pygments be installed: [pygments.org](https://pygments.org/) +* [Chroma](https://github.com/alecthomas/chroma) +* [Pygments](https://pygments.org/download/) ### Colorize tool @@ -41,12 +41,8 @@ ZSH_COLORIZE_STYLE="colorful" ## Usage * `ccat [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. + If no files are passed it will colorize the standard input. -* `cless [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. - -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. +* `cless [less-options] [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 3e91a9f46..6ed9739fa 100644 --- a/plugins/colorize/colorize.plugin.zsh +++ b/plugins/colorize/colorize.plugin.zsh @@ -1,8 +1,11 @@ -# 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() { +# '$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 @@ -23,6 +26,12 @@ colorize_via_pygmentize() { 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 variable ZSH_COLORIZE_STYLE # is set, use that theme instead. Otherwise, @@ -32,7 +41,7 @@ colorize_via_pygmentize() { ZSH_COLORIZE_STYLE="emacs" fi - # pygmentize stdin if no arguments passed + # Use stdin if no arguments have been passed. if [ $# -eq 0 ]; then if [[ "$ZSH_COLORIZE_TOOL" == "pygmentize" ]]; then pygmentize -O style="$ZSH_COLORIZE_STYLE" -g @@ -42,12 +51,9 @@ colorize_via_pygmentize() { 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 + for FNAME in "$@"; do if [[ "$ZSH_COLORIZE_TOOL" == "pygmentize" ]]; then lexer=$(pygmentize -N "$FNAME") if [[ $lexer != text ]]; then @@ -61,22 +67,47 @@ colorize_via_pygmentize() { 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 +} -- cgit v1.2.3-70-g09d2 From 38929084f98684b9267d7f0cfe3e7f9aa5f861d2 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Sun, 22 Dec 2019 23:03:54 +0100 Subject: fastfile: add README --- plugins/fastfile/README.md | 84 ++++++++++++++++++++++++++++++++++++ plugins/fastfile/fastfile.plugin.zsh | 39 ++++++----------- 2 files changed, 98 insertions(+), 25 deletions(-) create mode 100644 plugins/fastfile/README.md (limited to 'plugins') 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 `: generate a shortcut. + +- `fastfile_print `: prints a shortcut, with the format + ` -> `. + +- `fastfile_ls`: lists all shortcuts. + +- `fastfile_rm `: remove a shortcut. + +- `fastfile_sync`: generates the global aliases for the shortcuts. + + +### Internal functions + +- `fastfile_resolv `: resolves the location of the shortcut + file, i.e., the file in the fastfile directory where the shortcut path + is stored. + +- `fastfile_get `: 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 `=` 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 -- cgit v1.2.3-70-g09d2 From 7360d898d8b64b40276eab72bcd9e1ea4fc8f7ee Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Thu, 26 Dec 2019 23:12:17 +0100 Subject: gas: add README --- plugins/gas/README.md | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 plugins/gas/README.md (limited to 'plugins') 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) +``` -- cgit v1.2.3-70-g09d2 From 59930902e1bee022ec031cd276df66174e1990d3 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Thu, 26 Dec 2019 23:23:23 +0100 Subject: glassfish: add README --- plugins/glassfish/README.md | 9 +++++++++ plugins/glassfish/glassfish.plugin.zsh | 3 --- 2 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 plugins/glassfish/README.md (limited to 'plugins') 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 -- cgit v1.2.3-70-g09d2 From a952854c122c0e728f7bb5577fabda6b6a0c6a79 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Fri, 27 Dec 2019 00:04:40 +0100 Subject: gnu-utils: add README, simplify plugin --- plugins/gnu-utils/README.md | 38 ++++++++++ plugins/gnu-utils/gnu-utils.plugin.zsh | 130 ++++++++++++++++----------------- 2 files changed, 103 insertions(+), 65 deletions(-) create mode 100644 plugins/gnu-utils/README.md (limited to 'plugins') 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 +} -- cgit v1.2.3-70-g09d2 From 132607447d24477bcedac7e0accd3fe83b9b6a1a Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Fri, 27 Dec 2019 00:49:50 +0100 Subject: knife: add README and reformat completion file --- plugins/knife/README.md | 25 ++++++ plugins/knife/_knife | 215 +++++++++++++++++++++++++----------------------- 2 files changed, 136 insertions(+), 104 deletions(-) create mode 100644 plugins/knife/README.md (limited to 'plugins') 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 -- cgit v1.2.3-70-g09d2 From 9c0ceb7a5291950551d95d9314573c26c73e6b0e Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Fri, 27 Dec 2019 00:56:03 +0100 Subject: knife_ssh: add README --- plugins/knife_ssh/README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 plugins/knife_ssh/README.md (limited to 'plugins') 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. -- cgit v1.2.3-70-g09d2 From e891fbff9e2e70acfbeff0734cd1fc012861e6ef Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Fri, 27 Dec 2019 00:58:31 +0100 Subject: knife_ssh: small tweaks --- plugins/knife_ssh/knife_ssh.plugin.zsh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'plugins') 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 } -- cgit v1.2.3-70-g09d2 From 4fd25920070f85bf358d297e79af1e85aac07f5a Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Fri, 27 Dec 2019 01:05:47 +0100 Subject: paver: add README --- plugins/paver/README.md | 12 ++++++++++++ plugins/paver/paver.plugin.zsh | 6 +++--- 2 files changed, 15 insertions(+), 3 deletions(-) create mode 100644 plugins/paver/README.md (limited to 'plugins') 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 () { -- cgit v1.2.3-70-g09d2 From 9655377b9e02284188deddd3829159a0e35cc48f Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Fri, 27 Dec 2019 01:54:02 +0100 Subject: rbfu: add README --- plugins/rbfu/README.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 plugins/rbfu/README.md (limited to 'plugins') 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. -- cgit v1.2.3-70-g09d2 From 0c2f7514fc65d23fe86ad4c8eb6807ec7c18043f Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Fri, 27 Dec 2019 02:07:59 +0100 Subject: sfffe: add README --- plugins/sfffe/README.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 plugins/sfffe/README.md (limited to 'plugins') 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. -- cgit v1.2.3-70-g09d2 From ca8a5a0a84d4bb38c0a953e633a7ee446037a616 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Fri, 27 Dec 2019 02:25:59 +0100 Subject: svn-fast-info: add README, reorg. plugin --- plugins/svn-fast-info/README.md | 55 ++++++++++++++++++++++++++ plugins/svn-fast-info/svn-fast-info.plugin.zsh | 42 ++++++++++---------- 2 files changed, 75 insertions(+), 22 deletions(-) create mode 100644 plugins/svn-fast-info/README.md (limited to 'plugins') 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 } - -- cgit v1.2.3-70-g09d2 From 8ea20fdca794a2a2c2f39cebd1e1861f9f0c6fbb Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Fri, 27 Dec 2019 02:34:35 +0100 Subject: tmux-cssh: add README --- plugins/tmux-cssh/README.md | 10 ++++++++++ plugins/tmux-cssh/_tmux-cssh | 24 ++++++++++++------------ 2 files changed, 22 insertions(+), 12 deletions(-) create mode 100644 plugins/tmux-cssh/README.md (limited to 'plugins') 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 -- cgit v1.2.3-70-g09d2 From 67b5bfaaa316212221a01d4fe2eedcd0fc64c230 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Fri, 27 Dec 2019 02:37:27 +0100 Subject: Rename some plugin READMEs for consistency --- plugins/firewalld/README.md | 22 ++++++++++++++++++++++ plugins/firewalld/readme.md | 22 ---------------------- plugins/magic-enter/README.md | 17 +++++++++++++++++ plugins/magic-enter/Readme.md | 17 ----------------- plugins/ros/README.md | 10 ++++++++++ plugins/ros/README.mkd | 10 ---------- 6 files changed, 49 insertions(+), 49 deletions(-) create mode 100644 plugins/firewalld/README.md delete mode 100644 plugins/firewalld/readme.md create mode 100644 plugins/magic-enter/README.md delete mode 100644 plugins/magic-enter/Readme.md create mode 100644 plugins/ros/README.md delete mode 100644 plugins/ros/README.mkd (limited to 'plugins') diff --git a/plugins/firewalld/README.md b/plugins/firewalld/README.md new file mode 100644 index 000000000..8b5bc74d4 --- /dev/null +++ b/plugins/firewalld/README.md @@ -0,0 +1,22 @@ +# FirewallD Plugin + +This plugin adds some aliases and functions for FirewallD using the `firewalld-cmd` command. To use it, add firewalld to your plugins array. + +```zsh +plugins=(... firewalld) +``` + +## Aliases + +| Alias | Command | Description | +| :---- | :----------------------------------------- | :--------------------------- | +| fw | `sudo firewall-cmd` | Shorthand | +| fwr | `sudo firewall-cmd --reload` | Reload current configuration | +| fwp | `sudo firewall-cmd --permanent` | Create permanent rule | +| fwrp | `sudo firewall-cmd --runtime-to-permanent` | Save current configuration | + +## Functions + +| Function | Description | +| :------- | :--------------------------------------------------------- | +| fwl | Lists configuration from all active zones and direct rules | diff --git a/plugins/firewalld/readme.md b/plugins/firewalld/readme.md deleted file mode 100644 index 8b5bc74d4..000000000 --- a/plugins/firewalld/readme.md +++ /dev/null @@ -1,22 +0,0 @@ -# FirewallD Plugin - -This plugin adds some aliases and functions for FirewallD using the `firewalld-cmd` command. To use it, add firewalld to your plugins array. - -```zsh -plugins=(... firewalld) -``` - -## Aliases - -| Alias | Command | Description | -| :---- | :----------------------------------------- | :--------------------------- | -| fw | `sudo firewall-cmd` | Shorthand | -| fwr | `sudo firewall-cmd --reload` | Reload current configuration | -| fwp | `sudo firewall-cmd --permanent` | Create permanent rule | -| fwrp | `sudo firewall-cmd --runtime-to-permanent` | Save current configuration | - -## Functions - -| Function | Description | -| :------- | :--------------------------------------------------------- | -| fwl | Lists configuration from all active zones and direct rules | diff --git a/plugins/magic-enter/README.md b/plugins/magic-enter/README.md new file mode 100644 index 000000000..78514c67d --- /dev/null +++ b/plugins/magic-enter/README.md @@ -0,0 +1,17 @@ +## Magic Enter plugin + +This plugin makes your enter key magical, by binding commonly used commands to it. + +To use it, add `magic-enter` to the plugins array in your zshrc file. You can set the +commands to be run in your .zshrc, before the line containing plugins. If no command +is specified in a git directory, `git status` is executed; in other directories, `ls`. + +```zsh +# defaults +MAGIC_ENTER_GIT_COMMAND='git status -u .' +MAGIC_ENTER_OTHER_COMMAND='ls -lh .' + +plugins=(... magic-enter) +``` + +**Maintainer:** [@dufferzafar](https://github.com/dufferzafar) diff --git a/plugins/magic-enter/Readme.md b/plugins/magic-enter/Readme.md deleted file mode 100644 index 78514c67d..000000000 --- a/plugins/magic-enter/Readme.md +++ /dev/null @@ -1,17 +0,0 @@ -## Magic Enter plugin - -This plugin makes your enter key magical, by binding commonly used commands to it. - -To use it, add `magic-enter` to the plugins array in your zshrc file. You can set the -commands to be run in your .zshrc, before the line containing plugins. If no command -is specified in a git directory, `git status` is executed; in other directories, `ls`. - -```zsh -# defaults -MAGIC_ENTER_GIT_COMMAND='git status -u .' -MAGIC_ENTER_OTHER_COMMAND='ls -lh .' - -plugins=(... magic-enter) -``` - -**Maintainer:** [@dufferzafar](https://github.com/dufferzafar) diff --git a/plugins/ros/README.md b/plugins/ros/README.md new file mode 100644 index 000000000..83573e499 --- /dev/null +++ b/plugins/ros/README.md @@ -0,0 +1,10 @@ +# Roswell Plugin + +This plugin adds completions and aliases for [Roswell](https://github.com/roswell/roswell/). + +To use it, add `ros` to the plugins array in your zshrc file: + +```zsh +plugins=(... ros) +``` + diff --git a/plugins/ros/README.mkd b/plugins/ros/README.mkd deleted file mode 100644 index 83573e499..000000000 --- a/plugins/ros/README.mkd +++ /dev/null @@ -1,10 +0,0 @@ -# Roswell Plugin - -This plugin adds completions and aliases for [Roswell](https://github.com/roswell/roswell/). - -To use it, add `ros` to the plugins array in your zshrc file: - -```zsh -plugins=(... ros) -``` - -- cgit v1.2.3-70-g09d2 From c63fca8581352028651f6bc9c2074620c3a27352 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Fri, 27 Dec 2019 02:47:26 +0100 Subject: otp: add README and use clipcopy --- plugins/otp/README.md | 22 ++++++++++++++++++++++ plugins/otp/otp.plugin.zsh | 19 +++++-------------- 2 files changed, 27 insertions(+), 14 deletions(-) create mode 100644 plugins/otp/README.md (limited to 'plugins') 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 " + if [[ -z "$1" ]]; then + echo "usage: $0 " 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 " + echo "usage: $0 " return 1 else echo "Enter an email address attached to your GPG private key, then paste the secret configuration key followed by ^D" -- cgit v1.2.3-70-g09d2 From d99ddab0cadfbb047f23b5d2037b54b4f4437ae4 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Fri, 27 Dec 2019 02:51:54 +0100 Subject: codeclimate: add README --- plugins/codeclimate/README.md | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 plugins/codeclimate/README.md (limited to 'plugins') 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) +``` -- cgit v1.2.3-70-g09d2 From 31219c02463f1f57271a3d336b4c25b9902ca4ad Mon Sep 17 00:00:00 2001 From: Carver Schmidt <46279291+carverschmidt@users.noreply.github.com> Date: Sat, 28 Dec 2019 11:01:26 -0600 Subject: osx: fix exit on quit command in spotify function (#8504) --- plugins/osx/spotify | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/osx/spotify b/plugins/osx/spotify index 78d6c7d0f..6233d813d 100644 --- a/plugins/osx/spotify +++ b/plugins/osx/spotify @@ -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'; -- cgit v1.2.3-70-g09d2 From 9bfcab7d10e216df9fe7110334a41cf2f802bace Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Sat, 28 Dec 2019 18:00:35 +0100 Subject: osx: use return instead of exit in spotify function --- plugins/osx/spotify | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'plugins') diff --git a/plugins/osx/spotify b/plugins/osx/spotify index 6233d813d..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}" \ @@ -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 -- cgit v1.2.3-70-g09d2 From d56d6dc145e20dbea9c45f7aa1c09f8e2b5859a1 Mon Sep 17 00:00:00 2001 From: Khas'Mek Date: Sat, 28 Dec 2019 21:17:37 -0700 Subject: Plugins: repo - add more aliases. (#3917) --- plugins/repo/repo.plugin.zsh | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'plugins') 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' -- cgit v1.2.3-70-g09d2 From 016dd30f4c215dcc326f2ddc68dcb54603915f43 Mon Sep 17 00:00:00 2001 From: Charles Assus Date: Sun, 29 Dec 2019 05:29:07 +0100 Subject: New alias zwip that launch cucumber with the :wip profile (#4111) * Add zeus rake cucumber:wip, alias swip * Add the right command for zwip alias :D * Add the right command * respect the coding style * respect the coding final --- plugins/zeus/README.md | 1 + plugins/zeus/zeus.plugin.zsh | 1 + 2 files changed, 2 insertions(+) (limited to 'plugins') 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' -- cgit v1.2.3-70-g09d2 From b0be0439e5d99e186a9ae084eb4ed69c51d4b7cb Mon Sep 17 00:00:00 2001 From: khalil choudhry Date: Sun, 29 Dec 2019 09:35:31 +0500 Subject: Feature/ionic plugin aliases (#8494) * Add DS_Store to gitignore * Add ionic aliases * Add ionic plugin readme --- .gitignore | 1 + plugins/ionic/README.md | 30 ++++++++++++++++++++++++++++++ plugins/ionic/ionic.plugin.zsh | 15 +++++++++++++++ 3 files changed, 46 insertions(+) create mode 100644 plugins/ionic/README.md create mode 100644 plugins/ionic/ionic.plugin.zsh (limited to 'plugins') diff --git a/.gitignore b/.gitignore index 251c9dc9f..ec24a19bb 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ custom/ cache/ log/ *.swp +.DS_Store 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" -- cgit v1.2.3-70-g09d2 From 6bac9eb103fe6c777182746e3a6e84dfc882338b Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Sun, 29 Dec 2019 05:36:29 +0100 Subject: extract: add lrz support (#8500) --- plugins/extract/README.md | 2 ++ plugins/extract/_extract | 2 +- plugins/extract/extract.plugin.zsh | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/extract/README.md b/plugins/extract/README.md index d6e4fa116..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,6 +33,7 @@ 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 | diff --git a/plugins/extract/_extract b/plugins/extract/_extract index e9d12d4d3..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.lz|tar.xz|tar.zma|tar.zst|tbz|tbz2|tgz|tlz|txz|tzst|war|whl|xpi|xz|zip|zst)(-.)'" \ + "*::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 5cc30d1ce..349c9a776 100644 --- a/plugins/extract/extract.plugin.zsh +++ b/plugins/extract/extract.plugin.zsh @@ -46,9 +46,11 @@ extract() { || 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 ;; -- cgit v1.2.3-70-g09d2 From 8ed19ab54d6980da777ccea185658e213b26f533 Mon Sep 17 00:00:00 2001 From: Shaun Tabone Date: Sun, 29 Dec 2019 05:37:38 +0100 Subject: Added MicroK8s plugin for ZSH (#8499) * Added MicroK8s plugin for ZSH * Added caching for kubectl and helm commands * Added title in compadd and enhanced README --- plugins/microk8s/README.md | 24 +++++++++++ plugins/microk8s/microk8s.plugin.zsh | 82 ++++++++++++++++++++++++++++++++++++ 2 files changed, 106 insertions(+) create mode 100644 plugins/microk8s/README.md create mode 100644 plugins/microk8s/microk8s.plugin.zsh (limited to 'plugins') 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' -- cgit v1.2.3-70-g09d2 From d5f8fac465857941eabfbd0fcb58610c0fc002dc Mon Sep 17 00:00:00 2001 From: Shaun Tabone Date: Sun, 29 Dec 2019 05:54:58 +0100 Subject: Feature/add dotnet plugin (#8503) * Added dotnet CLI aliases and completions * Modified README --- plugins/dotnet/README.md | 21 +++++++ plugins/dotnet/dotnet.plugin.zsh | 117 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 138 insertions(+) create mode 100644 plugins/dotnet/README.md create mode 100644 plugins/dotnet/dotnet.plugin.zsh (limited to 'plugins') 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' -- cgit v1.2.3-70-g09d2 From df55690daddb4e57b5cef719263f2fa988da04ee Mon Sep 17 00:00:00 2001 From: Alaa Qutaish Date: Sun, 29 Dec 2019 05:58:31 +0100 Subject: Add kubectl log since aliases (#8448) --- plugins/kubectl/kubectl.plugin.zsh | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'plugins') diff --git a/plugins/kubectl/kubectl.plugin.zsh b/plugins/kubectl/kubectl.plugin.zsh index 6c1696d5e..369b6ad25 100644 --- a/plugins/kubectl/kubectl.plugin.zsh +++ b/plugins/kubectl/kubectl.plugin.zsh @@ -115,7 +115,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' -- cgit v1.2.3-70-g09d2 From 42d04d386d357319a034d0c373daf119370637c0 Mon Sep 17 00:00:00 2001 From: Alaa Qutaish Date: Sun, 29 Dec 2019 05:59:14 +0100 Subject: Add kubectl all-namespaces aliases for k8s objects (#8434) --- plugins/kubectl/kubectl.plugin.zsh | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'plugins') diff --git a/plugins/kubectl/kubectl.plugin.zsh b/plugins/kubectl/kubectl.plugin.zsh index 369b6ad25..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' @@ -134,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' -- cgit v1.2.3-70-g09d2 From e034030f3974f725ce11360dcdd166c2ae32e2b8 Mon Sep 17 00:00:00 2001 From: Zeshan Khattak Date: Sun, 29 Dec 2019 10:03:26 +0500 Subject: Laravel artisan commands extension (#8425) --- plugins/laravel/README.md | 17 +++++++++++++++++ plugins/laravel/laravel.plugin.zsh | 15 +++++++++++++++ 2 files changed, 32 insertions(+) (limited to 'plugins') 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' -- cgit v1.2.3-70-g09d2 From d9e64344aa151f9b8e13a4f8054509a5d78bb718 Mon Sep 17 00:00:00 2001 From: sinrimin Date: Sun, 29 Dec 2019 13:04:24 +0800 Subject: -mAdd hitokoto plugin (#8422) --- plugins/hitokoto/README.md | 15 +++++++++++++++ plugins/hitokoto/hitokoto.plugin.zsh | 14 ++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 plugins/hitokoto/README.md create mode 100644 plugins/hitokoto/hitokoto.plugin.zsh (limited to 'plugins') 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”" +} -- cgit v1.2.3-70-g09d2