From 6f6c5789f4698bbd8c6b8538efb3dbb986e17867 Mon Sep 17 00:00:00 2001 From: 15cm Date: Wed, 7 Feb 2018 22:43:46 -0500 Subject: [PATCH 01/18] [!] change url to ssh for dev --- .gitmodules | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitmodules b/.gitmodules index b65273a45..20ec57307 100644 --- a/.gitmodules +++ b/.gitmodules @@ -16,7 +16,7 @@ url = https://github.com/mollifier/cd-gitroot [submodule "custom/plugins/zce"] path = custom/plugins/zce - url = https://github.com/15cm/zce.zsh + url = git@github.com:15cm/zce.zsh.git [submodule "custom/plugins/yadm"] path = custom/plugins/yadm - url = https://github.com/15cm/yadm-zsh.git + url = git@github.com:15cm/yadm-zsh.git From 14f5f5402743ec1acc7f6c5de1ba8288e25cb7b2 Mon Sep 17 00:00:00 2001 From: 15cm Date: Thu, 8 Feb 2018 22:31:58 -0500 Subject: [PATCH 02/18] [+] fzf-tab-completion --- .gitmodules | 3 +++ custom/plugins/fzf-tab-completion | 1 + 2 files changed, 4 insertions(+) create mode 160000 custom/plugins/fzf-tab-completion diff --git a/.gitmodules b/.gitmodules index 20ec57307..586e6c8c8 100644 --- a/.gitmodules +++ b/.gitmodules @@ -20,3 +20,6 @@ [submodule "custom/plugins/yadm"] path = custom/plugins/yadm url = git@github.com:15cm/yadm-zsh.git +[submodule "custom/plugins/fzf-tab-completion"] + path = custom/plugins/fzf-tab-completion + url = git@github.com:15cm/fzf-tab-completion.git diff --git a/custom/plugins/fzf-tab-completion b/custom/plugins/fzf-tab-completion new file mode 160000 index 000000000..b3036f0f9 --- /dev/null +++ b/custom/plugins/fzf-tab-completion @@ -0,0 +1 @@ +Subproject commit b3036f0f94393d3e79bbb2945cbd50b915cd12c2 From bb879ecd04b3a85a4cab0768dcfce5c52688b87b Mon Sep 17 00:00:00 2001 From: 15cm Date: Fri, 9 Feb 2018 12:34:37 -0500 Subject: [PATCH 03/18] [-] fzf-tab-completion --- .gitmodules | 3 --- custom/plugins/fzf-tab-completion | 1 - 2 files changed, 4 deletions(-) delete mode 160000 custom/plugins/fzf-tab-completion diff --git a/.gitmodules b/.gitmodules index 586e6c8c8..20ec57307 100644 --- a/.gitmodules +++ b/.gitmodules @@ -20,6 +20,3 @@ [submodule "custom/plugins/yadm"] path = custom/plugins/yadm url = git@github.com:15cm/yadm-zsh.git -[submodule "custom/plugins/fzf-tab-completion"] - path = custom/plugins/fzf-tab-completion - url = git@github.com:15cm/fzf-tab-completion.git diff --git a/custom/plugins/fzf-tab-completion b/custom/plugins/fzf-tab-completion deleted file mode 160000 index b3036f0f9..000000000 --- a/custom/plugins/fzf-tab-completion +++ /dev/null @@ -1 +0,0 @@ -Subproject commit b3036f0f94393d3e79bbb2945cbd50b915cd12c2 From 2ff9560ad3fc6a3da256d34d0ba804b01d222293 Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Fri, 23 Feb 2018 12:58:12 -0800 Subject: [PATCH 04/18] Adding link to our other open source projects page --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 541f48d40..a6d74cbd2 100644 --- a/README.md +++ b/README.md @@ -248,4 +248,4 @@ Oh My Zsh is released under the [MIT license](LICENSE.txt). ![Planet Argon](https://pa-github-assets.s3.amazonaws.com/PARGON_logo_digital_COL-small.jpg) -Oh My Zsh was started by the team at [Planet Argon](https://www.planetargon.com/?utm_source=github), a [Ruby on Rails development agency](https://www.planetargon.com/skills/ruby-on-rails-development?utm_source=github). +Oh My Zsh was started by the team at [Planet Argon](https://www.planetargon.com/?utm_source=github), a [Ruby on Rails development agency](https://www.planetargon.com/skills/ruby-on-rails-development?utm_source=github). Check out our [other open source projects](https://www.planetargon.com/open-source?utm_source=github). From 6d75f556e0f1d275d483746c84edb966de546f7e Mon Sep 17 00:00:00 2001 From: vadimkim Date: Fri, 9 Mar 2018 18:11:09 +0200 Subject: [PATCH 05/18] fix "kubectl logs" (#6667) logs doesn't have "pods" parameter --- plugins/kubectl/kubectl.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/kubectl/kubectl.plugin.zsh b/plugins/kubectl/kubectl.plugin.zsh index 88177b5a0..913b65cca 100644 --- a/plugins/kubectl/kubectl.plugin.zsh +++ b/plugins/kubectl/kubectl.plugin.zsh @@ -20,7 +20,7 @@ alias kccc='k config current-context' # Pod management. alias kgp='k get pods' -alias klp='k logs pods' +alias klp='k logs' alias kep='k edit pods' alias kdp='k describe pods' alias kdelp='k delete pods' From 52c4e134cc9e6348ebbcd5ba73501f903b57102b Mon Sep 17 00:00:00 2001 From: Nikolay Panov Date: Fri, 9 Mar 2018 08:11:30 -0800 Subject: [PATCH 06/18] Update django.plugin.zsh (#6634) Added support for 'showmigrations' django command. --- plugins/django/django.plugin.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/django/django.plugin.zsh b/plugins/django/django.plugin.zsh index 35865a692..29a51d29d 100644 --- a/plugins/django/django.plugin.zsh +++ b/plugins/django/django.plugin.zsh @@ -349,6 +349,7 @@ _managepy-commands() { 'runfcgi:Run this project as a fastcgi (or some other protocol supported by flup) application,' 'runserver:Starts a lightweight Web server for development.' 'shell:Runs a Python interactive interpreter.' + 'showmigrations:Shows all available migrations for the current project.' 'sql:Prints the CREATE TABLE SQL statements for the given app name(s).' 'sqlall:Prints the CREATE TABLE, custom SQL and CREATE INDEX SQL statements for the given model module name(s).' 'sqlclear:Prints the DROP TABLE SQL statements for the given app name(s).' From 84e90669847771344ec949c4c2a775882c519624 Mon Sep 17 00:00:00 2001 From: Andrew Matheny Date: Fri, 9 Mar 2018 11:11:52 -0500 Subject: [PATCH 07/18] Update docker-compose autocompletion (#6607) --- plugins/docker-compose/_docker-compose | 38 ++++++++++++++++++++------ 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/plugins/docker-compose/_docker-compose b/plugins/docker-compose/_docker-compose index 2947cef38..c0a54cced 100644 --- a/plugins/docker-compose/_docker-compose +++ b/plugins/docker-compose/_docker-compose @@ -3,11 +3,6 @@ # Description # ----------- # zsh completion for docker-compose -# https://github.com/sdurrheimer/docker-compose-zsh-completion -# ------------------------------------------------------------------------- -# Version -# ------- -# 1.5.0 # ------------------------------------------------------------------------- # Authors # ------- @@ -199,7 +194,9 @@ __docker-compose_subcommand() { (build) _arguments \ $opts_help \ + "*--build-arg=[Set build-time variables for one service.]:=: " \ '--force-rm[Always remove intermediate containers.]' \ + '--memory[Memory limit for the build container.]' \ '--no-cache[Do not use cache when building the image.]' \ '--pull[Always attempt to pull a newer version of the image.]' \ '*:services:__docker-compose_services_from_build' && ret=0 @@ -207,13 +204,16 @@ __docker-compose_subcommand() { (bundle) _arguments \ $opts_help \ + '--push-images[Automatically push images for any services which have a `build` option specified.]' \ '(--output -o)'{--output,-o}'[Path to write the bundle file to. Defaults to ".dab".]:file:_files' && ret=0 ;; (config) _arguments \ $opts_help \ '(--quiet -q)'{--quiet,-q}"[Only validate the configuration, don't print anything.]" \ - '--services[Print the service names, one per line.]' && ret=0 + '--resolve-image-digests[Pin image tags to digests.]' \ + '--services[Print the service names, one per line.]' \ + '--volumes[Print the volume names, one per line.]' && ret=0 ;; (create) _arguments \ @@ -242,7 +242,7 @@ __docker-compose_subcommand() { $opts_help \ '-d[Detached mode: Run command in the background.]' \ '--privileged[Give extended privileges to the process.]' \ - '--user=[Run the command as this user.]:username:_users' \ + '(-u --user)'{-u,--user=}'[Run the command as this user.]:username:_users' \ '-T[Disable pseudo-tty allocation. By default `docker-compose exec` allocates a TTY.]' \ '--index=[Index of the container if there are multiple instances of a service \[default: 1\]]:index: ' \ '(-):running services:__docker-compose_runningservices' \ @@ -252,6 +252,12 @@ __docker-compose_subcommand() { (help) _arguments ':subcommand:__docker-compose_commands' && ret=0 ;; + (images) + _arguments \ + $opts_help \ + '-q[Only display IDs]' \ + '*:services:__docker-compose_services_all' && ret=0 + ;; (kill) _arguments \ $opts_help \ @@ -308,16 +314,17 @@ __docker-compose_subcommand() { (run) _arguments \ $opts_help \ + $opts_no_deps \ '-d[Detached mode: Run container in the background, print new container name.]' \ '*-e[KEY=VAL Set an environment variable (can be used multiple times)]:environment variable KEY=VAL: ' \ '--entrypoint[Overwrite the entrypoint of the image.]:entry point: ' \ '--name=[Assign a name to the container]:name: ' \ - $opts_no_deps \ '(-p --publish)'{-p,--publish=}"[Publish a container's port(s) to the host]" \ '--rm[Remove container after run. Ignored in detached mode.]' \ "--service-ports[Run command with the service's ports enabled and mapped to the host.]" \ '-T[Disable pseudo-tty allocation. By default `docker-compose run` allocates a TTY.]' \ '(-u --user)'{-u,--user=}'[Run as specified username or uid]:username or uid:_users' \ + '(-v --volume)*'{-v,--volume=}'[Bind mount a volume]:volume: ' \ '(-w --workdir)'{-w,--workdir=}'[Working directory inside the container]:workdir: ' \ '(-):services:__docker-compose_services' \ '(-):command: _command_names -e' \ @@ -340,6 +347,11 @@ __docker-compose_subcommand() { $opts_timeout \ '*:running services:__docker-compose_runningservices' && ret=0 ;; + (top) + _arguments \ + $opts_help \ + '*:running services:__docker-compose_runningservices' && ret=0 + ;; (unpause) _arguments \ $opts_help \ @@ -385,9 +397,17 @@ _docker-compose() { integer ret=1 typeset -A opt_args + local file_description + + if [[ -n ${words[(r)-f]} || -n ${words[(r)--file]} ]] ; then + file_description="Specify an override docker-compose file (default: docker-compose.override.yml)" + else + file_description="Specify an alternate docker-compose file (default: docker-compose.yml)" + fi + _arguments -C \ '(- :)'{-h,--help}'[Get help]' \ - '(-f --file)'{-f,--file}'[Specify an alternate docker-compose file (default: docker-compose.yml)]:file:_files -g "*.yml"' \ + '*'{-f,--file}"[${file_description}]:file:_files -g '*.yml'" \ '(-p --project-name)'{-p,--project-name}'[Specify an alternate project name (default: directory name)]:project name:' \ '--verbose[Show more output]' \ '(- :)'{-v,--version}'[Print version and exit]' \ From 7c2028e84ede1ece09fa2dd13b5b6d8ba59ddfd1 Mon Sep 17 00:00:00 2001 From: Luke Date: Fri, 9 Mar 2018 09:12:42 -0700 Subject: [PATCH 08/18] Update/add kubectl logging commands (#6639) --- plugins/kubectl/kubectl.plugin.zsh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plugins/kubectl/kubectl.plugin.zsh b/plugins/kubectl/kubectl.plugin.zsh index 913b65cca..a29773ee9 100644 --- a/plugins/kubectl/kubectl.plugin.zsh +++ b/plugins/kubectl/kubectl.plugin.zsh @@ -20,7 +20,6 @@ alias kccc='k config current-context' # Pod management. alias kgp='k get pods' -alias klp='k logs' alias kep='k edit pods' alias kdp='k describe pods' alias kdelp='k delete pods' @@ -48,3 +47,7 @@ alias krsd='k rollout status deployment' alias kgrs='k get rs' alias krh='k rollout history' alias kru='k rollout undo' + +# Logs +alias kl='k logs' +alias klf='k logs -f' From afad3e1f8d7b50b30493918912cd823c0e458780 Mon Sep 17 00:00:00 2001 From: Andrea Giardini Date: Fri, 9 Mar 2018 17:14:09 +0100 Subject: [PATCH 09/18] Add kubectl alias for apply (#6662) --- plugins/kubectl/kubectl.plugin.zsh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/kubectl/kubectl.plugin.zsh b/plugins/kubectl/kubectl.plugin.zsh index a29773ee9..97e429aac 100644 --- a/plugins/kubectl/kubectl.plugin.zsh +++ b/plugins/kubectl/kubectl.plugin.zsh @@ -9,6 +9,9 @@ fi # This command is used ALOT both below and in daily life alias k=kubectl +# Apply a YML file +alias kaf='k apply -f' + # Drop into an interactive terminal on a container alias keti='k exec -ti' From e6e2b3d42fc7e88d293d380f7861fa87e0856e62 Mon Sep 17 00:00:00 2001 From: Jon Mosco <1970496+jonmosco@users.noreply.github.com> Date: Fri, 9 Mar 2018 11:14:36 -0500 Subject: [PATCH 10/18] kube-ps1 zsh prompt helper (#6507) --- plugins/kube-ps1/README.md | 76 +++++++++++++++++++++ plugins/kube-ps1/kube-ps1.zsh | 123 ++++++++++++++++++++++++++++++++++ 2 files changed, 199 insertions(+) create mode 100644 plugins/kube-ps1/README.md create mode 100644 plugins/kube-ps1/kube-ps1.zsh diff --git a/plugins/kube-ps1/README.md b/plugins/kube-ps1/README.md new file mode 100644 index 000000000..a572773a3 --- /dev/null +++ b/plugins/kube-ps1/README.md @@ -0,0 +1,76 @@ +Kubernetes prompt for zsh +========================= + +A Kubernetes (k8s) zsh prompt that displays the current cluster cluster +and the namespace. + +Inspired by several tools used to simplify usage of kubectl + +NOTE: If you are not using zsh, check out [kube-ps1](https://github.com/jonmosco/kube-ps1) designed for bash +as well as zsh. + +## Requirements + +The default prompt assumes you have the kubectl command line utility installed. It +can be obtained here: + +[Install and Set up kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/) + +If using this with OpenShift, the oc tool needs installed. It can be obtained from here: + +[OC Client Tools](https://www.openshift.org/download.html) + +## Helper utilities + +There are several great tools that make using kubectl very enjoyable. + +[kubectx and kubenx](https://github.com/ahmetb/kubectx) are great for +fast switching between clusters and namespaces. + +## Prompt Structure + +The prompt layout is: + +``` +(|:) +``` + +Supported platforms: +* k8s - Kubernetes +* ocp - OpenShift + +## Install + +1. Clone this repository +2. Source the kube-ps1.zsh in your ~./.zshrc + +ZSH: +``` +source path/kube-ps1.sh +PROMPT='$(kube_ps1) ' +``` + +## Colors + +The colors are of my opinion. Blue was used as the prefix to match the Kubernetes +color as closely as possible. Red was chosen as the cluster name to stand out, and cyan +for the namespace. These can of course be changed. + +## Customization + +The default settings can be overridden in ~/.zshrc + +| Variable | Default | Meaning | +| :------- | :-----: | ------- | +| `KUBE_PS1_DEFAULT` | `true` | Default settings for the prompt | +| `KUBE_PS1_PREFIX` | `(` | Prompt opening character | +| `KUBE_PS1_DEFAULT_LABEL` | `⎈ ` | Default prompt symbol | +| `KUBE_PS1_SEPERATOR` | `\|` | Separator between symbol and cluster name | +| `KUBE_PS1_PLATFORM` | `kubectl` | Cluster type and binary to use | +| `KUBE_PS1_DIVIDER` | `:` | Separator between cluster and namespace | +| `KUBE_PS1_SUFFIX` | `)` | Prompt closing character | +| `KUBE_PS1_DEFAULT_LABEL_IMG` | `false` | Use Kubernetes img as the label: ☸️ | + +## Contributors + +Jared Yanovich diff --git a/plugins/kube-ps1/kube-ps1.zsh b/plugins/kube-ps1/kube-ps1.zsh new file mode 100644 index 000000000..e1cb4339d --- /dev/null +++ b/plugins/kube-ps1/kube-ps1.zsh @@ -0,0 +1,123 @@ +#!/bin/zsh + +# Kubernetes prompt helper for bash/zsh +# Displays current context and namespace + +# Copyright 2017 Jon Mosco +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Debug +[[ -n $DEBUG ]] && set -x + +setopt PROMPT_SUBST +add-zsh-hook precmd _kube_ps1_load +zmodload zsh/stat + +# Default values for the prompt +# Override these values in ~/.zshrc or ~/.bashrc +KUBE_PS1_DEFAULT="${KUBE_PS1_DEFAULT:=true}" +KUBE_PS1_PREFIX="(" +KUBE_PS1_DEFAULT_LABEL="${KUBE_PS1_DEFAULT_LABEL:="⎈ "}" +KUBE_PS1_DEFAULT_LABEL_IMG="${KUBE_PS1_DEFAULT_LABEL_IMG:=false}" +KUBE_PS1_SEPERATOR="|" +KUBE_PS1_PLATFORM="${KUBE_PS1_PLATFORM:="kubectl"}" +KUBE_PS1_DIVIDER=":" +KUBE_PS1_SUFFIX=")" +KUBE_PS1_UNAME=$(uname) +KUBE_PS1_LAST_TIME=0 + +kube_ps1_label () { + + [[ "${KUBE_PS1_DEFAULT_LABEL_IMG}" == false ]] && return + + if [[ "${KUBE_PS1_DEFAULT_LABEL_IMG}" == true ]]; then + local KUBE_LABEL="☸️ " + fi + + KUBE_PS1_DEFAULT_LABEL="${KUBE_LABEL}" + +} + +_kube_ps1_split() { + type setopt >/dev/null 2>&1 && setopt SH_WORD_SPLIT + local IFS=$1 + echo $2 +} + +_kube_ps1_file_newer_than() { + + local mtime + local file=$1 + local check_time=$2 + mtime=$(stat +mtime "${file}") + + [ "${mtime}" -gt "${check_time}" ] + +} + +_kube_ps1_load() { + # kubectl will read the environment variable $KUBECONFIG + # otherwise set it to ~/.kube/config + KUBECONFIG="${KUBECONFIG:=$HOME/.kube/config}" + + for conf in $(_kube_ps1_split : "${KUBECONFIG}"); do + # TODO: check existence of $conf + if _kube_ps1_file_newer_than "${conf}" "${KUBE_PS1_LAST_TIME}"; then + _kube_ps1_get_context_ns + return + fi + done +} + +_kube_ps1_get_context_ns() { + + # Set the command time + KUBE_PS1_LAST_TIME=$(date +%s) + + if [[ "${KUBE_PS1_DEFAULT}" == true ]]; then + local KUBE_BINARY="${KUBE_PS1_PLATFORM}" + elif [[ "${KUBE_PS1_DEFAULT}" == false ]] && [[ "${KUBE_PS1_PLATFORM}" == "kubectl" ]];then + local KUBE_BINARY="kubectl" + elif [[ "${KUBE_PS1_PLATFORM}" == "oc" ]]; then + local KUBE_BINARY="oc" + fi + + KUBE_PS1_CONTEXT="$(${KUBE_BINARY} config current-context)" + KUBE_PS1_NAMESPACE="$(${KUBE_BINARY} config view --minify --output 'jsonpath={..namespace}')" + # Set namespace to default if it is not defined + KUBE_PS1_NAMESPACE="${KUBE_PS1_NAMESPACE:-default}" + +} + +# source our symbol +kube_ps1_label + +# Build our prompt +kube_ps1 () { + local reset_color="%f" + local blue="%F{blue}" + local red="%F{red}" + local cyan="%F{cyan}" + + KUBE_PS1="${reset_color}$KUBE_PS1_PREFIX" + KUBE_PS1+="${blue}$KUBE_PS1_DEFAULT_LABEL" + KUBE_PS1+="${reset_color}$KUBE_PS1_SEPERATOR" + KUBE_PS1+="${red}$KUBE_PS1_CONTEXT${reset_color}" + KUBE_PS1+="$KUBE_PS1_DIVIDER" + KUBE_PS1+="${cyan}$KUBE_PS1_NAMESPACE${reset_color}" + KUBE_PS1+="$KUBE_PS1_SUFFIX" + + echo "${KUBE_PS1}" + +} From ce23ef9a2fcd71d2428d886f83af09296537d8ac Mon Sep 17 00:00:00 2001 From: Lauri Lavanti Date: Fri, 9 Mar 2018 18:14:51 +0200 Subject: [PATCH 11/18] Add alias for docker-compose pull (#6665) --- plugins/docker-compose/docker-compose.plugin.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/docker-compose/docker-compose.plugin.zsh b/plugins/docker-compose/docker-compose.plugin.zsh index 4e4ac114a..d69769010 100644 --- a/plugins/docker-compose/docker-compose.plugin.zsh +++ b/plugins/docker-compose/docker-compose.plugin.zsh @@ -21,3 +21,4 @@ alias dcup='docker-compose up' alias dcdn='docker-compose down' alias dcl='docker-compose logs' alias dclf='docker-compose logs -f' +alias dcpull='docker-compose pull' From 7ed82b4df6d381ef26a4dbdf253bf414497adcd1 Mon Sep 17 00:00:00 2001 From: Quentin Revel Date: Sat, 10 Mar 2018 00:16:15 +0800 Subject: [PATCH 12/18] Update _docker-compose to latest version (#6315) From 5f2c34374babf5749f2701a10cd81800b41fc908 Mon Sep 17 00:00:00 2001 From: Eric Hudon Date: Sun, 18 Mar 2018 17:10:34 -0400 Subject: [PATCH 13/18] Change the br action to branch to be more explicit. (#6678) --- plugins/jira/README.md | 1 + plugins/jira/jira.plugin.zsh | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/jira/README.md b/plugins/jira/README.md index efb8a743a..a934ae68c 100644 --- a/plugins/jira/README.md +++ b/plugins/jira/README.md @@ -21,6 +21,7 @@ jira new # opens a new issue jira dashboard # opens your JIRA dashboard jira reported [username] # queries for issues reported by a user jira assigned [username] # queries for issues assigned to a user +jira branch # opens an existing issue matching the current branch name jira ABC-123 # opens an existing issue jira ABC-123 m # opens an existing issue for adding a comment ``` diff --git a/plugins/jira/jira.plugin.zsh b/plugins/jira/jira.plugin.zsh index 0340dd7f4..052481a60 100644 --- a/plugins/jira/jira.plugin.zsh +++ b/plugins/jira/jira.plugin.zsh @@ -60,7 +60,7 @@ function jira() { else # Anything that doesn't match a special action is considered an issue name # but `branch` is a special case that will parse the current git branch - if [[ "$action" == "br" ]]; then + if [[ "$action" == "branch" ]]; then local issue_arg=$(git rev-parse --abbrev-ref HEAD) local issue="${jira_prefix}${issue_arg}" else From 0cec4626219bfd5a163986ebe3745fc31b593446 Mon Sep 17 00:00:00 2001 From: Lauri Lavanti Date: Sun, 18 Mar 2018 23:10:58 +0200 Subject: [PATCH 14/18] Add docker-compose start alias 'dcstart' (#6675) --- plugins/docker-compose/docker-compose.plugin.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/docker-compose/docker-compose.plugin.zsh b/plugins/docker-compose/docker-compose.plugin.zsh index d69769010..24bea318b 100644 --- a/plugins/docker-compose/docker-compose.plugin.zsh +++ b/plugins/docker-compose/docker-compose.plugin.zsh @@ -22,3 +22,4 @@ alias dcdn='docker-compose down' alias dcl='docker-compose logs' alias dclf='docker-compose logs -f' alias dcpull='docker-compose pull' +alias dcstart='docker-compose start' From 5bed7e7ea8d1226c2674a43e784c506f5c43cc4a Mon Sep 17 00:00:00 2001 From: 15cm Date: Sat, 24 Mar 2018 11:39:48 -0400 Subject: [PATCH 15/18] [-] useless config --- .gitignore | 3 ++ lib/clipboard.zsh | 86 ----------------------------------------------- lib/grep.zsh | 28 --------------- 3 files changed, 3 insertions(+), 114 deletions(-) delete mode 100644 lib/clipboard.zsh delete mode 100644 lib/grep.zsh diff --git a/.gitignore b/.gitignore index bdb45bc2f..e88bf5873 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,6 @@ example.zsh # temp files directories cache/ log/ + +lib/clipboard.zsh +lib/grep.zsh diff --git a/lib/clipboard.zsh b/lib/clipboard.zsh deleted file mode 100644 index 2c93d1bb5..000000000 --- a/lib/clipboard.zsh +++ /dev/null @@ -1,86 +0,0 @@ -# System clipboard integration -# -# This file has support for doing system clipboard copy and paste operations -# from the command line in a generic cross-platform fashion. -# -# On OS X and Windows, the main system clipboard or "pasteboard" is used. On other -# Unix-like OSes, this considers the X Windows CLIPBOARD selection to be the -# "system clipboard", and the X Windows `xclip` command must be installed. - -# clipcopy - Copy data to clipboard -# -# Usage: -# -# | clipcopy - copies stdin to clipboard -# -# clipcopy - copies a file's contents to clipboard -# -function clipcopy() { - emulate -L zsh - local file=$1 - if [[ $OSTYPE == darwin* ]]; then - if [[ -z $file ]]; then - pbcopy - else - cat $file | pbcopy - fi - elif [[ $OSTYPE == cygwin* ]]; then - if [[ -z $file ]]; then - cat > /dev/clipboard - else - cat $file > /dev/clipboard - fi - else - if (( $+commands[xclip] )); then - if [[ -z $file ]]; then - xclip -in -selection clipboard - else - xclip -in -selection clipboard $file - fi - elif (( $+commands[xsel] )); then - if [[ -z $file ]]; then - xsel --clipboard --input - else - cat "$file" | xsel --clipboard --input - fi - else - print "clipcopy: Platform $OSTYPE not supported or xclip/xsel not installed" >&2 - return 1 - fi - fi -} - -# clippaste - "Paste" data from clipboard to stdout -# -# Usage: -# -# clippaste - writes clipboard's contents to stdout -# -# clippaste | - pastes contents and pipes it to another process -# -# clippaste > - paste contents to a file -# -# Examples: -# -# # Pipe to another process -# clippaste | grep foo -# -# # Paste to a file -# clippaste > file.txt -function clippaste() { - emulate -L zsh - if [[ $OSTYPE == darwin* ]]; then - pbpaste - elif [[ $OSTYPE == cygwin* ]]; then - cat /dev/clipboard - else - if (( $+commands[xclip] )); then - xclip -out -selection clipboard - elif (( $+commands[xsel] )); then - xsel --clipboard --output - else - print "clipcopy: Platform $OSTYPE not supported or xclip/xsel not installed" >&2 - return 1 - fi - fi -} diff --git a/lib/grep.zsh b/lib/grep.zsh deleted file mode 100644 index abc1650a1..000000000 --- a/lib/grep.zsh +++ /dev/null @@ -1,28 +0,0 @@ -# is x grep argument available? -grep-flag-available() { - echo | grep $1 "" >/dev/null 2>&1 -} - -GREP_OPTIONS="" - -# color grep results -if grep-flag-available --color=auto; then - GREP_OPTIONS+=" --color=auto" -fi - -# ignore VCS folders (if the necessary grep flags are available) -VCS_FOLDERS="{.bzr,CVS,.git,.hg,.svn}" - -if grep-flag-available --exclude-dir=.cvs; then - GREP_OPTIONS+=" --exclude-dir=$VCS_FOLDERS" -elif grep-flag-available --exclude=.cvs; then - GREP_OPTIONS+=" --exclude=$VCS_FOLDERS" -fi - -# export grep settings -alias grep="grep $GREP_OPTIONS" - -# clean up -unset GREP_OPTIONS -unset VCS_FOLDERS -unfunction grep-flag-available From 0f88a656d9b382894cd0eccfa02ea1a146c14471 Mon Sep 17 00:00:00 2001 From: 15cm Date: Sat, 24 Mar 2018 11:40:39 -0400 Subject: [PATCH 16/18] [!] optimize --- lib/misc.zsh | 4 ++-- oh-my-zsh.sh | 19 +++++++++++++++++-- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/lib/misc.zsh b/lib/misc.zsh index 3052b7710..f5b710778 100644 --- a/lib/misc.zsh +++ b/lib/misc.zsh @@ -19,8 +19,8 @@ fi setopt long_list_jobs ## pager -env_default PAGER 'less' -env_default LESS '-R' +[[ -n "$PAGER" ]] || export PAGER='less' +[[ -n "$PAGER" ]] || export PAGER='less' ## super user alias alias _='sudo' diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index 7f78e4140..08c2b8a35 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -64,6 +64,11 @@ if [ -z "$ZSH_COMPDUMP" ]; then ZSH_COMPDUMP="${ZDOTDIR:-${HOME}}/.zcompdump-${SHORT_HOST}-${ZSH_VERSION}" fi +# On slow systems, checking the cached .zcompdump file to see if it must be +# regenerated adds a noticable delay to zsh startup. This little hack restricts +# it to once a day. It should be pasted into your own completion file. +#https://gist.github.com/ctechols/ca1035271ad134841284 +setopt extendedglob if [[ $ZSH_DISABLE_COMPFIX != true ]]; then # If completion insecurities exist, warn the user without enabling completions. if ! compaudit &>/dev/null; then @@ -71,10 +76,20 @@ if [[ $ZSH_DISABLE_COMPFIX != true ]]; then handle_completion_insecurities # Else, enable and cache completions to the desired file. else - compinit -d "${ZSH_COMPDUMP}" + if [[ -n "${ZSH_COMPDUMP}"(#qN.mh+24) ]]; then + compinit -d "${ZSH_COMPDUMP}" + compdump + else + compinit -C + fi fi else - compinit -i -d "${ZSH_COMPDUMP}" + if [[ -n "${ZSH_COMPDUMP}"(#qN.mh+24) ]]; then + compinit -i -d "${ZSH_COMPDUMP}" + compdump + else + compinit -C + fi fi # Load all of the plugins that were defined in ~/.zshrc From c8ea383538d692062c99aadb8bbbec10c633e523 Mon Sep 17 00:00:00 2001 From: 15cm Date: Mon, 9 Apr 2018 15:58:28 -0400 Subject: [PATCH 17/18] [+] plugin alias-tips --- .gitmodules | 3 +++ custom/plugins/alias-tips | 1 + 2 files changed, 4 insertions(+) create mode 160000 custom/plugins/alias-tips diff --git a/.gitmodules b/.gitmodules index 20ec57307..671f4aed0 100644 --- a/.gitmodules +++ b/.gitmodules @@ -20,3 +20,6 @@ [submodule "custom/plugins/yadm"] path = custom/plugins/yadm url = git@github.com:15cm/yadm-zsh.git +[submodule "custom/plugins/alias-tips"] + path = custom/plugins/alias-tips + url = https://github.com/djui/alias-tips diff --git a/custom/plugins/alias-tips b/custom/plugins/alias-tips new file mode 160000 index 000000000..9354269a7 --- /dev/null +++ b/custom/plugins/alias-tips @@ -0,0 +1 @@ +Subproject commit 9354269a787864bfec1a9893be035dca0712313b From ea61f6892e610447a28cda7ee442e639ba3fe827 Mon Sep 17 00:00:00 2001 From: 15cm Date: Mon, 9 Apr 2018 16:21:33 -0400 Subject: [PATCH 18/18] [!] bgnotify: always nofity when exceeding threshold --- plugins/bgnotify/bgnotify.plugin.zsh | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/plugins/bgnotify/bgnotify.plugin.zsh b/plugins/bgnotify/bgnotify.plugin.zsh index 459f5214e..463b1cf06 100755 --- a/plugins/bgnotify/bgnotify.plugin.zsh +++ b/plugins/bgnotify/bgnotify.plugin.zsh @@ -16,7 +16,7 @@ if ! (type bgnotify_formatted | grep -q 'function'); then ## allow custom functi elapsed="$(( $3 % 60 ))s" (( $3 >= 60 )) && elapsed="$((( $3 % 3600) / 60 ))m $elapsed" (( $3 >= 3600 )) && elapsed="$(( $3 / 3600 ))h $elapsed" - [ $1 -eq 0 ] && bgnotify "#win (took $elapsed)" "$2" || bgnotify "#fail (took $elapsed)" "$2" + [ $1 -eq 0 ] && bgnotify "#done (took $elapsed)" "$2" || bgnotify "#fail (took $elapsed)" "$2" } fi @@ -32,11 +32,7 @@ currentWindowId () { bgnotify () { ## args: (title, subtitle) if hash terminal-notifier 2>/dev/null; then #osx - [[ "$TERM_PROGRAM" == 'iTerm.app' ]] && term_id='com.googlecode.iterm2'; - [[ "$TERM_PROGRAM" == 'Apple_Terminal' ]] && term_id='com.apple.terminal'; - ## now call terminal-notifier, (hopefully with $term_id!) - [ -z "$term_id" ] && terminal-notifier -message "$2" -title "$1" >/dev/null || - terminal-notifier -message "$2" -title "$1" -activate "$term_id" -sender "$term_id" >/dev/null + terminal-notifier -message "$2" -title "$1" >/dev/null || elif hash growlnotify 2>/dev/null; then #osx growl growlnotify -m "$1" "$2" elif hash notify-send 2>/dev/null; then #ubuntu gnome! @@ -62,10 +58,8 @@ bgnotify_end() { elapsed=$(( EPOCHSECONDS - bgnotify_timestamp )) past_threshold=$(( elapsed >= bgnotify_threshold )) if (( bgnotify_timestamp > 0 )) && (( past_threshold )); then - if [ $(currentWindowId) != "$bgnotify_windowid" ]; then - print -n "\a" - bgnotify_formatted "$didexit" "$bgnotify_lastcmd" "$elapsed" - fi + print -n "\a" + bgnotify_formatted "$didexit" "$bgnotify_lastcmd" "$elapsed" fi bgnotify_timestamp=0 #reset it to 0! }