From c7154e88396fec404edfc8b03899949a2ce284ba Mon Sep 17 00:00:00 2001 From: Jay Schwerberg Date: Tue, 5 Mar 2019 22:34:12 -0800 Subject: [PATCH 1/8] Add pygments style env var for colorized --- plugins/colorize/colorize.plugin.zsh | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/plugins/colorize/colorize.plugin.zsh b/plugins/colorize/colorize.plugin.zsh index b8790f260..4e383867a 100644 --- a/plugins/colorize/colorize.plugin.zsh +++ b/plugins/colorize/colorize.plugin.zsh @@ -1,6 +1,6 @@ # easier alias to use the plugin alias ccat='colorize_via_pygmentize' -alias cless='colorize_via_pygmentize_less' +alias cless='colorize_via_pygmentize_less' colorize_via_pygmentize() { if ! (( $+commands[pygmentize] )); then @@ -8,36 +8,44 @@ colorize_via_pygmentize() { return 1 fi + # If the environment varianle ZSH_COLORIZE_STYLE + # is set, use that theme instead. Otherwise, + # use the default. + if [ -z $ZSH_COLORIZE_STYLE ]; then + ZSH_COLORIZE_STYLE="default" + fi + # pygmentize stdin if no arguments passed if [ $# -eq 0 ]; then - pygmentize -g + pygmentize -O style="$ZSH_COLORIZE_STYLE" -g return $? fi # guess lexer from file extension, or # guess it from file contents if unsuccessful + local FNAME lexer for FNAME in "$@" do lexer=$(pygmentize -N "$FNAME") if [[ $lexer != text ]]; then - pygmentize -l "$lexer" "$FNAME" + pygmentize -O style="$ZSH_COLORIZE_STYLE" -l "$lexer" "$FNAME" else - pygmentize -g "$FNAME" + pygmentize -O style="$ZSH_COLORIZE_STYLE" -g "$FNAME" fi done } -colorize_via_pygmentize_less() ( +colorize_via_pygmentize_less() ( # this function is a subshell so tmp_files can be shared to cleanup function declare -a tmp_files - + cleanup () { [[ ${#tmp_files} -gt 0 ]] && rm -f "${tmp_files[@]}" exit } trap 'cleanup' EXIT HUP TERM INT - + while (( $# != 0 )); do #TODO: filter out less opts tmp_file="$(mktemp --tmpdir "tmp.colorize.XXXX.$(sed 's/\//./g' <<< "$1")")" tmp_files+=("$tmp_file") From a46798b7903dab20adf48bcad7eb69de2c8ed8a7 Mon Sep 17 00:00:00 2001 From: Jay Schwerberg Date: Tue, 5 Mar 2019 22:34:31 -0800 Subject: [PATCH 2/8] Update colorize README.md with env var details --- plugins/colorize/README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/plugins/colorize/README.md b/plugins/colorize/README.md index 71fa87861..d1f878e62 100644 --- a/plugins/colorize/README.md +++ b/plugins/colorize/README.md @@ -11,6 +11,12 @@ To use it, add colorize to the plugins array of your zshrc file: plugins=(... colorize) ``` +## 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"` + ## Usage * `ccat [files]`: colorize the contents of the file (or files, if more than one are provided). From d0e4319a703ab6d1e56a8f615a8d202d3a3753fd Mon Sep 17 00:00:00 2001 From: j-griffith Date: Fri, 3 May 2019 13:22:18 -0600 Subject: [PATCH 3/8] Add PersistentVolumeClaim support to kubectl plugin Just add aliases for PVC actions. --- plugins/kubectl/README.md | 6 ++++++ plugins/kubectl/kubectl.plugin.zsh | 8 ++++++++ 2 files changed, 14 insertions(+) diff --git a/plugins/kubectl/README.md b/plugins/kubectl/README.md index 3343f0195..29dc28d5f 100644 --- a/plugins/kubectl/README.md +++ b/plugins/kubectl/README.md @@ -89,3 +89,9 @@ plugins=(... kubectl) | keno | `kubectl edit node` | Edit nodes resource from the default editor | | kdno | `kubectl describe node` | Describe node resource in detail | | kdelno | `kubectl delete node` | Delete the node | +| | | **Persistent Volume Claim management** | +| kgpvc | `kubectl get pvc` | List all PVCs | +| kgpvcw | `kgpvc --watch` | After listing/getting the requested object, watch for changes | +| kepvc | `kubectl edit pvc` | Edit pvcs from the default editor | +| kdpvc | `kubectl describe pvc` | Descirbe all pvcs | +| kdelpvc | `kubectl delete pvc` | Delete all pvcs matching passed arguments | diff --git a/plugins/kubectl/kubectl.plugin.zsh b/plugins/kubectl/kubectl.plugin.zsh index ab7a1a0a4..31c87ff82 100644 --- a/plugins/kubectl/kubectl.plugin.zsh +++ b/plugins/kubectl/kubectl.plugin.zsh @@ -112,3 +112,11 @@ alias kgno='kubectl get nodes' alias keno='kubectl edit node' alias kdno='kubectl describe node' alias kdelno='kubectl delete node' + +# PVC management. +alias kgpvc='kubectl get pvc' +alias kgpvcw='kgpvc --watch' +alias kepvc='kubectl edit pvc' +alias kdpvc='kubectl describe pvc' +alias kdelpvc='kubectl delete pvc' + From 9060c1ddae7290c88eb91d48567f07624a881376 Mon Sep 17 00:00:00 2001 From: Crackpot Date: Fri, 14 Jun 2019 20:46:08 +0800 Subject: [PATCH 4/8] crcandy: use 24h format in prompt (#7926) --- themes/crcandy.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/crcandy.zsh-theme b/themes/crcandy.zsh-theme index 0a63c1245..5b9cd42f8 100644 --- a/themes/crcandy.zsh-theme +++ b/themes/crcandy.zsh-theme @@ -1,5 +1,5 @@ PROMPT=$' -%{$fg_bold[green]%}%n@%m %{$fg[blue]%}%D{[%I:%M:%S]} %{$reset_color%}%{$fg[white]%}[%~]%{$reset_color%} $(git_prompt_info)\ +%{$fg_bold[green]%}%n@%m %{$fg[blue]%}%D{[%H:%M:%S]} %{$reset_color%}%{$fg[white]%}[%~]%{$reset_color%} $(git_prompt_info)\ %{$fg[blue]%}->%{$fg_bold[blue]%} %#%{$reset_color%} ' ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[green]%}[" From f992d434ec9057a33b9778fd945a6e80d8c2df75 Mon Sep 17 00:00:00 2001 From: SomeDer <48731521+SomeDer@users.noreply.github.com> Date: Sat, 15 Jun 2019 18:47:23 +0100 Subject: [PATCH 5/8] git: add git revert alias (#7841) * git: add `alias grev="git revert"` * Swapping double for single quotes Matching the conventions in the plugin --- plugins/git/git.plugin.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 09998003a..e0ce27fd4 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -199,6 +199,7 @@ alias grbd='git rebase develop' alias grbi='git rebase -i' alias grbm='git rebase master' alias grbs='git rebase --skip' +alias grev='git revert' alias grh='git reset' alias grhh='git reset --hard' alias groh='git reset origin/$(git_current_branch) --hard' From 5f18dbf895675ff22dcbe2afa78b72b74350ea58 Mon Sep 17 00:00:00 2001 From: Sung Won Cho Date: Sun, 16 Jun 2019 03:52:22 +1000 Subject: [PATCH 6/8] Add a completion plugin for dnote (#7885) --- plugins/dnote/README.md | 51 +++++++++++++++++++++++++++++++++++++++++ plugins/dnote/_dnote | 39 +++++++++++++++++++++++++++++++ 2 files changed, 90 insertions(+) create mode 100644 plugins/dnote/README.md create mode 100644 plugins/dnote/_dnote diff --git a/plugins/dnote/README.md b/plugins/dnote/README.md new file mode 100644 index 000000000..e1b9b7044 --- /dev/null +++ b/plugins/dnote/README.md @@ -0,0 +1,51 @@ +# Dnote Plugin + +This plugin adds auto-completion for [Dnote](https://dnote.io) project. + +To use it, add `dnote` to the plugins array in your zshrc file: + +```zsh +plugins=(dnote) +``` + +## Usage + +At the basic level, this plugin completes all Dnote commands. + +```zsh +$ dnote a(press here) +``` + +would result in: + +```zsh +$ dnote add +``` + +For some commands, this plugin dynamically suggests matching book names. + +For instance, if you have three books that begin with 'j': 'javascript', 'job', 'js', + +```zsh +$ dnote view j(press here) +``` + +would result in: + +```zsh +$ dnote v j +javascript job js +``` + +As another example, + +```zsh +$ dnote edit ja(press here) +``` + +would result in: + + +```zsh +$ dnote v javascript +`````` diff --git a/plugins/dnote/_dnote b/plugins/dnote/_dnote new file mode 100644 index 000000000..c8b33486a --- /dev/null +++ b/plugins/dnote/_dnote @@ -0,0 +1,39 @@ +#compdef dnote + +local -a _1st_arguments + +_1st_arguments=( + 'add:add a new note' + 'view:list books, notes, or view a content' + 'edit:edit a note or a book' + 'remove:remove a note or a book' + 'find:find notes by keywords' + 'sync:sync data with the server' + 'login:login to the dnote server' + 'logout:logout from the dnote server' + 'version:print the current version' + 'help:get help about any command' +) + +get_booknames() { + local names=$(dnote view --name-only) + local -a ret + + while read -r line; do + ret+=("${line}") + done <<< "$names" + + echo "$ret" +} + +if (( CURRENT == 2 )); then + _describe -t commands "dnote subcommand" _1st_arguments + return +elif (( CURRENT == 3 )); then + case "$words[2]" in + v|view|a|add) + _alternative \ + "names:book names:($(get_booknames))" + esac +fi + From fec2e56bc9361edb8d403d231117686630c1b85b Mon Sep 17 00:00:00 2001 From: Nicholas Wehr <33910651+wwwehr@users.noreply.github.com> Date: Sun, 16 Jun 2019 00:54:19 +0700 Subject: [PATCH 7/8] adding gatsby command set (#7831) --- plugins/gatsby/README.md | 7 +++++++ plugins/gatsby/_gatsby | 24 ++++++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 plugins/gatsby/README.md create mode 100644 plugins/gatsby/_gatsby diff --git a/plugins/gatsby/README.md b/plugins/gatsby/README.md new file mode 100644 index 000000000..36846a228 --- /dev/null +++ b/plugins/gatsby/README.md @@ -0,0 +1,7 @@ +# gatsby autocomplete plugin + +* Adds autocomplete options for all gatsby commands. + +## Requirements + +In order to make this work, you will need to have gatsby set up in your path. diff --git a/plugins/gatsby/_gatsby b/plugins/gatsby/_gatsby new file mode 100644 index 000000000..66eb02f00 --- /dev/null +++ b/plugins/gatsby/_gatsby @@ -0,0 +1,24 @@ +#compdef gatsby +#autoload + +# in order to make this work, you will need to have gatsby +# https://www.gatsbyjs.org/ + +local -a _1st_arguments +_1st_arguments=( +'develop:Start development server. Watches files, rebuilds, and hot reloads if something changes' +'build:Build a Gatsby project.' +'serve:Serve previously built Gatsby site.' +'info:Get environment information for debugging and issue reporting' +'clean:Wipe the local gatsby environment including built assets and cache' +'repl:Get a node repl with context of Gatsby environment, see (add docs link here)' +'new: [rootPath] [starter] Create new Gatsby project.' +'telemetry:Enable or disable Gatsby anonymous analytics collection.' +) + +_arguments -C '*:: :->subcmds' && return 0 + +if (( CURRENT == 1 )); then + _describe -t commands "gatsby subcommand" _1st_arguments + return +fi From c105c04b6b1ddb917c12eadacb26c252f44ddfad Mon Sep 17 00:00:00 2001 From: Jason Schwerberg Date: Sat, 15 Jun 2019 11:49:33 -0700 Subject: [PATCH 8/8] kubectl: add statefulset aliases (#7826) --- plugins/kubectl/README.md | 9 +++++++++ plugins/kubectl/kubectl.plugin.zsh | 10 ++++++++++ 2 files changed, 19 insertions(+) diff --git a/plugins/kubectl/README.md b/plugins/kubectl/README.md index 4541c7e92..c0db59362 100644 --- a/plugins/kubectl/README.md +++ b/plugins/kubectl/README.md @@ -96,3 +96,12 @@ plugins=(... kubectl) | kepvc | `kubectl edit pvc` | Edit pvcs from the default editor | | kdpvc | `kubectl describe pvc` | Descirbe all pvcs | | kdelpvc | `kubectl delete pvc` | Delete all pvcs matching passed arguments | +| | | | +| kgss | `kubectl get statefulset` | List the statefulsets in ps format | +| kgssw | `kgss --watch` | After getting the list of statefulsets, watch for changes | +| kgsswide| `kgss -o wide` | After getting the statefulsets, output in plain-text format with any additional information | +| kess | `kubectl edit statefulset` | Edit statefulset resource from the default editor | +| kdss | `kubectl describe statefulset` | Describe statefulset resource in detail | +| kdelss | `kubectl delete statefulset` | Delete the statefulset | +| ksss | `kubectl scale statefulset` | Scale a statefulset | +| krsss | `kubectl rollout status statefulset`| Check the rollout status of a deployment | diff --git a/plugins/kubectl/kubectl.plugin.zsh b/plugins/kubectl/kubectl.plugin.zsh index 5097732db..6c1696d5e 100644 --- a/plugins/kubectl/kubectl.plugin.zsh +++ b/plugins/kubectl/kubectl.plugin.zsh @@ -96,6 +96,16 @@ alias kgrs='kubectl get rs' alias krh='kubectl rollout history' alias kru='kubectl rollout undo' +# Statefulset management. +alias kgss='kubectl get statefulset' +alias kgssw='kgss --watch' +alias kgsswide='kgss -o wide' +alias kess='kubectl edit statefulset' +alias kdss='kubectl describe statefulset' +alias kdelss='kubectl delete statefulset' +alias ksss='kubectl scale statefulset' +alias krsss='kubectl rollout status statefulset' + # Port forwarding alias kpf="kubectl port-forward"