mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-05-29 04:53:17 +02:00
Merge branch 'dev'
This commit is contained in:
commit
a1b33e2dc2
17 changed files with 273 additions and 142 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -5,3 +5,6 @@ example.zsh
|
||||||
# temp files directories
|
# temp files directories
|
||||||
cache/
|
cache/
|
||||||
log/
|
log/
|
||||||
|
|
||||||
|
lib/clipboard.zsh
|
||||||
|
lib/grep.zsh
|
||||||
|
|
|
||||||
7
.gitmodules
vendored
7
.gitmodules
vendored
|
|
@ -16,7 +16,10 @@
|
||||||
url = https://github.com/mollifier/cd-gitroot
|
url = https://github.com/mollifier/cd-gitroot
|
||||||
[submodule "custom/plugins/zce"]
|
[submodule "custom/plugins/zce"]
|
||||||
path = 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"]
|
[submodule "custom/plugins/yadm"]
|
||||||
path = custom/plugins/yadm
|
path = custom/plugins/yadm
|
||||||
url = https://github.com/15cm/yadm-zsh.git
|
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
|
||||||
|
|
|
||||||
|
|
@ -248,4 +248,4 @@ Oh My Zsh is released under the [MIT license](LICENSE.txt).
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
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).
|
||||||
|
|
|
||||||
1
custom/plugins/alias-tips
Submodule
1
custom/plugins/alias-tips
Submodule
|
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit 9354269a787864bfec1a9893be035dca0712313b
|
||||||
|
|
@ -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:
|
|
||||||
#
|
|
||||||
# <command> | clipcopy - copies stdin to clipboard
|
|
||||||
#
|
|
||||||
# clipcopy <file> - 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 | <command> - pastes contents and pipes it to another process
|
|
||||||
#
|
|
||||||
# clippaste > <file> - 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
|
|
||||||
}
|
|
||||||
28
lib/grep.zsh
28
lib/grep.zsh
|
|
@ -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
|
|
||||||
|
|
@ -19,8 +19,8 @@ fi
|
||||||
setopt long_list_jobs
|
setopt long_list_jobs
|
||||||
|
|
||||||
## pager
|
## pager
|
||||||
env_default PAGER 'less'
|
[[ -n "$PAGER" ]] || export PAGER='less'
|
||||||
env_default LESS '-R'
|
[[ -n "$PAGER" ]] || export PAGER='less'
|
||||||
|
|
||||||
## super user alias
|
## super user alias
|
||||||
alias _='sudo'
|
alias _='sudo'
|
||||||
|
|
|
||||||
19
oh-my-zsh.sh
19
oh-my-zsh.sh
|
|
@ -64,6 +64,11 @@ if [ -z "$ZSH_COMPDUMP" ]; then
|
||||||
ZSH_COMPDUMP="${ZDOTDIR:-${HOME}}/.zcompdump-${SHORT_HOST}-${ZSH_VERSION}"
|
ZSH_COMPDUMP="${ZDOTDIR:-${HOME}}/.zcompdump-${SHORT_HOST}-${ZSH_VERSION}"
|
||||||
fi
|
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 [[ $ZSH_DISABLE_COMPFIX != true ]]; then
|
||||||
# If completion insecurities exist, warn the user without enabling completions.
|
# If completion insecurities exist, warn the user without enabling completions.
|
||||||
if ! compaudit &>/dev/null; then
|
if ! compaudit &>/dev/null; then
|
||||||
|
|
@ -71,10 +76,20 @@ if [[ $ZSH_DISABLE_COMPFIX != true ]]; then
|
||||||
handle_completion_insecurities
|
handle_completion_insecurities
|
||||||
# Else, enable and cache completions to the desired file.
|
# Else, enable and cache completions to the desired file.
|
||||||
else
|
else
|
||||||
compinit -d "${ZSH_COMPDUMP}"
|
if [[ -n "${ZSH_COMPDUMP}"(#qN.mh+24) ]]; then
|
||||||
|
compinit -d "${ZSH_COMPDUMP}"
|
||||||
|
compdump
|
||||||
|
else
|
||||||
|
compinit -C
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
else
|
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
|
fi
|
||||||
|
|
||||||
# Load all of the plugins that were defined in ~/.zshrc
|
# Load all of the plugins that were defined in ~/.zshrc
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ if ! (type bgnotify_formatted | grep -q 'function'); then ## allow custom functi
|
||||||
elapsed="$(( $3 % 60 ))s"
|
elapsed="$(( $3 % 60 ))s"
|
||||||
(( $3 >= 60 )) && elapsed="$((( $3 % 3600) / 60 ))m $elapsed"
|
(( $3 >= 60 )) && elapsed="$((( $3 % 3600) / 60 ))m $elapsed"
|
||||||
(( $3 >= 3600 )) && elapsed="$(( $3 / 3600 ))h $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
|
fi
|
||||||
|
|
||||||
|
|
@ -32,11 +32,7 @@ currentWindowId () {
|
||||||
|
|
||||||
bgnotify () { ## args: (title, subtitle)
|
bgnotify () { ## args: (title, subtitle)
|
||||||
if hash terminal-notifier 2>/dev/null; then #osx
|
if hash terminal-notifier 2>/dev/null; then #osx
|
||||||
[[ "$TERM_PROGRAM" == 'iTerm.app' ]] && term_id='com.googlecode.iterm2';
|
terminal-notifier -message "$2" -title "$1" >/dev/null ||
|
||||||
[[ "$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
|
|
||||||
elif hash growlnotify 2>/dev/null; then #osx growl
|
elif hash growlnotify 2>/dev/null; then #osx growl
|
||||||
growlnotify -m "$1" "$2"
|
growlnotify -m "$1" "$2"
|
||||||
elif hash notify-send 2>/dev/null; then #ubuntu gnome!
|
elif hash notify-send 2>/dev/null; then #ubuntu gnome!
|
||||||
|
|
@ -62,10 +58,8 @@ bgnotify_end() {
|
||||||
elapsed=$(( EPOCHSECONDS - bgnotify_timestamp ))
|
elapsed=$(( EPOCHSECONDS - bgnotify_timestamp ))
|
||||||
past_threshold=$(( elapsed >= bgnotify_threshold ))
|
past_threshold=$(( elapsed >= bgnotify_threshold ))
|
||||||
if (( bgnotify_timestamp > 0 )) && (( past_threshold )); then
|
if (( bgnotify_timestamp > 0 )) && (( past_threshold )); then
|
||||||
if [ $(currentWindowId) != "$bgnotify_windowid" ]; then
|
print -n "\a"
|
||||||
print -n "\a"
|
bgnotify_formatted "$didexit" "$bgnotify_lastcmd" "$elapsed"
|
||||||
bgnotify_formatted "$didexit" "$bgnotify_lastcmd" "$elapsed"
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
bgnotify_timestamp=0 #reset it to 0!
|
bgnotify_timestamp=0 #reset it to 0!
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -349,6 +349,7 @@ _managepy-commands() {
|
||||||
'runfcgi:Run this project as a fastcgi (or some other protocol supported by flup) application,'
|
'runfcgi:Run this project as a fastcgi (or some other protocol supported by flup) application,'
|
||||||
'runserver:Starts a lightweight Web server for development.'
|
'runserver:Starts a lightweight Web server for development.'
|
||||||
'shell:Runs a Python interactive interpreter.'
|
'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).'
|
'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).'
|
'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).'
|
'sqlclear:Prints the DROP TABLE SQL statements for the given app name(s).'
|
||||||
|
|
|
||||||
|
|
@ -3,11 +3,6 @@
|
||||||
# Description
|
# Description
|
||||||
# -----------
|
# -----------
|
||||||
# zsh completion for docker-compose
|
# zsh completion for docker-compose
|
||||||
# https://github.com/sdurrheimer/docker-compose-zsh-completion
|
|
||||||
# -------------------------------------------------------------------------
|
|
||||||
# Version
|
|
||||||
# -------
|
|
||||||
# 1.5.0
|
|
||||||
# -------------------------------------------------------------------------
|
# -------------------------------------------------------------------------
|
||||||
# Authors
|
# Authors
|
||||||
# -------
|
# -------
|
||||||
|
|
@ -199,7 +194,9 @@ __docker-compose_subcommand() {
|
||||||
(build)
|
(build)
|
||||||
_arguments \
|
_arguments \
|
||||||
$opts_help \
|
$opts_help \
|
||||||
|
"*--build-arg=[Set build-time variables for one service.]:<varname>=<value>: " \
|
||||||
'--force-rm[Always remove intermediate containers.]' \
|
'--force-rm[Always remove intermediate containers.]' \
|
||||||
|
'--memory[Memory limit for the build container.]' \
|
||||||
'--no-cache[Do not use cache when building the image.]' \
|
'--no-cache[Do not use cache when building the image.]' \
|
||||||
'--pull[Always attempt to pull a newer version of the image.]' \
|
'--pull[Always attempt to pull a newer version of the image.]' \
|
||||||
'*:services:__docker-compose_services_from_build' && ret=0
|
'*:services:__docker-compose_services_from_build' && ret=0
|
||||||
|
|
@ -207,13 +204,16 @@ __docker-compose_subcommand() {
|
||||||
(bundle)
|
(bundle)
|
||||||
_arguments \
|
_arguments \
|
||||||
$opts_help \
|
$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 "<project name>.dab".]:file:_files' && ret=0
|
'(--output -o)'{--output,-o}'[Path to write the bundle file to. Defaults to "<project name>.dab".]:file:_files' && ret=0
|
||||||
;;
|
;;
|
||||||
(config)
|
(config)
|
||||||
_arguments \
|
_arguments \
|
||||||
$opts_help \
|
$opts_help \
|
||||||
'(--quiet -q)'{--quiet,-q}"[Only validate the configuration, don't print anything.]" \
|
'(--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)
|
(create)
|
||||||
_arguments \
|
_arguments \
|
||||||
|
|
@ -242,7 +242,7 @@ __docker-compose_subcommand() {
|
||||||
$opts_help \
|
$opts_help \
|
||||||
'-d[Detached mode: Run command in the background.]' \
|
'-d[Detached mode: Run command in the background.]' \
|
||||||
'--privileged[Give extended privileges to the process.]' \
|
'--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.]' \
|
'-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: ' \
|
'--index=[Index of the container if there are multiple instances of a service \[default: 1\]]:index: ' \
|
||||||
'(-):running services:__docker-compose_runningservices' \
|
'(-):running services:__docker-compose_runningservices' \
|
||||||
|
|
@ -252,6 +252,12 @@ __docker-compose_subcommand() {
|
||||||
(help)
|
(help)
|
||||||
_arguments ':subcommand:__docker-compose_commands' && ret=0
|
_arguments ':subcommand:__docker-compose_commands' && ret=0
|
||||||
;;
|
;;
|
||||||
|
(images)
|
||||||
|
_arguments \
|
||||||
|
$opts_help \
|
||||||
|
'-q[Only display IDs]' \
|
||||||
|
'*:services:__docker-compose_services_all' && ret=0
|
||||||
|
;;
|
||||||
(kill)
|
(kill)
|
||||||
_arguments \
|
_arguments \
|
||||||
$opts_help \
|
$opts_help \
|
||||||
|
|
@ -308,16 +314,17 @@ __docker-compose_subcommand() {
|
||||||
(run)
|
(run)
|
||||||
_arguments \
|
_arguments \
|
||||||
$opts_help \
|
$opts_help \
|
||||||
|
$opts_no_deps \
|
||||||
'-d[Detached mode: Run container in the background, print new container name.]' \
|
'-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: ' \
|
'*-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: ' \
|
'--entrypoint[Overwrite the entrypoint of the image.]:entry point: ' \
|
||||||
'--name=[Assign a name to the container]:name: ' \
|
'--name=[Assign a name to the container]:name: ' \
|
||||||
$opts_no_deps \
|
|
||||||
'(-p --publish)'{-p,--publish=}"[Publish a container's port(s) to the host]" \
|
'(-p --publish)'{-p,--publish=}"[Publish a container's port(s) to the host]" \
|
||||||
'--rm[Remove container after run. Ignored in detached mode.]' \
|
'--rm[Remove container after run. Ignored in detached mode.]' \
|
||||||
"--service-ports[Run command with the service's ports enabled and mapped to the host.]" \
|
"--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.]' \
|
'-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' \
|
'(-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: ' \
|
'(-w --workdir)'{-w,--workdir=}'[Working directory inside the container]:workdir: ' \
|
||||||
'(-):services:__docker-compose_services' \
|
'(-):services:__docker-compose_services' \
|
||||||
'(-):command: _command_names -e' \
|
'(-):command: _command_names -e' \
|
||||||
|
|
@ -340,6 +347,11 @@ __docker-compose_subcommand() {
|
||||||
$opts_timeout \
|
$opts_timeout \
|
||||||
'*:running services:__docker-compose_runningservices' && ret=0
|
'*:running services:__docker-compose_runningservices' && ret=0
|
||||||
;;
|
;;
|
||||||
|
(top)
|
||||||
|
_arguments \
|
||||||
|
$opts_help \
|
||||||
|
'*:running services:__docker-compose_runningservices' && ret=0
|
||||||
|
;;
|
||||||
(unpause)
|
(unpause)
|
||||||
_arguments \
|
_arguments \
|
||||||
$opts_help \
|
$opts_help \
|
||||||
|
|
@ -385,9 +397,17 @@ _docker-compose() {
|
||||||
integer ret=1
|
integer ret=1
|
||||||
typeset -A opt_args
|
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 \
|
_arguments -C \
|
||||||
'(- :)'{-h,--help}'[Get help]' \
|
'(- :)'{-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:' \
|
'(-p --project-name)'{-p,--project-name}'[Specify an alternate project name (default: directory name)]:project name:' \
|
||||||
'--verbose[Show more output]' \
|
'--verbose[Show more output]' \
|
||||||
'(- :)'{-v,--version}'[Print version and exit]' \
|
'(- :)'{-v,--version}'[Print version and exit]' \
|
||||||
|
|
|
||||||
|
|
@ -21,3 +21,5 @@ alias dcup='docker-compose up'
|
||||||
alias dcdn='docker-compose down'
|
alias dcdn='docker-compose down'
|
||||||
alias dcl='docker-compose logs'
|
alias dcl='docker-compose logs'
|
||||||
alias dclf='docker-compose logs -f'
|
alias dclf='docker-compose logs -f'
|
||||||
|
alias dcpull='docker-compose pull'
|
||||||
|
alias dcstart='docker-compose start'
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ jira new # opens a new issue
|
||||||
jira dashboard # opens your JIRA dashboard
|
jira dashboard # opens your JIRA dashboard
|
||||||
jira reported [username] # queries for issues reported by a user
|
jira reported [username] # queries for issues reported by a user
|
||||||
jira assigned [username] # queries for issues assigned to 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 # opens an existing issue
|
||||||
jira ABC-123 m # opens an existing issue for adding a comment
|
jira ABC-123 m # opens an existing issue for adding a comment
|
||||||
```
|
```
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ function jira() {
|
||||||
else
|
else
|
||||||
# Anything that doesn't match a special action is considered an issue name
|
# 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
|
# 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_arg=$(git rev-parse --abbrev-ref HEAD)
|
||||||
local issue="${jira_prefix}${issue_arg}"
|
local issue="${jira_prefix}${issue_arg}"
|
||||||
else
|
else
|
||||||
|
|
|
||||||
76
plugins/kube-ps1/README.md
Normal file
76
plugins/kube-ps1/README.md
Normal file
|
|
@ -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:
|
||||||
|
|
||||||
|
```
|
||||||
|
(<logo>|<cluster>:<namespace>)
|
||||||
|
```
|
||||||
|
|
||||||
|
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
|
||||||
123
plugins/kube-ps1/kube-ps1.zsh
Normal file
123
plugins/kube-ps1/kube-ps1.zsh
Normal file
|
|
@ -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}"
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -9,6 +9,9 @@ fi
|
||||||
# This command is used ALOT both below and in daily life
|
# This command is used ALOT both below and in daily life
|
||||||
alias k=kubectl
|
alias k=kubectl
|
||||||
|
|
||||||
|
# Apply a YML file
|
||||||
|
alias kaf='k apply -f'
|
||||||
|
|
||||||
# Drop into an interactive terminal on a container
|
# Drop into an interactive terminal on a container
|
||||||
alias keti='k exec -ti'
|
alias keti='k exec -ti'
|
||||||
|
|
||||||
|
|
@ -20,7 +23,6 @@ alias kccc='k config current-context'
|
||||||
|
|
||||||
# Pod management.
|
# Pod management.
|
||||||
alias kgp='k get pods'
|
alias kgp='k get pods'
|
||||||
alias klp='k logs pods'
|
|
||||||
alias kep='k edit pods'
|
alias kep='k edit pods'
|
||||||
alias kdp='k describe pods'
|
alias kdp='k describe pods'
|
||||||
alias kdelp='k delete pods'
|
alias kdelp='k delete pods'
|
||||||
|
|
@ -48,3 +50,7 @@ alias krsd='k rollout status deployment'
|
||||||
alias kgrs='k get rs'
|
alias kgrs='k get rs'
|
||||||
alias krh='k rollout history'
|
alias krh='k rollout history'
|
||||||
alias kru='k rollout undo'
|
alias kru='k rollout undo'
|
||||||
|
|
||||||
|
# Logs
|
||||||
|
alias kl='k logs'
|
||||||
|
alias klf='k logs -f'
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue