From 96d10e2147b59adc25e9c3b90ac6f31935495ef3 Mon Sep 17 00:00:00 2001 From: Robert Strack Date: Fri, 13 Nov 2015 23:42:21 -0500 Subject: [PATCH 0001/1083] calculating command's execution time --- plugins/timer/timer.plugin.zsh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 plugins/timer/timer.plugin.zsh diff --git a/plugins/timer/timer.plugin.zsh b/plugins/timer/timer.plugin.zsh new file mode 100644 index 000000000..aa4573b9f --- /dev/null +++ b/plugins/timer/timer.plugin.zsh @@ -0,0 +1,18 @@ +preexec() { + __timer_cmd_start_time=$(date '+%s') +} + +precmd() { + if [ -n "${__timer_cmd_start_time}" ]; then + local cmd_end_time=$(date '+%s') + local tdiff=$((${cmd_end_time} - ${__timer_cmd_start_time})) + unset __timer_cmd_start_time + local tdiffstr='/' + if (( tdiff >= 60 )); then + tdiffstr+="$((tdiff / 60))m" + fi + tdiffstr+="$((tdiff % 60))s" + local cols=$(($COLUMNS - ${#tdiffstr} - 1)) + echo -e "\033[1A\033[${cols}C ${tdiffstr}" + fi +} From 1b8f05a3d395c107d81724445cac7fcd599942d8 Mon Sep 17 00:00:00 2001 From: Robert Strack Date: Sat, 14 Nov 2015 23:13:44 -0500 Subject: [PATCH 0002/1083] simplified time string calculation --- plugins/timer/timer.plugin.zsh | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/plugins/timer/timer.plugin.zsh b/plugins/timer/timer.plugin.zsh index aa4573b9f..f73d2ab53 100644 --- a/plugins/timer/timer.plugin.zsh +++ b/plugins/timer/timer.plugin.zsh @@ -7,12 +7,8 @@ precmd() { local cmd_end_time=$(date '+%s') local tdiff=$((${cmd_end_time} - ${__timer_cmd_start_time})) unset __timer_cmd_start_time - local tdiffstr='/' - if (( tdiff >= 60 )); then - tdiffstr+="$((tdiff / 60))m" - fi - tdiffstr+="$((tdiff % 60))s" - local cols=$(($COLUMNS - ${#tdiffstr} - 1)) - echo -e "\033[1A\033[${cols}C ${tdiffstr}" + local tdiffstr="$((tdiff / 60))m$((tdiff % 60))s" + local cols=$(($COLUMNS - ${#tdiffstr#0m} - 2)) + echo -e "\033[1A\033[${cols}C \`${tdiffstr#0m}" fi } From 120e8620af6e1d7d01159614186403c7a816457d Mon Sep 17 00:00:00 2001 From: Robert Strack Date: Sat, 14 Nov 2015 23:48:26 -0500 Subject: [PATCH 0003/1083] cleaning up --- plugins/timer/timer.plugin.zsh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/timer/timer.plugin.zsh b/plugins/timer/timer.plugin.zsh index f73d2ab53..ee2cb66c1 100644 --- a/plugins/timer/timer.plugin.zsh +++ b/plugins/timer/timer.plugin.zsh @@ -3,12 +3,12 @@ preexec() { } precmd() { - if [ -n "${__timer_cmd_start_time}" ]; then + if [ -n "$__timer_cmd_start_time" ]; then local cmd_end_time=$(date '+%s') - local tdiff=$((${cmd_end_time} - ${__timer_cmd_start_time})) + local tdiff=$((cmd_end_time - __timer_cmd_start_time)) unset __timer_cmd_start_time local tdiffstr="$((tdiff / 60))m$((tdiff % 60))s" - local cols=$(($COLUMNS - ${#tdiffstr#0m} - 2)) + local cols=$((COLUMNS - ${#tdiffstr#0m} - 2)) echo -e "\033[1A\033[${cols}C \`${tdiffstr#0m}" fi } From d4c74690b61b74e317410df3b80b784891ab55ed Mon Sep 17 00:00:00 2001 From: Robert Strack Date: Sun, 15 Nov 2015 22:08:16 -0500 Subject: [PATCH 0004/1083] increased timer's pecision --- plugins/timer/timer.plugin.zsh | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/plugins/timer/timer.plugin.zsh b/plugins/timer/timer.plugin.zsh index ee2cb66c1..729dd3ee2 100644 --- a/plugins/timer/timer.plugin.zsh +++ b/plugins/timer/timer.plugin.zsh @@ -1,14 +1,25 @@ +__timer_current_time() { + perl -MTime::HiRes=time -e'print time' +} + +__timer_format_duration() { + local mins=$(printf '%.0f' $(($1 / 60))) + local secs=$(printf '%.1f' $(($1 - 60 * mins))) + local duration_str=$(echo "${mins}m${secs}s") + echo "\`${duration_str#0m}" +} + preexec() { - __timer_cmd_start_time=$(date '+%s') + __timer_cmd_start_time=$(__timer_current_time) } precmd() { - if [ -n "$__timer_cmd_start_time" ]; then - local cmd_end_time=$(date '+%s') + if [ -n "${__timer_cmd_start_time}" ]; then + local cmd_end_time=$(__timer_current_time) local tdiff=$((cmd_end_time - __timer_cmd_start_time)) unset __timer_cmd_start_time - local tdiffstr="$((tdiff / 60))m$((tdiff % 60))s" - local cols=$((COLUMNS - ${#tdiffstr#0m} - 2)) - echo -e "\033[1A\033[${cols}C \`${tdiffstr#0m}" + local tdiffstr=$(__timer_format_duration ${tdiff}) + local cols=$((COLUMNS - ${#tdiffstr} - 1)) + echo -e "\033[1A\033[${cols}C ${tdiffstr}" fi } From 111dd018b9b821fad2c7899b31aa46b5c0aaa218 Mon Sep 17 00:00:00 2001 From: Robert Strack Date: Mon, 16 Nov 2015 22:20:26 -0500 Subject: [PATCH 0005/1083] allow changes in display format --- plugins/timer/timer.plugin.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/timer/timer.plugin.zsh b/plugins/timer/timer.plugin.zsh index 729dd3ee2..33481ea4e 100644 --- a/plugins/timer/timer.plugin.zsh +++ b/plugins/timer/timer.plugin.zsh @@ -4,9 +4,9 @@ __timer_current_time() { __timer_format_duration() { local mins=$(printf '%.0f' $(($1 / 60))) - local secs=$(printf '%.1f' $(($1 - 60 * mins))) + local secs=$(printf "%.${TIMER_PRECISION:-1}f" $(($1 - 60 * mins))) local duration_str=$(echo "${mins}m${secs}s") - echo "\`${duration_str#0m}" + echo "${TIMER_SYMBOL:-\`}${duration_str#0m}" } preexec() { From 96148d2275b848dbfb976a58967535067def4210 Mon Sep 17 00:00:00 2001 From: Robert Strack Date: Tue, 17 Nov 2015 20:50:30 -0500 Subject: [PATCH 0006/1083] customizable timer format --- plugins/timer/timer.plugin.zsh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/timer/timer.plugin.zsh b/plugins/timer/timer.plugin.zsh index 33481ea4e..f7f039b78 100644 --- a/plugins/timer/timer.plugin.zsh +++ b/plugins/timer/timer.plugin.zsh @@ -6,7 +6,8 @@ __timer_format_duration() { local mins=$(printf '%.0f' $(($1 / 60))) local secs=$(printf "%.${TIMER_PRECISION:-1}f" $(($1 - 60 * mins))) local duration_str=$(echo "${mins}m${secs}s") - echo "${TIMER_SYMBOL:-\`}${duration_str#0m}" + local format="${TIMER_FORMAT:-/%d}" + echo "${format//\%d/${duration_str#0m}}" } preexec() { From de8d6841b00903f2873a8b009faf7002bfbc1273 Mon Sep 17 00:00:00 2001 From: Robert Strack Date: Wed, 18 Nov 2015 20:33:38 -0500 Subject: [PATCH 0007/1083] added pre_functions --- plugins/timer/timer.plugin.zsh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/plugins/timer/timer.plugin.zsh b/plugins/timer/timer.plugin.zsh index f7f039b78..231134e7d 100644 --- a/plugins/timer/timer.plugin.zsh +++ b/plugins/timer/timer.plugin.zsh @@ -10,11 +10,11 @@ __timer_format_duration() { echo "${format//\%d/${duration_str#0m}}" } -preexec() { +__timer_save_time_preexec() { __timer_cmd_start_time=$(__timer_current_time) } -precmd() { +__timer_display_timer_precmd() { if [ -n "${__timer_cmd_start_time}" ]; then local cmd_end_time=$(__timer_current_time) local tdiff=$((cmd_end_time - __timer_cmd_start_time)) @@ -24,3 +24,6 @@ precmd() { echo -e "\033[1A\033[${cols}C ${tdiffstr}" fi } + +preexec_functions+=(__timer_save_time_preexec) +precmd_functions+=(__timer_display_timer_precmd) From d615961430aca9668cfb056aef6024c4ed41eff8 Mon Sep 17 00:00:00 2001 From: Robert Strack Date: Wed, 18 Nov 2015 21:09:18 -0500 Subject: [PATCH 0008/1083] readme file --- plugins/timer/README.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 plugins/timer/README.md diff --git a/plugins/timer/README.md b/plugins/timer/README.md new file mode 100644 index 000000000..19072cb24 --- /dev/null +++ b/plugins/timer/README.md @@ -0,0 +1,18 @@ +This plugin allows to display command's execution time in a very nonintrusive way. + +Timer can be tuned by these two variables: +* `TIMER_PRECISION` allows to control number of decimal places (default `1`) +* `TIMER_FORMAT` allows to adjust display format (default `'/%d'`) + +Sample session: + + me@here:~$ sleep 1 /1.0s + me@here:~$ sleep 73 /1m13.0s + me@here:~$ TIMER_FORMAT='[%d]'; TIMER_PRECISION=2 [0.00s] + me@here:~$ head -c50 < /dev/urandom | hexdump + 0000000 b2 16 20 f0 29 1f 61 2d 8a 29 20 8c 8c 39 5a ab + 0000010 21 47 0e f9 ee a4 76 46 71 9e 4f 6b a4 c4 51 cb + 0000020 f9 1f 7e b9 6f 2c ae dd cf 40 6d 64 a8 fb d3 db + 0000030 09 37 + 0000032 [0.02s] + From 7553bcb4185b9d584a40b41cf15501e43041fe57 Mon Sep 17 00:00:00 2001 From: Robert Strack Date: Wed, 18 Nov 2015 21:27:29 -0500 Subject: [PATCH 0009/1083] minor corrections in the readme file --- plugins/timer/README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/plugins/timer/README.md b/plugins/timer/README.md index 19072cb24..321307e59 100644 --- a/plugins/timer/README.md +++ b/plugins/timer/README.md @@ -8,11 +8,10 @@ Sample session: me@here:~$ sleep 1 /1.0s me@here:~$ sleep 73 /1m13.0s - me@here:~$ TIMER_FORMAT='[%d]'; TIMER_PRECISION=2 [0.00s] + me@here:~$ TIMER_FORMAT='[%d]'; TIMER_PRECISION=2 [0.00s] me@here:~$ head -c50 < /dev/urandom | hexdump 0000000 b2 16 20 f0 29 1f 61 2d 8a 29 20 8c 8c 39 5a ab 0000010 21 47 0e f9 ee a4 76 46 71 9e 4f 6b a4 c4 51 cb 0000020 f9 1f 7e b9 6f 2c ae dd cf 40 6d 64 a8 fb d3 db 0000030 09 37 0000032 [0.02s] - From 531c41cdfee9e3bbba16d0bf19ca973ad4bb4af5 Mon Sep 17 00:00:00 2001 From: LE Manh Cuong Date: Tue, 1 Dec 2015 11:50:55 +0700 Subject: [PATCH 0010/1083] Allow loading themes from predefined list --- oh-my-zsh.sh | 6 +++++- templates/zshrc.zsh-template | 6 ++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index 6cc5ac630..0324543d5 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -94,7 +94,11 @@ unset config_file # Load the theme if [ "$ZSH_THEME" = "random" ]; then - themes=($ZSH/themes/*zsh-theme) + if [ "${(t)ZSH_THEME_RANDOM_CANDICATES}" = "array" ] && [ "${#ZSH_THEME_RANDOM_CANDICATES[@]}" -gt 0 ]; then + themes=($ZSH/themes/${^ZSH_THEME_RANDOM_CANDICATES}.zsh-theme) + else + themes=($ZSH/themes/*zsh-theme) + fi N=${#themes[@]} ((N=(RANDOM%N)+1)) RANDOM_THEME=${themes[$N]} diff --git a/templates/zshrc.zsh-template b/templates/zshrc.zsh-template index 44e8b0d1b..baedf0675 100644 --- a/templates/zshrc.zsh-template +++ b/templates/zshrc.zsh-template @@ -7,6 +7,12 @@ export ZSH=$HOME/.oh-my-zsh # time that oh-my-zsh is loaded. ZSH_THEME="robbyrussell" +# Set list of themes to load +# Setting this variable when ZSH_THEME=random +# cause zsh load theme from this variable instead of +# looking in ~/.oh-my-zsh/themes/ +# ZSH_THEME_RANDOM_CANDICATES=() + # Uncomment the following line to use case-sensitive completion. # CASE_SENSITIVE="true" From 5e77e00ad522a5d6a84067d22015b85b0080a19f Mon Sep 17 00:00:00 2001 From: LE Manh Cuong Date: Tue, 1 Dec 2015 12:03:00 +0700 Subject: [PATCH 0011/1083] Some improvements - Adding documentation - Note the effect empty array - Fix spelling - Using new test `[[...]]` --- README.markdown | 8 ++++++++ oh-my-zsh.sh | 6 +++--- templates/zshrc.zsh-template | 3 ++- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/README.markdown b/README.markdown index 9d7210f77..0d3144dde 100644 --- a/README.markdown +++ b/README.markdown @@ -88,6 +88,14 @@ If you're feeling feisty, you can let the computer select one randomly for you e ZSH_THEME="random" # (...please let it be pie... please be some pie..) ``` +And if you want to pick random theme from a list of your favorite themes: + +```shell +ZSH_THEM_RANDOM_CANDIDATES=( + "robbyrussell" + "agnoster" +) +``` ## Advanced Topics diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index 0324543d5..4517a2ba0 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -93,9 +93,9 @@ done unset config_file # Load the theme -if [ "$ZSH_THEME" = "random" ]; then - if [ "${(t)ZSH_THEME_RANDOM_CANDICATES}" = "array" ] && [ "${#ZSH_THEME_RANDOM_CANDICATES[@]}" -gt 0 ]; then - themes=($ZSH/themes/${^ZSH_THEME_RANDOM_CANDICATES}.zsh-theme) +if [[ "$ZSH_THEME" == "random" ]]; then + if [[ "${(t)ZSH_THEME_RANDOM_CANDIDATES}" = "array" ]] && [[ "${#ZSH_THEME_RANDOM_CANDIDATES[@]}" -gt 0 ]]; then + themes=($ZSH/themes/${^ZSH_THEME_RANDOM_CANDIDATES}.zsh-theme) else themes=($ZSH/themes/*zsh-theme) fi diff --git a/templates/zshrc.zsh-template b/templates/zshrc.zsh-template index baedf0675..2f39308a9 100644 --- a/templates/zshrc.zsh-template +++ b/templates/zshrc.zsh-template @@ -11,7 +11,8 @@ ZSH_THEME="robbyrussell" # Setting this variable when ZSH_THEME=random # cause zsh load theme from this variable instead of # looking in ~/.oh-my-zsh/themes/ -# ZSH_THEME_RANDOM_CANDICATES=() +# An empty array have no effect +# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" ) # Uncomment the following line to use case-sensitive completion. # CASE_SENSITIVE="true" From 9248052e917a1d9296d4b79fa229b081cefbc698 Mon Sep 17 00:00:00 2001 From: mahi97 Date: Wed, 31 Aug 2016 03:31:49 +0430 Subject: [PATCH 0012/1083] initial spotify control --- plugins/osx/osx.plugin.zsh | 98 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) diff --git a/plugins/osx/osx.plugin.zsh b/plugins/osx/osx.plugin.zsh index a3e550972..948d69a29 100644 --- a/plugins/osx/osx.plugin.zsh +++ b/plugins/osx/osx.plugin.zsh @@ -261,6 +261,104 @@ EOF osascript -e "tell application \"iTunes\" to $opt" } +# Spotify control function +function spotify() { + showHelp () { + echo "Usage:"; + echo; + echo " $(basename "$0") "; + echo; + echo "Commands:"; + echo; + echo " play # Resumes playback where Spotify last left off."; + echo " pause # Pauses Spotify playback."; + echo " next # Skips to the next song in a playlist."; + echo " prev # Returns to the previous song in a playlist."; + echo " pos [time] # Jumps to a time (in secs) in the current song."; + echo " quit # Stops playback and quits Spotify."; + echo; + echo " vol [amount] # Sets the volume to an amount between 0 and 100."; + echo " vol show # Shows the current Spotify volume."; + echo; + echo " toggle shuffle # Toggles shuffle playback mode."; + echo " toggle repeat # Toggles repeat playback mode."; + } + + if [ $# = 0 ]; then + showHelp; + else + if [ "$(osascript -e 'application "Spotify" is running')" = "false" ]; then + osascript -e 'tell application "Spotify" to activate' + sleep 2 + fi + fi + + while [ $# -gt 0 ]; do + arg=$1; + + case $arg in + "play" ) + echo "Playing Spotify."; + osascript -e 'tell application "Spotify" to play'; + break ;; + + "pause" ) + echo "Pausing Spotify."; + osascript -e 'tell application "Spotify" to pause'; + break ;; + + "quit" ) + echo "Quitting Spotify."; + osascript -e 'tell application "Spotify" to quit'; + exit 1 ;; + + "next" ) + echo "Going to next track." ; + osascript -e 'tell application "Spotify" to next track'; + break ;; + + "prev" ) + echo "Going to previous track."; + osascript -e 'tell application "Spotify" to previous track'; + break ;; + + "vol" ) + vol=$(osascript -e 'tell application "Spotify" to sound volume as integer'); + if [[ "$2" = "show" || "$2" = "" ]]; then + echo "Current Spotify volume level is $vol."; + break ; + elif [ "$2" -ge 0 ]; then + newvol=$2; + fi + + osascript -e "tell application \"Spotify\" to set sound volume to $newvol"; + break ;; + + "toggle" ) + if [ "$2" = "shuffle" ]; then + osascript -e 'tell application "Spotify" to set shuffling to not shuffling'; + curr=$(osascript -e 'tell application "Spotify" to shuffling'); + echo "Spotify shuffling set to $curr"; + elif [ "$2" = "repeat" ]; then + osascript -e 'tell application "Spotify" to set repeating to not repeating'; + curr=$(osascript -e 'tell application "Spotify" to repeating'); + echo "Spotify repeating set to $curr"; + fi + break ;; + + "pos" ) + echo "Adjusting Spotify play position." + osascript -e "tell application \"Spotify\" to set player position to $2"; + break;; + + -h|--help| *) + showHelp; + break ;; + esac + done +} + + # Show/hide hidden files in the Finder alias showfiles="defaults write com.apple.finder AppleShowAllFiles -bool true && killall Finder" alias hidefiles="defaults write com.apple.finder AppleShowAllFiles -bool false && killall Finder" From 8f47c96453a229ad5488bbd1e4ee8b7c522b6a15 Mon Sep 17 00:00:00 2001 From: mahi97 Date: Wed, 31 Aug 2016 03:37:53 +0430 Subject: [PATCH 0013/1083] volume up/down added --- plugins/osx/osx.plugin.zsh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/plugins/osx/osx.plugin.zsh b/plugins/osx/osx.plugin.zsh index 948d69a29..386507dbc 100644 --- a/plugins/osx/osx.plugin.zsh +++ b/plugins/osx/osx.plugin.zsh @@ -327,6 +327,22 @@ function spotify() { if [[ "$2" = "show" || "$2" = "" ]]; then echo "Current Spotify volume level is $vol."; break ; + elif [ "$2" = "up" ]; then + if [ "$vol" -le 90 ]; then + newvol=$(( vol+10 )); + echo "Increasing Spotify volume to $newvol."; + else + newvol=100; + echo "Spotify volume level is at max."; + fi + elif [ "$2" = "down" ]; then + if [ "$vol" -ge 10 ]; then + newvol=$(( vol-10 )); + echo "Reducing Spotify volume to $newvol."; + else + newvol=0; + echo "Spotify volume level is at min."; + fi elif [ "$2" -ge 0 ]; then newvol=$2; fi From 92586e38c72a4a3a112a5c2b13cca6fc250e7447 Mon Sep 17 00:00:00 2001 From: mahi97 Date: Wed, 31 Aug 2016 03:50:53 +0430 Subject: [PATCH 0014/1083] add info, share and status option --- plugins/osx/osx.plugin.zsh | 68 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/plugins/osx/osx.plugin.zsh b/plugins/osx/osx.plugin.zsh index 386507dbc..dc68916bf 100644 --- a/plugins/osx/osx.plugin.zsh +++ b/plugins/osx/osx.plugin.zsh @@ -263,6 +263,7 @@ EOF # Spotify control function function spotify() { + showHelp () { echo "Usage:"; echo; @@ -277,13 +278,35 @@ function spotify() { echo " pos [time] # Jumps to a time (in secs) in the current song."; echo " quit # Stops playback and quits Spotify."; echo; + echo " vol up # Increases the volume by 10%."; + echo " vol down # Decreases the volume by 10%."; echo " vol [amount] # Sets the volume to an amount between 0 and 100."; echo " vol show # Shows the current Spotify volume."; echo; + echo " status # Shows the current player status."; + echo " share # Copies the current song URL to the clipboard." + echo " info # Shows Full Information about song that is playing."; + echo; echo " toggle shuffle # Toggles shuffle playback mode."; echo " toggle repeat # Toggles repeat playback mode."; } + showStatus () { + state=$(osascript -e 'tell application "Spotify" to player state as string'); + echo "Spotify is currently $state."; + if [ "$state" = "playing" ]; then + artist=$(osascript -e 'tell application "Spotify" to artist of current track as string'); + album=$(osascript -e 'tell application "Spotify" to album of current track as string'); + track=$(osascript -e 'tell application "Spotify" to name of current track as string'); + duration=$(osascript -e 'tell application "Spotify" to duration of current track as string'); + duration=$(echo "scale=2; $duration / 60 / 1000" | bc); + position=$(osascript -e 'tell application "Spotify" to player position as string' | tr ',' '.'); + position=$(echo "scale=2; $position / 60" | bc | awk '{printf "%0.2f", $0}'); + + echo "$reset""Artist: $artist\nAlbum: $album\nTrack: $track \nPosition: $position / $duration"; + fi + } + if [ $# = 0 ]; then showHelp; else @@ -367,6 +390,51 @@ function spotify() { osascript -e "tell application \"Spotify\" to set player position to $2"; break;; + "status" ) + showStatus; + break ;; + + "info" ) + info=$(osascript -e 'tell application "Spotify" + set tM to round (duration of current track / 60) rounding down + set tS to duration of current track mod 60 + set pos to player position as text + set myTime to tM as text & "min " & tS as text & "s" + set nM to round (player position / 60) rounding down + set nS to round (player position mod 60) rounding down + set nowAt to nM as text & "min " & nS as text & "s" + set info to "" & "\nArtist: " & artist of current track + set info to info & "\nTrack: " & name of current track + set info to info & "\nAlbum Artist: " & album artist of current track + set info to info & "\nAlbum: " & album of current track + set info to info & "\nSeconds: " & duration of current track + set info to info & "\nSeconds played: " & pos + set info to info & "\nDuration: " & mytime + set info to info & "\nNow at: " & nowAt + set info to info & "\nPlayed Count: " & played count of current track + set info to info & "\nTrack Number: " & track number of current track + set info to info & "\nPopularity: " & popularity of current track + set info to info & "\nId: " & id of current track + set info to info & "\nSpotify URL: " & spotify url of current track + set info to info & "\nArtwork: " & artwork of current track + set info to info & "\nPlayer: " & player state + set info to info & "\nVolume: " & sound volume + set info to info & "\nShuffle: " & shuffling + set info to info & "\nRepeating: " & repeating + end tell + return info') + echo "$info"; + break ;; + + "share" ) + url=$(osascript -e 'tell application "Spotify" to spotify url of current track'); + remove='spotify:track:' + url=${url#$remove} + url="http://open.spotify.com/track/$url" + echo "Share URL: $url"; + echo -n "$url" | pbcopy + break;; + -h|--help| *) showHelp; break ;; From 2a5321f4e69b55f626c94993a40b1dee6a73c26f Mon Sep 17 00:00:00 2001 From: mahi97 Date: Wed, 31 Aug 2016 03:56:21 +0430 Subject: [PATCH 0015/1083] add color echo --- plugins/osx/osx.plugin.zsh | 43 +++++++++++++++++++++++--------------- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/plugins/osx/osx.plugin.zsh b/plugins/osx/osx.plugin.zsh index dc68916bf..19acd3dd5 100644 --- a/plugins/osx/osx.plugin.zsh +++ b/plugins/osx/osx.plugin.zsh @@ -263,7 +263,7 @@ EOF # Spotify control function function spotify() { - + showHelp () { echo "Usage:"; echo; @@ -291,9 +291,16 @@ function spotify() { echo " toggle repeat # Toggles repeat playback mode."; } + cecho(){ + bold=$(tput bold); + green=$(tput setaf 2); + reset=$(tput sgr0); + echo "$bold$green$1$reset"; + } + showStatus () { state=$(osascript -e 'tell application "Spotify" to player state as string'); - echo "Spotify is currently $state."; + cecho "Spotify is currently $state."; if [ "$state" = "playing" ]; then artist=$(osascript -e 'tell application "Spotify" to artist of current track as string'); album=$(osascript -e 'tell application "Spotify" to album of current track as string'); @@ -307,6 +314,8 @@ function spotify() { fi } + + if [ $# = 0 ]; then showHelp; else @@ -321,50 +330,50 @@ function spotify() { case $arg in "play" ) - echo "Playing Spotify."; + cecho "Playing Spotify."; osascript -e 'tell application "Spotify" to play'; break ;; "pause" ) - echo "Pausing Spotify."; + cecho "Pausing Spotify."; osascript -e 'tell application "Spotify" to pause'; break ;; "quit" ) - echo "Quitting Spotify."; + cecho "Quitting Spotify."; osascript -e 'tell application "Spotify" to quit'; exit 1 ;; "next" ) - echo "Going to next track." ; + cecho "Going to next track." ; osascript -e 'tell application "Spotify" to next track'; break ;; "prev" ) - echo "Going to previous track."; + cecho "Going to previous track."; osascript -e 'tell application "Spotify" to previous track'; break ;; "vol" ) vol=$(osascript -e 'tell application "Spotify" to sound volume as integer'); if [[ "$2" = "show" || "$2" = "" ]]; then - echo "Current Spotify volume level is $vol."; + cecho "Current Spotify volume level is $vol."; break ; elif [ "$2" = "up" ]; then if [ "$vol" -le 90 ]; then newvol=$(( vol+10 )); - echo "Increasing Spotify volume to $newvol."; + cecho "Increasing Spotify volume to $newvol."; else newvol=100; - echo "Spotify volume level is at max."; + cecho "Spotify volume level is at max."; fi elif [ "$2" = "down" ]; then if [ "$vol" -ge 10 ]; then newvol=$(( vol-10 )); - echo "Reducing Spotify volume to $newvol."; + cecho "Reducing Spotify volume to $newvol."; else newvol=0; - echo "Spotify volume level is at min."; + cecho "Spotify volume level is at min."; fi elif [ "$2" -ge 0 ]; then newvol=$2; @@ -377,16 +386,16 @@ function spotify() { if [ "$2" = "shuffle" ]; then osascript -e 'tell application "Spotify" to set shuffling to not shuffling'; curr=$(osascript -e 'tell application "Spotify" to shuffling'); - echo "Spotify shuffling set to $curr"; + cecho "Spotify shuffling set to $curr"; elif [ "$2" = "repeat" ]; then osascript -e 'tell application "Spotify" to set repeating to not repeating'; curr=$(osascript -e 'tell application "Spotify" to repeating'); - echo "Spotify repeating set to $curr"; + cecho "Spotify repeating set to $curr"; fi break ;; "pos" ) - echo "Adjusting Spotify play position." + cecho "Adjusting Spotify play position." osascript -e "tell application \"Spotify\" to set player position to $2"; break;; @@ -431,8 +440,8 @@ function spotify() { remove='spotify:track:' url=${url#$remove} url="http://open.spotify.com/track/$url" - echo "Share URL: $url"; - echo -n "$url" | pbcopy + cecho "Share URL: $url"; + cecho -n "$url" | pbcopy break;; -h|--help| *) From 96d57dc33ec7ce473a7ce06d7c0166eabd14e1c8 Mon Sep 17 00:00:00 2001 From: mahi97 Date: Wed, 31 Aug 2016 03:58:15 +0430 Subject: [PATCH 0016/1083] change pause to play/pause --- plugins/osx/osx.plugin.zsh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/plugins/osx/osx.plugin.zsh b/plugins/osx/osx.plugin.zsh index 19acd3dd5..058576f0b 100644 --- a/plugins/osx/osx.plugin.zsh +++ b/plugins/osx/osx.plugin.zsh @@ -335,8 +335,14 @@ function spotify() { break ;; "pause" ) - cecho "Pausing Spotify."; - osascript -e 'tell application "Spotify" to pause'; + state=$(osascript -e 'tell application "Spotify" to player state as string'); + if [ "$state" = "playing" ]; then + cecho "Pausing Spotify."; + else + cecho "Playing Spotify."; + fi + + osascript -e 'tell application "Spotify" to playpause'; break ;; "quit" ) From 3b2f827d5b37d51bdd0c165dc2b66501704990c4 Mon Sep 17 00:00:00 2001 From: mahi97 Date: Wed, 31 Aug 2016 04:12:13 +0430 Subject: [PATCH 0017/1083] add Search Option for album,artist and tracks --- plugins/osx/osx.plugin.zsh | 42 +++++++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/plugins/osx/osx.plugin.zsh b/plugins/osx/osx.plugin.zsh index 058576f0b..031740633 100644 --- a/plugins/osx/osx.plugin.zsh +++ b/plugins/osx/osx.plugin.zsh @@ -330,9 +330,49 @@ function spotify() { case $arg in "play" ) + if [ $# != 1 ]; then + # There are additional arguments, so find out how many + array=( $@ ); + len=${#array[@]}; + SPOTIFY_SEARCH_API="https://api.spotify.com/v1/search" + SPOTIFY_PLAY_URI=""; + + searchAndPlay() { + type="$1" + Q="$2" + + cecho "Searching ${type}s for: $Q"; + + SPOTIFY_PLAY_URI=$( \ + curl -s -G $SPOTIFY_SEARCH_API --data-urlencode "q=$Q" -d "type=$type&limit=1&offset=0" -H "Accept: application/json" \ + | grep -E -o "spotify:$type:[a-zA-Z0-9]+" -m 1 + ) + } + + case $2 in + "album" | "artist" | "track" ) + _args=${array[*]:2:$len}; + searchAndPlay "$2" "$_args";; + + * ) + _args=${array[*]:1:$len}; + searchAndPlay track "$_args";; + esac + + if [ "$SPOTIFY_PLAY_URI" != "" ]; then + cecho "Playing ($Q Search) -> Spotify URL: $"; + + osascript -e "tell application \"Spotify\" to play track \"$SPOTIFY_PLAY_URI\""; + + else + cecho "No results when searching for $Q"; + fi + else + # play is the only param cecho "Playing Spotify."; osascript -e 'tell application "Spotify" to play'; - break ;; + fi + break ;; "pause" ) state=$(osascript -e 'tell application "Spotify" to player state as string'); From b808555678ea6a960d3ab31f1bdce4bd18ab0a10 Mon Sep 17 00:00:00 2001 From: mahi97 Date: Wed, 31 Aug 2016 04:18:22 +0430 Subject: [PATCH 0018/1083] add search option for playlist --- plugins/osx/osx.plugin.zsh | 35 +++++++++++++++++++++++++++++------ 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/plugins/osx/osx.plugin.zsh b/plugins/osx/osx.plugin.zsh index 031740633..4ba2026c0 100644 --- a/plugins/osx/osx.plugin.zsh +++ b/plugins/osx/osx.plugin.zsh @@ -350,6 +350,29 @@ function spotify() { } case $2 in + "list" ) + _args=${array[*]:2:$len}; + Q=$_args; + + cecho "Searching playlists for: $Q"; + + results=$( \ + curl -s -G $SPOTIFY_SEARCH_API --data-urlencode "q=$Q" -d "type=playlist&limit=10&offset=0" -H "Accept: application/json" \ + | grep -E -o "spotify:user:[a-zA-Z0-9_]+:playlist:[a-zA-Z0-9]+" -m 10 \ + ) + + count=$( \ + echo "$results" | grep -c "spotify:user" \ + ) + + if [ "$count" -gt 0 ]; then + random=$(( RANDOM % count)); + + SPOTIFY_PLAY_URI=$( \ + echo "$results" | awk -v random="$random" '/spotify:user:[a-zA-Z0-9]+:playlist:[a-zA-Z0-9]+/{i++}i==random{print; exit}' \ + ) + fi;; + "album" | "artist" | "track" ) _args=${array[*]:2:$len}; searchAndPlay "$2" "$_args";; @@ -367,12 +390,12 @@ function spotify() { else cecho "No results when searching for $Q"; fi - else - # play is the only param - cecho "Playing Spotify."; - osascript -e 'tell application "Spotify" to play'; - fi - break ;; + else + # play is the only param + cecho "Playing Spotify."; + osascript -e 'tell application "Spotify" to play'; + fi + break ;; "pause" ) state=$(osascript -e 'tell application "Spotify" to player state as string'); From 6cbba3353f20174c1cd55246507182dfab65ed97 Mon Sep 17 00:00:00 2001 From: mahi97 Date: Wed, 31 Aug 2016 04:35:29 +0430 Subject: [PATCH 0019/1083] fix showStatus output --- plugins/osx/osx.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/osx/osx.plugin.zsh b/plugins/osx/osx.plugin.zsh index 4ba2026c0..84eec9eed 100644 --- a/plugins/osx/osx.plugin.zsh +++ b/plugins/osx/osx.plugin.zsh @@ -310,7 +310,7 @@ function spotify() { position=$(osascript -e 'tell application "Spotify" to player position as string' | tr ',' '.'); position=$(echo "scale=2; $position / 60" | bc | awk '{printf "%0.2f", $0}'); - echo "$reset""Artist: $artist\nAlbum: $album\nTrack: $track \nPosition: $position / $duration"; + printf "$reset""Artist: %s\nAlbum: %s\nTrack: %s \nPosition: %s / %s" "$artist" "$album" "$track" "$position" "$duration"; fi } From d099022e440a72b1352ac09773a1863d9833dbb1 Mon Sep 17 00:00:00 2001 From: mahi97 Date: Wed, 31 Aug 2016 04:41:54 +0430 Subject: [PATCH 0020/1083] complete help --- plugins/osx/osx.plugin.zsh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plugins/osx/osx.plugin.zsh b/plugins/osx/osx.plugin.zsh index 84eec9eed..d75e3d2d6 100644 --- a/plugins/osx/osx.plugin.zsh +++ b/plugins/osx/osx.plugin.zsh @@ -272,6 +272,10 @@ function spotify() { echo "Commands:"; echo; echo " play # Resumes playback where Spotify last left off."; + echo " play [song name] # Finds a song by name and plays it."; + echo " play album [album name] # Finds an album by name and plays it."; + echo " play artist [artist name] # Finds an artist by name and plays it."; + echo " play list [playlist name] # Finds a playlist by name and plays it."; echo " pause # Pauses Spotify playback."; echo " next # Skips to the next song in a playlist."; echo " prev # Returns to the previous song in a playlist."; From f820345afa9d500f0ff6b1ad1c45d4d37ef7d88a Mon Sep 17 00:00:00 2001 From: mahi97 Date: Thu, 1 Sep 2016 01:52:04 +0430 Subject: [PATCH 0021/1083] readme updated --- plugins/osx/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/osx/README.md b/plugins/osx/README.md index 0fcd23dd5..b77daecc5 100644 --- a/plugins/osx/README.md +++ b/plugins/osx/README.md @@ -30,3 +30,4 @@ Original author: [Sorin Ionescu](https://github.com/sorin-ionescu) | `showfiles` | Show hidden files | | `hidefiles` | Hide the hidden files | | `itunes` | Control iTunes. User `itunes -h` for usage details | +| `spotify` | Control Spotify and search by artist, album, track and etc.| From d6e032035cde237f09306ea6670a22e5994c38f4 Mon Sep 17 00:00:00 2001 From: mahi97 Date: Thu, 1 Sep 2016 01:52:43 +0430 Subject: [PATCH 0022/1083] seach show Url of song --- plugins/osx/osx.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/osx/osx.plugin.zsh b/plugins/osx/osx.plugin.zsh index d75e3d2d6..aa6a256c1 100644 --- a/plugins/osx/osx.plugin.zsh +++ b/plugins/osx/osx.plugin.zsh @@ -387,7 +387,7 @@ function spotify() { esac if [ "$SPOTIFY_PLAY_URI" != "" ]; then - cecho "Playing ($Q Search) -> Spotify URL: $"; + cecho "Playing ($Q Search) -> Spotify URL: $SPOTIFY_PLAY_URI"; osascript -e "tell application \"Spotify\" to play track \"$SPOTIFY_PLAY_URI\""; From 57fcee0f1c520a7c5e3aa5e2bde974154cdaf0c3 Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Sat, 24 Sep 2016 16:06:44 -0700 Subject: [PATCH 0023/1083] README copy updates --- README.md | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index aab1af9fd..6da731890 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,15 @@ Oh My Zsh

-Oh My Zsh is an open source, community-driven framework for managing your [zsh](http://www.zsh.org/) configuration. That sounds boring. Let's try this again. +Oh My Zsh is an open source, community-driven framework for managing your [zsh](http://www.zsh.org/) configuration. -__Oh My Zsh is a way of life!__ Once installed, your terminal prompt will become the talk of the town _or your money back!_ Each time you interact with your command prompt, you'll be able to take advantage of the hundreds of bundled plugins and pretty themes. Strangers will come up to you in cafés and ask you, _"that is amazing. are you some sort of genius?"_ Finally, you'll begin to get the sort of attention that you always felt that you deserved. ...or maybe you'll just use the time that you saved to start flossing more often. +That sounds boring. Let's try this again. + +__Oh My Zsh is a way of life!__ + +Once installed, your terminal shell will become the talk of the town _or your money back!_ With each keystroke in your command prompt, you'll take advantage of the hundreds of powerful plugins and beautiful themes. Strangers will come up to you in cafés and ask you, _"that is amazing! are you some sort of genius?"_ + +Finally, you'll begin to get the sort of attention that you have always felt you deserved. ...or maybe you'll use the time that you're saving to start flossing more often. To learn more, visit [ohmyz.sh](http://ohmyz.sh) and follow [@ohmyzsh](https://twitter.com/ohmyzsh) on Twitter. @@ -202,7 +208,10 @@ Thank you so much! ## Follow Us -We have an [@ohmyzsh](https://twitter.com/ohmyzsh) Twitter account. You should follow it. +We're on the social medias. + +* [@ohmyzsh](https://twitter.com/ohmyzsh) on Twitter. You should follow it. +* [Oh My Zsh](https://www.facebook.com/Oh-My-Zsh-296616263819290/) on Facebook. ## Merchandise From 0f4d6a5056d458e04d11c046820e5d17f65c161e Mon Sep 17 00:00:00 2001 From: Thomas Date: Mon, 26 Sep 2016 16:40:07 +0200 Subject: [PATCH 0024/1083] Add a tip to ease agnoster first setup --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 6da731890..268c1b39d 100644 --- a/README.md +++ b/README.md @@ -78,7 +78,9 @@ ZSH_THEME="robbyrussell" To use a different theme, simply change the value to match the name of your desired theme. For example: ```shell -ZSH_THEME="agnoster" # (this is one of the fancy ones) +ZSH_THEME="agnoster" # (this is one of the fancy ones ; + # you might need to install a specific font on your console's host for this to work ; + # see https://github.com/powerline/fonts/tree/master/DejaVuSansMono) ``` Open up a new terminal window and your prompt should look something like... From 798c38dd1a70637cd17c26879be83e7f25a3ee53 Mon Sep 17 00:00:00 2001 From: slavaGanzin Date: Tue, 27 Sep 2016 15:18:23 +0300 Subject: [PATCH 0025/1083] globalias fix #4834 --- plugins/globalias/globalias.plugin.zsh | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 plugins/globalias/globalias.plugin.zsh diff --git a/plugins/globalias/globalias.plugin.zsh b/plugins/globalias/globalias.plugin.zsh new file mode 100644 index 000000000..95a0e3072 --- /dev/null +++ b/plugins/globalias/globalias.plugin.zsh @@ -0,0 +1,11 @@ +globalias() { + zle _expand_alias + zle expand-word + zle self-insert +} +zle -N globalias +bindkey -e " " globalias +bindkey -v " " globalias +bindkey -e "^ " magic-space # control-space to bypass completion +bindkey -v "^ " magic-space +bindkey -M isearch " " magic-space # normal space during searches From 65874f2b2201c2e55d410ab322dc20394a587b83 Mon Sep 17 00:00:00 2001 From: Leif Ringstad Date: Wed, 28 Sep 2016 14:47:00 +0200 Subject: [PATCH 0026/1083] Add more docker compose aliases (#5422) Adds the following aliases: ```zsh alias dco='docker-compose' alias dcr='docker-compose run' alias dce='docker-compose exec' ``` And sorts the aliases similar to `docker-compose help` order --- plugins/docker-compose/docker-compose.plugin.zsh | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/plugins/docker-compose/docker-compose.plugin.zsh b/plugins/docker-compose/docker-compose.plugin.zsh index 351e77824..9f2457fc4 100644 --- a/plugins/docker-compose/docker-compose.plugin.zsh +++ b/plugins/docker-compose/docker-compose.plugin.zsh @@ -5,9 +5,16 @@ # Aliases ################################################################### -alias dcup='docker-compose up' +# Use dco as alias for docker-compose, since dc on *nix is 'dc - an arbitrary precision calculator' +# https://www.gnu.org/software/bc/manual/dc-1.05/html_mono/dc.html + +alias dco='docker-compose' + alias dcb='docker-compose build' -alias dcrm='docker-compose rm' +alias dce='docker-compose exec' alias dcps='docker-compose ps' -alias dcstop='docker-compose stop' alias dcrestart='docker-compose restart' +alias dcrm='docker-compose rm' +alias dcr='docker-compose run' +alias dcstop='docker-compose stop' +alias dcup='docker-compose up' From ac8915d43f0e8de9294c8552dc338ecc9993acd2 Mon Sep 17 00:00:00 2001 From: Diego Said Anaya Mancilla Date: Wed, 28 Sep 2016 14:28:53 -0500 Subject: [PATCH 0027/1083] Update pip plugin to last stable release (#5472) Update pip plugin to last stable release --- plugins/pip/_pip | 38 ++++++++++++++++++++++++++------------ 1 file changed, 26 insertions(+), 12 deletions(-) diff --git a/plugins/pip/_pip b/plugins/pip/_pip index cb155e5f4..732ffabea 100644 --- a/plugins/pip/_pip +++ b/plugins/pip/_pip @@ -1,7 +1,8 @@ #compdef pip pip2 pip-2.7 pip3 pip-3.2 pip-3.3 pip-3.4 #autoload -# pip zsh completion, based on homebrew completion +# pip zsh completion, based on last stable release (pip8) +# homebrew completion and backwards compatibility _pip_all() { # we cache the list of packages (originally from the macports plugin) @@ -17,30 +18,43 @@ _pip_installed() { local -a _1st_arguments _1st_arguments=( - 'bundle:create pybundles (archives containing multiple packages)' - 'freeze:output all currently installed packages (exact versions) to stdout' - 'help:show available commands' - 'show:show information about installed packages' 'install:install packages' - 'search:search PyPI' + 'download:download packages' 'uninstall:uninstall packages' - 'unzip:unzip individual packages' - 'zip:zip individual packages' + 'freeze:output all currently installed packages (exact versions) to stdout' + 'list:list installed packages' + 'show:show information about installed packages' + 'search:search PyPI' + 'wheel:build individual wheel archives for your requirements and dependencies' + 'hash:compute a hash of a local package archive' + 'help:show available commands' + 'bundle:create pybundles (archives containing multiple packages)(deprecated)' + 'unzip:unzip individual packages(deprecated)' + 'zip:zip individual packages(deprecated)' ) local expl local -a all_pkgs installed_pkgs _arguments \ - '(--version)--version[show version number of program and exit]' \ '(-h --help)'{-h,--help}'[show help]' \ - '(-E --environment)'{-E,--environment}'[virtualenv environment to run pip in]' \ - '(-s --enable-site-packages)'{-s,--enable-site-packages}'[include site-packages in virtualenv]' \ + '(--isolated)--isolated[run pip in isolated mode, ignores environment variables and user configuration]' \ '(-v --verbose)'{-v,--verbose}'[give more output]' \ + '(-V --version)'{-V,--version}'[show version number of program and exit]' \ '(-q --quiet)'{-q,--quiet}'[give less output]' \ '(--log)--log[log file location]' \ '(--proxy)--proxy[proxy in form user:passwd@proxy.server:port]' \ + '(--retries)--retries[max number of retries per connection (default 5 times)]' \ '(--timeout)--timeout[socket timeout (default 15s)]' \ + '(--exists-action)--exists-action[default action when a path already exists: (s)witch, (i)gnore, (w)ipe, (b)ackup]' \ + '(--trusted-host)--trusted-host[mark this host as trusted]' \ + '(--cert)--cert[path to alternate CA bundle]' \ + '(--client-cert)--client-cert[path to SSL client certificate]' \ + '(--cache-dir)--cache-dir[store the cache data in specified directory]' \ + '(--no-cache-dir)--no-cache-dir[disable de cache]' \ + '(--disable-pip-version-check)--disable-pip-version-check[do not check periodically for new pip version downloads]' \ + '(-E --environment)'{-E,--environment}'[virtualenv environment to run pip in (deprecated)]' \ + '(-s --enable-site-packages)'{-s,--enable-site-packages}'[include site-packages in virtualenv (deprecated)]' \ '*:: :->subcmds' && return 0 if (( CURRENT == 1 )); then @@ -56,7 +70,7 @@ case "$words[1]" in _arguments \ '(-l --local)'{-l,--local}'[report only virtualenv packages]' ;; install) - _arguments \ + _arguments \ '(-U --upgrade)'{-U,--upgrade}'[upgrade all packages to the newest available version]' \ '(-f --find-links)'{-f,--find-links}'[URL for finding packages]' \ '(-r --requirement)'{-r,--requirement}'[Requirements file for packages to install]:File:_files' \ From 10ffa4fe992e56a93396ed8914eba74821bb2cca Mon Sep 17 00:00:00 2001 From: Christian Ferbar Date: Tue, 27 Sep 2016 12:27:37 +0200 Subject: [PATCH 0028/1083] Add README to svn plugin --- plugins/svn/README.md | 64 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 plugins/svn/README.md diff --git a/plugins/svn/README.md b/plugins/svn/README.md new file mode 100644 index 000000000..b8eff70f5 --- /dev/null +++ b/plugins/svn/README.md @@ -0,0 +1,64 @@ +# `svn` plugin + +This plugin adds some utility functions to display additional information regarding your current +svn repsitiory. See http://subversion.apache.org/ for the full svn documentation. + +## Functions + +| Command | Description | +|:-----------------------|:----------------------------------------| +|svn_prompt_info | prompt for some themes | +|in_svn | within svn directory | +|svn_get_repo_name | | +|svn_get_branch_name | branch name (see caveats) | +|svn_get_rev_nr | revision number | +|svn_dirty | changes in this subversion repo | + +## Caveats + +The plugin expects the first directory to be the current branch / tag / trunk. So, it returns +the first path element if you don't use branches. + +## Usage + +To use it, add `svn` to your plugins array: +```sh +plugins=(... svn) +``` + +### Agnoster theme git-like prompt + +Enable the svn plugin and add the followind lines to your ```~/.zshrc``` + +```shell +prompt_svn() { + local rev branch + if in_svn; then + rev=$(svn_get_rev_nr) + branch=$(svn_get_branch_name) + if [ `svn_dirty_choose_pwd 1 0` -eq 1 ]; then + prompt_segment yellow black + echo -n "$rev@$branch" + echo -n "±" + else + prompt_segment green black + echo -n "$rev@$branch" + fi + fi +} +``` + +override the agnoster build_prompt() function: + +```shell +build_prompt() { + RETVAL=$? + prompt_status + prompt_context + prompt_dir + prompt_git + prompt_svn + prompt_end +} +``` + From 364019a3c9c4ef08d2d7f0752c0ac008293d62df Mon Sep 17 00:00:00 2001 From: Christian Ferbar Date: Tue, 27 Sep 2016 12:29:25 +0200 Subject: [PATCH 0029/1083] Add localization workaround to svn plugin --- plugins/svn/svn.plugin.zsh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/plugins/svn/svn.plugin.zsh b/plugins/svn/svn.plugin.zsh index 816055afe..e95ee9d99 100644 --- a/plugins/svn/svn.plugin.zsh +++ b/plugins/svn/svn.plugin.zsh @@ -25,14 +25,14 @@ function in_svn() { function svn_get_repo_name() { if in_svn; then - svn info | sed -n 's/Repository\ Root:\ .*\///p' | read SVN_ROOT - svn info | sed -n "s/URL:\ .*$SVN_ROOT\///p" + LANG=C svn info | sed -n 's/^Repository\ Root:\ .*\///p' | read SVN_ROOT + LANG=C svn info | sed -n "s/^URL:\ .*$SVN_ROOT\///p" fi } function svn_get_branch_name() { local _DISPLAY=$( - svn info 2> /dev/null | \ + LANG=C svn info 2> /dev/null | \ awk -F/ \ '/^URL:/ { \ for (i=0; i<=NF; i++) { \ @@ -54,13 +54,13 @@ function svn_get_branch_name() { function svn_get_rev_nr() { if in_svn; then - svn info 2> /dev/null | sed -n 's/Revision:\ //p' + LANG=C svn info 2> /dev/null | sed -n 's/Revision:\ //p' fi } function svn_dirty_choose() { if in_svn; then - local root=`svn info 2> /dev/null | sed -n 's/^Working Copy Root Path: //p'` + local root=`LANG=C svn info 2> /dev/null | sed -n 's/^Working Copy Root Path: //p'` if $(svn status $root 2> /dev/null | command grep -Eq '^\s*[ACDIM!?L]'); then # Grep exits with 0 when "One or more lines were selected", return "dirty". echo $1 From f573247a59773f47b1741967335ec6c495bcf4b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Thu, 29 Sep 2016 13:56:16 +0200 Subject: [PATCH 0030/1083] Clean up svn README --- plugins/svn/README.md | 103 ++++++++++++++++++++++-------------------- 1 file changed, 53 insertions(+), 50 deletions(-) diff --git a/plugins/svn/README.md b/plugins/svn/README.md index b8eff70f5..1f7b70c86 100644 --- a/plugins/svn/README.md +++ b/plugins/svn/README.md @@ -1,64 +1,67 @@ # `svn` plugin This plugin adds some utility functions to display additional information regarding your current -svn repsitiory. See http://subversion.apache.org/ for the full svn documentation. - -## Functions - -| Command | Description | -|:-----------------------|:----------------------------------------| -|svn_prompt_info | prompt for some themes | -|in_svn | within svn directory | -|svn_get_repo_name | | -|svn_get_branch_name | branch name (see caveats) | -|svn_get_rev_nr | revision number | -|svn_dirty | changes in this subversion repo | - -## Caveats - -The plugin expects the first directory to be the current branch / tag / trunk. So, it returns -the first path element if you don't use branches. - -## Usage +svn repository. See http://subversion.apache.org/ for the full svn documentation. To use it, add `svn` to your plugins array: -```sh + +```zsh plugins=(... svn) ``` -### Agnoster theme git-like prompt +## Functions -Enable the svn plugin and add the followind lines to your ```~/.zshrc``` +| Command | Description | +|:----------------------|:--------------------------------------------| +| `svn_prompt_info` | Shows svn prompt in themes | +| `in_svn` | Checks if we're in an svn repository | +| `svn_get_repo_name` | Get repository name | +| `svn_get_branch_name` | Get branch name (see [caveats](#caveats)) | +| `svn_get_rev_nr` | Get revision number | +| `svn_dirty` | Checks if there are changes in the svn repo | -```shell -prompt_svn() { - local rev branch - if in_svn; then - rev=$(svn_get_rev_nr) - branch=$(svn_get_branch_name) - if [ `svn_dirty_choose_pwd 1 0` -eq 1 ]; then - prompt_segment yellow black - echo -n "$rev@$branch" - echo -n "±" - else - prompt_segment green black - echo -n "$rev@$branch" +## Caveats + +The plugin expects the first directory to be the current branch / tag / trunk. So it returns +the first path element if you don't use branches. + +## Usage on themes + +To use this in the `agnoster` theme follow these instructions: + +1. Enable the svn plugin + +2. Add the following lines to your `zshrc` file: + + ```shell + prompt_svn() { + local rev branch + if in_svn; then + rev=$(svn_get_rev_nr) + branch=$(svn_get_branch_name) + if [[ $(svn_dirty_choose_pwd 1 0) -eq 1 ]]; then + prompt_segment yellow black + echo -n "$rev@$branch" + echo -n "±" + else + prompt_segment green black + echo -n "$rev@$branch" + fi fi - fi -} -``` + } + ``` -override the agnoster build_prompt() function: +3. Override the agnoster `build_prompt()` function: -```shell -build_prompt() { - RETVAL=$? - prompt_status - prompt_context - prompt_dir - prompt_git - prompt_svn - prompt_end -} -``` + ```zsh + build_prompt() { + RETVAL=$? + prompt_status + prompt_context + prompt_dir + prompt_git + prompt_svn + prompt_end + } + ``` From e6df0e036e39bcc2c20d7feaef1749d3c4f2768f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Thu, 29 Sep 2016 14:03:09 +0200 Subject: [PATCH 0031/1083] Clean up and refactor code in svn plugin --- plugins/svn/svn.plugin.zsh | 58 ++++++++++++++++---------------------- 1 file changed, 25 insertions(+), 33 deletions(-) diff --git a/plugins/svn/svn.plugin.zsh b/plugins/svn/svn.plugin.zsh index e95ee9d99..fbc9ee538 100644 --- a/plugins/svn/svn.plugin.zsh +++ b/plugins/svn/svn.plugin.zsh @@ -1,9 +1,7 @@ -# vim:ft=zsh ts=2 sw=2 sts=2 -# -function svn_prompt_info() { +svn_prompt_info() { local _DISPLAY if in_svn; then - if [ "x$SVN_SHOW_BRANCH" = "xtrue" ]; then + if [[ "$SVN_SHOW_BRANCH" = true ]]; then unset SVN_SHOW_BRANCH _DISPLAY=$(svn_get_branch_name) else @@ -16,21 +14,18 @@ $ZSH_THEME_REPO_NAME_COLOR$_DISPLAY$ZSH_PROMPT_BASE_COLOR$ZSH_THEME_SVN_PROMPT_S } -function in_svn() { - if $(svn info >/dev/null 2>&1); then - return 0 - fi - return 1 +in_svn() { + svn info >/dev/null 2>&1 } -function svn_get_repo_name() { +svn_get_repo_name() { if in_svn; then LANG=C svn info | sed -n 's/^Repository\ Root:\ .*\///p' | read SVN_ROOT LANG=C svn info | sed -n "s/^URL:\ .*$SVN_ROOT\///p" fi } -function svn_get_branch_name() { +svn_get_branch_name() { local _DISPLAY=$( LANG=C svn info 2> /dev/null | \ awk -F/ \ @@ -44,41 +39,28 @@ function svn_get_branch_name() { } \ }' ) - - if [ "x$_DISPLAY" = "x" ]; then + + if [[ -z "$_DISPLAY" ]]; then svn_get_repo_name else echo $_DISPLAY fi } -function svn_get_rev_nr() { +svn_get_rev_nr() { if in_svn; then LANG=C svn info 2> /dev/null | sed -n 's/Revision:\ //p' fi } -function svn_dirty_choose() { - if in_svn; then - local root=`LANG=C svn info 2> /dev/null | sed -n 's/^Working Copy Root Path: //p'` - if $(svn status $root 2> /dev/null | command grep -Eq '^\s*[ACDIM!?L]'); then - # Grep exits with 0 when "One or more lines were selected", return "dirty". - echo $1 - else - # Otherwise, no lines were found, or an error occurred. Return clean. - echo $2 - fi - fi -} - -function svn_dirty() { +svn_dirty() { svn_dirty_choose $ZSH_THEME_SVN_PROMPT_DIRTY $ZSH_THEME_SVN_PROMPT_CLEAN } -function svn_dirty_choose_pwd () { +svn_dirty_choose() { if in_svn; then - local root=$PWD - if $(svn status $root 2> /dev/null | command grep -Eq '^\s*[ACDIM!?L]'); then + local root=$(LANG=C svn info 2> /dev/null | sed -n 's/^Working Copy Root Path: //p') + if svn status $root 2> /dev/null | command grep -Eq '^\s*[ACDIM!?L]'; then # Grep exits with 0 when "One or more lines were selected", return "dirty". echo $1 else @@ -88,8 +70,18 @@ function svn_dirty_choose_pwd () { fi } -function svn_dirty_pwd () { +svn_dirty_pwd () { svn_dirty_choose_pwd $ZSH_THEME_SVN_PROMPT_DIRTY_PWD $ZSH_THEME_SVN_PROMPT_CLEAN_PWD } - +svn_dirty_choose_pwd () { + if in_svn; then + if svn status "$PWD" 2> /dev/null | command grep -Eq '^\s*[ACDIM!?L]'; then + # Grep exits with 0 when "One or more lines were selected", return "dirty". + echo $1 + else + # Otherwise, no lines were found, or an error occurred. Return clean. + echo $2 + fi + fi +} From 09d95251a7176e0c4b2a71837b7356980fe738e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Thu, 29 Sep 2016 13:19:47 +0200 Subject: [PATCH 0032/1083] extract: fix styling --- plugins/extract/_extract | 2 - plugins/extract/extract.plugin.zsh | 149 ++++++++++++++--------------- 2 files changed, 71 insertions(+), 80 deletions(-) diff --git a/plugins/extract/_extract b/plugins/extract/_extract index 387b344bc..a73c892d9 100644 --- a/plugins/extract/_extract +++ b/plugins/extract/_extract @@ -4,5 +4,3 @@ _arguments \ '(-r --remove)'{-r,--remove}'[Remove archive.]' \ "*::archive file:_files -g '(#i)*.(tar|tgz|tbz|tbz2|txz|tlz|gz|bz2|xz|lzma|Z|zip|ipsw|rar|7z|deb)(-.)'" && return 0 - - diff --git a/plugins/extract/extract.plugin.zsh b/plugins/extract/extract.plugin.zsh index 5d0809e9a..081d5168f 100644 --- a/plugins/extract/extract.plugin.zsh +++ b/plugins/extract/extract.plugin.zsh @@ -1,80 +1,73 @@ -# ------------------------------------------------------------------------------ -# FILE: extract.plugin.zsh -# DESCRIPTION: oh-my-zsh plugin file. -# AUTHOR: Sorin Ionescu (sorin.ionescu@gmail.com) -# VERSION: 1.0.1 -# ------------------------------------------------------------------------------ - - -function extract() { - local remove_archive - local success - local file_name - local extract_dir - - if (( $# == 0 )); then - echo "Usage: extract [-option] [file ...]" - echo - echo Options: - echo " -r, --remove Remove archive." - echo - echo "Report bugs to ." - fi - - remove_archive=1 - if [[ "$1" == "-r" ]] || [[ "$1" == "--remove" ]]; then - remove_archive=0 - shift - fi - - while (( $# > 0 )); do - if [[ ! -f "$1" ]]; then - echo "extract: '$1' is not a valid file" 1>&2 - shift - continue - fi - - success=0 - file_name="$( basename "$1" )" - extract_dir="$( echo "$file_name" | sed "s/\.${1##*.}//g" )" - case "$1" in - (*.tar.gz|*.tgz) [ -z $commands[pigz] ] && tar zxvf "$1" || pigz -dc "$1" | tar xv ;; - (*.tar.bz2|*.tbz|*.tbz2) tar xvjf "$1" ;; - (*.tar.xz|*.txz) tar --xz --help &> /dev/null \ - && tar --xz -xvf "$1" \ - || xzcat "$1" | tar xvf - ;; - (*.tar.zma|*.tlz) tar --lzma --help &> /dev/null \ - && tar --lzma -xvf "$1" \ - || lzcat "$1" | tar xvf - ;; - (*.tar) tar xvf "$1" ;; - (*.gz) [ -z $commands[pigz] ] && gunzip "$1" || pigz -d "$1" ;; - (*.bz2) bunzip2 "$1" ;; - (*.xz) unxz "$1" ;; - (*.lzma) unlzma "$1" ;; - (*.Z) uncompress "$1" ;; - (*.zip|*.war|*.jar|*.sublime-package|*.ipsw|*.xpi|*.apk) unzip "$1" -d $extract_dir ;; - (*.rar) unrar x -ad "$1" ;; - (*.7z) 7za x "$1" ;; - (*.deb) - mkdir -p "$extract_dir/control" - mkdir -p "$extract_dir/data" - cd "$extract_dir"; ar vx "../${1}" > /dev/null - cd control; tar xzvf ../control.tar.gz - cd ../data; tar xzvf ../data.tar.gz - cd ..; rm *.tar.gz debian-binary - cd .. - ;; - (*) - echo "extract: '$1' cannot be extracted" 1>&2 - success=1 - ;; - esac - - (( success = $success > 0 ? $success : $? )) - (( $success == 0 )) && (( $remove_archive == 0 )) && rm "$1" - shift - done -} - alias x=extract +extract() { + local remove_archive + local success + local file_name + local extract_dir + + if (( $# == 0 )); then + cat <<-'EOF' >&2 + Usage: extract [-option] [file ...] + + Options: + -r, --remove Remove archive. + EOF + fi + + remove_archive=1 + if [[ "$1" == "-r" ]] || [[ "$1" == "--remove" ]]; then + remove_archive=0 + shift + fi + + while (( $# > 0 )); do + if [[ ! -f "$1" ]]; then + echo "extract: '$1' is not a valid file" >&2 + shift + continue + fi + + success=0 + file_name="$( basename "$1" )" + extract_dir="$( echo "$file_name" | sed "s/\.${1##*.}//g" )" + case "$1" in + (*.tar.gz|*.tgz) (( $+commands[pigz] )) && { pigz -dc "$1" | tar xv } || tar zxvf "$1" ;; + (*.tar.bz2|*.tbz|*.tbz2) tar xvjf "$1" ;; + (*.tar.xz|*.txz) + tar --xz --help &> /dev/null \ + && tar --xz -xvf "$1" \ + || xzcat "$1" | tar xvf - ;; + (*.tar.zma|*.tlz) + tar --lzma --help &> /dev/null \ + && tar --lzma -xvf "$1" \ + || lzcat "$1" | tar xvf - ;; + (*.tar) tar xvf "$1" ;; + (*.gz) (( $+commands[pigz] )) && pigz -d "$1" || gunzip "$1" ;; + (*.bz2) bunzip2 "$1" ;; + (*.xz) unxz "$1" ;; + (*.lzma) unlzma "$1" ;; + (*.Z) uncompress "$1" ;; + (*.zip|*.war|*.jar|*.sublime-package|*.ipsw|*.xpi|*.apk) unzip "$1" -d $extract_dir ;; + (*.rar) unrar x -ad "$1" ;; + (*.7z) 7za x "$1" ;; + (*.deb) + mkdir -p "$extract_dir/control" + mkdir -p "$extract_dir/data" + cd "$extract_dir"; ar vx "../${1}" > /dev/null + cd control; tar xzvf ../control.tar.gz + cd ../data; tar xzvf ../data.tar.gz + cd ..; rm *.tar.gz debian-binary + cd .. + ;; + (*) + echo "extract: '$1' cannot be extracted" >&2 + success=1 + ;; + esac + + (( success = $success > 0 ? $success : $? )) + (( $success == 0 )) && (( $remove_archive == 0 )) && rm "$1" + shift + done +} From f12cb5a697ca45b3ef8acda24cef72fe041addb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Thu, 29 Sep 2016 13:20:26 +0200 Subject: [PATCH 0033/1083] extract: fix extraction of deb packages with data.tar.xz --- plugins/extract/extract.plugin.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/extract/extract.plugin.zsh b/plugins/extract/extract.plugin.zsh index 081d5168f..24b16517b 100644 --- a/plugins/extract/extract.plugin.zsh +++ b/plugins/extract/extract.plugin.zsh @@ -56,8 +56,8 @@ extract() { mkdir -p "$extract_dir/data" cd "$extract_dir"; ar vx "../${1}" > /dev/null cd control; tar xzvf ../control.tar.gz - cd ../data; tar xzvf ../data.tar.gz - cd ..; rm *.tar.gz debian-binary + cd ../data; extract ../data.tar.* + cd ..; rm *.tar.* debian-binary cd .. ;; (*) From 68425c266a5107e50a2897b7d7cfc0ccb9fb753c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Thu, 29 Sep 2016 13:26:50 +0200 Subject: [PATCH 0034/1083] extract: replace basename&sed w/ zsh variable expansion syntax `${var:t:h}` uses: - `${var:t}` which acts as `basename`. - `${var:r}` which removes the extension. See http://zsh.sourceforge.net/Doc/Release/Expansion.html#Modifiers --- plugins/extract/extract.plugin.zsh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/plugins/extract/extract.plugin.zsh b/plugins/extract/extract.plugin.zsh index 24b16517b..c524bf8f5 100644 --- a/plugins/extract/extract.plugin.zsh +++ b/plugins/extract/extract.plugin.zsh @@ -3,7 +3,6 @@ alias x=extract extract() { local remove_archive local success - local file_name local extract_dir if (( $# == 0 )); then @@ -29,8 +28,7 @@ extract() { fi success=0 - file_name="$( basename "$1" )" - extract_dir="$( echo "$file_name" | sed "s/\.${1##*.}//g" )" + extract_dir="${1:t:r}" case "$1" in (*.tar.gz|*.tgz) (( $+commands[pigz] )) && { pigz -dc "$1" | tar xv } || tar zxvf "$1" ;; (*.tar.bz2|*.tbz|*.tbz2) tar xvjf "$1" ;; From b5dc976d236e8f8d276aa0aeff49980bfccb0532 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Thu, 29 Sep 2016 13:38:01 +0200 Subject: [PATCH 0035/1083] extract: add file extensions to extract completion --- plugins/extract/_extract | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/extract/_extract b/plugins/extract/_extract index a73c892d9..172425d2c 100644 --- a/plugins/extract/_extract +++ b/plugins/extract/_extract @@ -3,4 +3,5 @@ _arguments \ '(-r --remove)'{-r,--remove}'[Remove archive.]' \ - "*::archive file:_files -g '(#i)*.(tar|tgz|tbz|tbz2|txz|tlz|gz|bz2|xz|lzma|Z|zip|ipsw|rar|7z|deb)(-.)'" && return 0 + "*::archive file:_files -g '(#i)*.(7z|Z|apk|bz2|deb|gz|ipsw|jar|lzma|rar|sublime-package|tar|tar.bz2|tar.gz|tar.xz|tar.zma|tbz|tbz2|tgz|tlz|txz|war|xpi|xz|zip)(-.)'" \ + && return 0 From bac896fca7b1af1e4237e96c58a0c13b8ff2d0de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Fri, 30 Sep 2016 00:37:14 +0200 Subject: [PATCH 0036/1083] extract: add README --- plugins/extract/README.md | 46 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 plugins/extract/README.md diff --git a/plugins/extract/README.md b/plugins/extract/README.md new file mode 100644 index 000000000..c6bdd36dd --- /dev/null +++ b/plugins/extract/README.md @@ -0,0 +1,46 @@ +# extract plugin + +This plugin defines a function called `extract` that extracts the archive file +you pass it, and it supports a wide variety of archive filetypes. + +This way you don't have to know what specific command extracts a file, you just +do `extract ` and the function takes care of the rest. + +To use it, add `extract` to the plugins array in your zshrc file: + +```zsh +plugins=(... extract) +``` + +## Supported file extensions + +| Extension | Description | +|:------------------|:-------------------------------------| +| `7z` | 7zip file | +| `Z` | Z archive (LZW) | +| `apk` | Android app file | +| `bz2` | Bzip2 file | +| `deb` | Debian package | +| `gz` | Gzip file | +| `ipsw` | iOS firmware file | +| `jar` | Java Archive | +| `lzma` | LZMA archive | +| `rar` | WinRAR archive | +| `sublime-package` | Sublime Text package | +| `tar` | Tarball | +| `tar.bz2` | Tarball with bzip2 compression | +| `tar.gz` | Tarball with gzip compression | +| `tar.xz` | Tarball with lzma2 compression | +| `tar.zma` | Tarball with lzma 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 | +| `war` | Web Application archive (Java-based) | +| `xpi` | Mozilla XPI module file | +| `xz` | LZMA2 archive | +| `zip` | Zip archive | + +See [list of archive formats](https://en.wikipedia.org/wiki/List_of_archive_formats) for +more information regarding archive formats. From c713407f90e7024507c7fc621440cb171108e7f4 Mon Sep 17 00:00:00 2001 From: Allan Lewis Date: Fri, 30 Sep 2016 12:45:28 +0100 Subject: [PATCH 0037/1083] git.plugin.zsh: Don't run Git hooks when making a WIP commit (#4751) When making a WIP commit, we generally just want to save the state of the current branch temporarily, maybe because we want to push our work for backup purposes, or change branch to work on something else. Therefore, it's generally undesirable to run Git hooks, which might do things like run linters, because we probably don't care if our WIP has lint errors. --- plugins/git/git.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 25da03509..ea9ff8269 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -236,4 +236,4 @@ alias gupv='git pull --rebase -v' alias glum='git pull upstream master' alias gwch='git whatchanged -p --abbrev-commit --pretty=medium' -alias gwip='git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit -m "--wip--"' +alias gwip='git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit --no-verify -m "--wip--"' From 3de0235ad26d4584727f4cce17c09f1b4ae6cee5 Mon Sep 17 00:00:00 2001 From: Manuel Hutter Date: Fri, 30 Sep 2016 19:54:27 +0200 Subject: [PATCH 0038/1083] Add missing newline to end of `spotify status` output (#5480) --- plugins/osx/osx.plugin.zsh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/osx/osx.plugin.zsh b/plugins/osx/osx.plugin.zsh index aa6a256c1..d7baa1191 100644 --- a/plugins/osx/osx.plugin.zsh +++ b/plugins/osx/osx.plugin.zsh @@ -314,7 +314,7 @@ function spotify() { position=$(osascript -e 'tell application "Spotify" to player position as string' | tr ',' '.'); position=$(echo "scale=2; $position / 60" | bc | awk '{printf "%0.2f", $0}'); - printf "$reset""Artist: %s\nAlbum: %s\nTrack: %s \nPosition: %s / %s" "$artist" "$album" "$track" "$position" "$duration"; + printf "$reset""Artist: %s\nAlbum: %s\nTrack: %s \nPosition: %s / %s\n" "$artist" "$album" "$track" "$position" "$duration"; fi } @@ -412,17 +412,17 @@ function spotify() { osascript -e 'tell application "Spotify" to playpause'; break ;; - "quit" ) + "quit" ) cecho "Quitting Spotify."; osascript -e 'tell application "Spotify" to quit'; exit 1 ;; - "next" ) + "next" ) cecho "Going to next track." ; osascript -e 'tell application "Spotify" to next track'; break ;; - "prev" ) + "prev" ) cecho "Going to previous track."; osascript -e 'tell application "Spotify" to previous track'; break ;; From 8ea56633a40411d1b43127b9cd88e8851edaf922 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Wed, 28 Sep 2016 18:23:15 +0200 Subject: [PATCH 0039/1083] last-working-dir: clean up source --- .../last-working-dir.plugin.zsh | 25 ++++++++----------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/plugins/last-working-dir/last-working-dir.plugin.zsh b/plugins/last-working-dir/last-working-dir.plugin.zsh index c458464ce..c5278d640 100644 --- a/plugins/last-working-dir/last-working-dir.plugin.zsh +++ b/plugins/last-working-dir/last-working-dir.plugin.zsh @@ -1,26 +1,21 @@ -#!/usr/bin/env zsh -# Keeps track of the last used working directory and automatically jumps -# into it for new shells. - -# Flag indicating if we've previously jumped to last directory. +# Flag indicating if we've previously jumped to last directory typeset -g ZSH_LAST_WORKING_DIRECTORY -mkdir -p $ZSH_CACHE_DIR -cache_file="$ZSH_CACHE_DIR/last-working-dir" -# Updates the last directory once directory is changed. +# Updates the last directory once directory is changed chpwd_functions+=(chpwd_last_working_dir) -function chpwd_last_working_dir() { - # Use >| in case noclobber is set to avoid "file exists" error +chpwd_last_working_dir() { + local cache_file="$ZSH_CACHE_DIR/last-working-dir" pwd >| "$cache_file" } -# Changes directory to the last working directory. -function lwd() { - [[ ! -r "$cache_file" ]] || cd "`cat "$cache_file"`" +# Changes directory to the last working directory +lwd() { + local cache_file="$ZSH_CACHE_DIR/last-working-dir" + [[ -r "$cache_file" ]] && cd "$(cat "$cache_file")" } -# Automatically jump to last working directory unless this isn't the first time -# this plugin has been loaded. +# Automatically jump to last working directory unless this +# isn't the first time this plugin has been loaded. if [[ -z "$ZSH_LAST_WORKING_DIRECTORY" ]]; then lwd 2>/dev/null && ZSH_LAST_WORKING_DIRECTORY=1 || true fi From fb6738a7e1d476ec9a74b0e8a04f5252f9de91fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Wed, 28 Sep 2016 18:30:46 +0200 Subject: [PATCH 0040/1083] last-working-dir: don't jump if not in $HOME --- plugins/last-working-dir/last-working-dir.plugin.zsh | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/plugins/last-working-dir/last-working-dir.plugin.zsh b/plugins/last-working-dir/last-working-dir.plugin.zsh index c5278d640..e882b288f 100644 --- a/plugins/last-working-dir/last-working-dir.plugin.zsh +++ b/plugins/last-working-dir/last-working-dir.plugin.zsh @@ -14,8 +14,10 @@ lwd() { [[ -r "$cache_file" ]] && cd "$(cat "$cache_file")" } -# Automatically jump to last working directory unless this -# isn't the first time this plugin has been loaded. -if [[ -z "$ZSH_LAST_WORKING_DIRECTORY" ]]; then - lwd 2>/dev/null && ZSH_LAST_WORKING_DIRECTORY=1 || true -fi +# Jump to last directory automatically unless: +# - this isn't the first time the plugin is loaded +# - it's not in $HOME directory +[[ -n "$ZSH_LAST_WORKING_DIRECTORY" ]] && return +[[ "$PWD" != "$HOME" ]] && return + +lwd 2>/dev/null && ZSH_LAST_WORKING_DIRECTORY=1 || true From c488ab15f3293c3870f66fe84fc7ee71a182f214 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Wed, 28 Sep 2016 18:23:28 +0200 Subject: [PATCH 0041/1083] last-working-dir: add README --- plugins/last-working-dir/README.md | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 plugins/last-working-dir/README.md diff --git a/plugins/last-working-dir/README.md b/plugins/last-working-dir/README.md new file mode 100644 index 000000000..4cc4acab6 --- /dev/null +++ b/plugins/last-working-dir/README.md @@ -0,0 +1,9 @@ +# last-working-dir plugin + +Keeps track of the last used working directory and automatically jumps into it +for new shells, unless: + +- The plugin is already loaded. +- The current `$PWD` is not `$HOME`. + +Adds `lwd` function to jump to the last working directory. From 06d52a60389a85107ed8cc2e302a1e66f719f738 Mon Sep 17 00:00:00 2001 From: FireWave Date: Fri, 30 Sep 2016 14:12:03 -0400 Subject: [PATCH 0042/1083] Change confusing 12h-time without AM/PM to system-localized time --- themes/xiong-chiamiov-plus.zsh-theme | 2 +- themes/xiong-chiamiov.zsh-theme | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/themes/xiong-chiamiov-plus.zsh-theme b/themes/xiong-chiamiov-plus.zsh-theme index 095dae290..26cc38487 100644 --- a/themes/xiong-chiamiov-plus.zsh-theme +++ b/themes/xiong-chiamiov-plus.zsh-theme @@ -1,6 +1,6 @@ # user, host, full path, and time/date # on two lines for easier vgrepping # entry in a nice long thread on the Arch Linux forums: http://bbs.archlinux.org/viewtopic.php?pid=521888#p521888 -PROMPT=$'%{\e[0;34m%}%B┌─[%b%{\e[0m%}%{\e[1;32m%}%n%{\e[1;30m%}@%{\e[0m%}%{\e[0;36m%}%m%{\e[0;34m%}%B]%b%{\e[0m%} - %b%{\e[0;34m%}%B[%b%{\e[1;37m%}%~%{\e[0;34m%}%B]%b%{\e[0m%} - %{\e[0;34m%}%B[%b%{\e[0;33m%}'%D{"%a %b %d, %I:%M"}%b$'%{\e[0;34m%}%B]%b%{\e[0m%} +PROMPT=$'%{\e[0;34m%}%B┌─[%b%{\e[0m%}%{\e[1;32m%}%n%{\e[1;30m%}@%{\e[0m%}%{\e[0;36m%}%m%{\e[0;34m%}%B]%b%{\e[0m%} - %b%{\e[0;34m%}%B[%b%{\e[1;37m%}%~%{\e[0;34m%}%B]%b%{\e[0m%} - %{\e[0;34m%}%B[%b%{\e[0;33m%}'%D{"%c"}%b$'%{\e[0;34m%}%B]%b%{\e[0m%} %{\e[0;34m%}%B└─%B[%{\e[1;35m%}$%{\e[0;34m%}%B] <$(git_prompt_info)>%{\e[0m%}%b ' PS2=$' \e[0;34m%}%B>%{\e[0m%}%b ' diff --git a/themes/xiong-chiamiov.zsh-theme b/themes/xiong-chiamiov.zsh-theme index 7c4c2e4f8..9cf17f47c 100644 --- a/themes/xiong-chiamiov.zsh-theme +++ b/themes/xiong-chiamiov.zsh-theme @@ -1,6 +1,6 @@ # user, host, full path, and time/date # on two lines for easier vgrepping # entry in a nice long thread on the Arch Linux forums: http://bbs.archlinux.org/viewtopic.php?pid=521888#p521888 -PROMPT=$'%{\e[0;34m%}%B┌─[%b%{\e[0m%}%{\e[1;32m%}%n%{\e[1;30m%}@%{\e[0m%}%{\e[0;36m%}%m%{\e[0;34m%}%B]%b%{\e[0m%} - %b%{\e[0;34m%}%B[%b%{\e[1;37m%}%~%{\e[0;34m%}%B]%b%{\e[0m%} - %{\e[0;34m%}%B[%b%{\e[0;33m%}'%D{"%a %b %d, %I:%M"}%b$'%{\e[0;34m%}%B]%b%{\e[0m%} +PROMPT=$'%{\e[0;34m%}%B┌─[%b%{\e[0m%}%{\e[1;32m%}%n%{\e[1;30m%}@%{\e[0m%}%{\e[0;36m%}%m%{\e[0;34m%}%B]%b%{\e[0m%} - %b%{\e[0;34m%}%B[%b%{\e[1;37m%}%~%{\e[0;34m%}%B]%b%{\e[0m%} - %{\e[0;34m%}%B[%b%{\e[0;33m%}'%D{"%c"}%b$'%{\e[0;34m%}%B]%b%{\e[0m%} %{\e[0;34m%}%B└─%B[%{\e[1;35m%}$%{\e[0;34m%}%B]>%{\e[0m%}%b ' PS2=$' \e[0;34m%}%B>%{\e[0m%}%b ' From 9263e9ca59a65cad53d1cf0581c2af344984c2af Mon Sep 17 00:00:00 2001 From: Adrian Petrescu Date: Fri, 30 Sep 2016 17:39:32 -0400 Subject: [PATCH 0043/1083] Add /usr/local/bin to autoenv search path (#5481) The current list of directories to search for autoenv on misses the default location on Ubuntu systems if you just do a normal `pip install autoenv` - [it will place](https://github.com/kennethreitz/autoenv/blob/master/setup.py#L16) `activate.sh` in `/usr/local/bin` unless you manually override the `--prefix` or something. The `/usr/local/opt/autoenv` is fine for macOS/homebrew installations but it would be nice not to have to manually patch on Linux :) --- plugins/autoenv/autoenv.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/autoenv/autoenv.plugin.zsh b/plugins/autoenv/autoenv.plugin.zsh index ea2e56dd6..af58ee77b 100644 --- a/plugins/autoenv/autoenv.plugin.zsh +++ b/plugins/autoenv/autoenv.plugin.zsh @@ -1,7 +1,7 @@ # Activates autoenv or reports its failure () { if ! type autoenv_init >/dev/null; then - for d (~/.autoenv /usr/local/opt/autoenv); do + for d (~/.autoenv /usr/local/opt/autoenv /usr/local/bin); do if [[ -e $d/activate.sh ]]; then autoenv_dir=$d break From d186bc30d071559a36bb190a3c3b329b882ec183 Mon Sep 17 00:00:00 2001 From: Florian Wilhelm Date: Sun, 2 Oct 2016 16:34:54 +0200 Subject: [PATCH 0044/1083] Add aliases for docker-compose logs (#5475) --- plugins/docker-compose/docker-compose.plugin.zsh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/docker-compose/docker-compose.plugin.zsh b/plugins/docker-compose/docker-compose.plugin.zsh index 9f2457fc4..7e3307017 100644 --- a/plugins/docker-compose/docker-compose.plugin.zsh +++ b/plugins/docker-compose/docker-compose.plugin.zsh @@ -18,3 +18,5 @@ alias dcrm='docker-compose rm' alias dcr='docker-compose run' alias dcstop='docker-compose stop' alias dcup='docker-compose up' +alias dcl='docker-compose logs' +alias dclf='docker-compose logs -f' From eaf18167bbf3ee30157728ec50850db73ada3455 Mon Sep 17 00:00:00 2001 From: Juraj Fiala Date: Tue, 18 Aug 2015 21:37:09 +0200 Subject: [PATCH 0045/1083] Added pacaur aliases MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit removes most of its contents: it just leaves the contribution signature. The rest is obsolete and superseeded by #5460, but the contribution is still valuable. Related: #4263. Signed-off-by: Marc Cornellà --- plugins/archlinux/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/archlinux/README.md b/plugins/archlinux/README.md index 785538a56..f32d91f79 100644 --- a/plugins/archlinux/README.md +++ b/plugins/archlinux/README.md @@ -67,3 +67,4 @@ - Martin Putniorz - mputniorz@gmail.com - MatthR3D - matthr3d@gmail.com - ornicar - thibault.duplessis@gmail.com +- Juraj Fiala - doctorjellyface@riseup.net From 485dd2b73671c257571601dda44e5fd94067271f Mon Sep 17 00:00:00 2001 From: Moses Miller Date: Mon, 26 Sep 2016 23:17:18 -0700 Subject: [PATCH 0046/1083] Add pacaur compatibility to archlinux plugin + refactor --- plugins/archlinux/archlinux.plugin.zsh | 51 +++++++++++++++++++++----- 1 file changed, 42 insertions(+), 9 deletions(-) diff --git a/plugins/archlinux/archlinux.plugin.zsh b/plugins/archlinux/archlinux.plugin.zsh index 1637e8561..2e55d1b8d 100644 --- a/plugins/archlinux/archlinux.plugin.zsh +++ b/plugins/archlinux/archlinux.plugin.zsh @@ -1,12 +1,4 @@ -if ! (( $+commands[yaourt] )); then - upgrade() { - sudo pacman -Syu - } -else - upgrade () { - yaourt -Syu - } - +if (( $+commands[yaourt] )); then alias yaconf='yaourt -C' alias yaupg='yaourt -Syua' alias yasu='yaourt -Syua --noconfirm' @@ -35,6 +27,47 @@ else fi fi +if (( $+commands[pacaur] )); then + alias paupg='pacaur -Syua' + alias pasu='pacaur -Syua --noconfirm' + alias pain='pacaur -S' + alias pains='pacaur -U' + alias pare='pacaur -R' + alias parem='pacaur -Rns' + alias parep='pacaur -Si' + alias pareps='pacaur -Ss' + alias paloc='pacaur -Qi' + alias palocs='pacaur -Qs' + alias palst='pacaur -Qe' + alias paorph='pacaur -Qtd' + alias painsd='pacaur -S --asdeps' + alias pamir='pacaur -Syy' + + if (( $+commands[abs] && $+commands[aur] )); then + alias paupd='pacaur -Sy && sudo abs && sudo aur' + elif (( $+commands[abs] )); then + alias paupd='pacaur -Sy && sudo abs' + elif (( $+commands[aur] )); then + alias paupd='pacaur -Sy && sudo aur' + else + alias paupd='pacaur -Sy' + fi +fi + +if (( $+commands[pacaur] )); then + upgrade() { + pacaur -Syu + } +elif (( $+commands[yaourt] )); then + upgrade() { + yaourt -Syu + } +else + upgrade() { + pacman -Syu + } +fi + # Pacman - https://wiki.archlinux.org/index.php/Pacman_Tips alias pacupg='sudo pacman -Syu' alias pacin='sudo pacman -S' From e418a2bb92f6b26773d9e55115803a7137c90eec Mon Sep 17 00:00:00 2001 From: Moses Miller Date: Sun, 2 Oct 2016 14:28:39 -0700 Subject: [PATCH 0047/1083] Updated README of the archlinux plugin --- plugins/archlinux/README.md | 25 +++++++++++++++++++++++++ plugins/archlinux/archlinux.plugin.zsh | 2 +- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/plugins/archlinux/README.md b/plugins/archlinux/README.md index f32d91f79..73a5037b0 100644 --- a/plugins/archlinux/README.md +++ b/plugins/archlinux/README.md @@ -27,6 +27,30 @@ | yasu | yaourt -Syua --no-confirm | Same as `yaupg`, but without confirmation | | upgrade | yaourt -Syu | Sync with repositories before upgrading packages | +### PACAUR + +| Alias | Command | Description | +|---------|------------------------------------|---------------------------------------------------------------------| +| pain | pacaur -S | Install packages from the repositories | +| pains | pacaur -U | Install a package from a local file | +| painsd | pacaur -S --asdeps | Install packages as dependencies of another package | +| paloc | pacaur -Qi | Display information about a package in the local database | +| palocs | pacaur -Qs | Search for packages in the local database | +| palst | pacaur -Qe | List installed packages including from AUR (tagged as "local") | +| pamir | pacaur -Syy | Force refresh of all package lists after updating mirrorlist | +| paorph | pacaur -Qtd | Remove orphans using pacaur | +| pare | pacaur -R | Remove packages, keeping its settings and dependencies | +| parem | pacaur -Rns | Remove packages, including its settings and unneeded dependencies | +| parep | pacaur -Si | Display information about a package in the repositories | +| pareps | pacaur -Ss | Search for packages in the repositories | +| paupd | pacaur -Sy && sudo abs && sudo aur | Update and refresh local package, ABS and AUR databases | +| paupd | pacaur -Sy && sudo abs | Update and refresh the local package and ABS databases | +| paupd | pacaur -Sy && sudo aur | Update and refresh the local package and AUR databases | +| paupd | pacaur -Sy | Update and refresh the local package database | +| paupg | pacaur -Syua | Sync with repositories before upgrading all packages (from AUR too) | +| pasu | pacaur -Syua --no-confirm | Same as `paupg`, but without confirmation | +| upgrade | pacaur -Syu + #### PACMAN | Alias | Command | Description | @@ -68,3 +92,4 @@ - MatthR3D - matthr3d@gmail.com - ornicar - thibault.duplessis@gmail.com - Juraj Fiala - doctorjellyface@riseup.net +- Majora320 (Moses Miller) - Majora320@gmail.com diff --git a/plugins/archlinux/archlinux.plugin.zsh b/plugins/archlinux/archlinux.plugin.zsh index 2e55d1b8d..3156e949a 100644 --- a/plugins/archlinux/archlinux.plugin.zsh +++ b/plugins/archlinux/archlinux.plugin.zsh @@ -64,7 +64,7 @@ elif (( $+commands[yaourt] )); then } else upgrade() { - pacman -Syu + sudo pacman -Syu } fi From cd44246415d557bc9ba8d7c74acdcc0a44d10e34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Mon, 3 Oct 2016 01:04:16 +0200 Subject: [PATCH 0048/1083] Fix small copy-editing mistake in archlinux README --- plugins/archlinux/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/archlinux/README.md b/plugins/archlinux/README.md index 73a5037b0..16f099415 100644 --- a/plugins/archlinux/README.md +++ b/plugins/archlinux/README.md @@ -49,7 +49,7 @@ | paupd | pacaur -Sy | Update and refresh the local package database | | paupg | pacaur -Syua | Sync with repositories before upgrading all packages (from AUR too) | | pasu | pacaur -Syua --no-confirm | Same as `paupg`, but without confirmation | -| upgrade | pacaur -Syu +| upgrade | pacaur -Syu | Sync with repositories before upgrading packages | #### PACMAN From 6d975f72589dbb6e44084841cddf9ea153990eb8 Mon Sep 17 00:00:00 2001 From: savimat Date: Mon, 3 Oct 2016 09:11:26 +1000 Subject: [PATCH 0049/1083] Add alias for signed git commit with message (#5390) Signed-off-by: Mat Munn --- 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 ea9ff8269..28fb253dd 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -65,6 +65,7 @@ alias gca!='git commit -v -a --amend' alias gcan!='git commit -v -a --no-edit --amend' alias gcans!='git commit -v -a -s --no-edit --amend' alias gcam='git commit -a -m' +alias gcsm='git commit -s -m' alias gcb='git checkout -b' alias gcf='git config --list' alias gcl='git clone --recursive' From 40bfe5a4124be7b5983756cc81b54a4a4d5846e6 Mon Sep 17 00:00:00 2001 From: Fabian Wolff Date: Mon, 26 Sep 2016 21:41:42 +0200 Subject: [PATCH 0050/1083] Implement a locking mechanism to avoid multiple update prompts (fixes #3766) --- tools/check_for_upgrade.sh | 43 +++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/tools/check_for_upgrade.sh b/tools/check_for_upgrade.sh index bd9aba8be..d1b174c6d 100644 --- a/tools/check_for_upgrade.sh +++ b/tools/check_for_upgrade.sh @@ -29,31 +29,36 @@ fi # Cancel upgrade if git is unavailable on the system whence git >/dev/null || return 0 -if [ -f ~/.zsh-update ] +if mkdir "$ZSH/log/update.lock" 2>/dev/null then - . ~/.zsh-update - - if [[ -z "$LAST_EPOCH" ]]; then - _update_zsh_update && return 0; - fi - - epoch_diff=$(($(_current_epoch) - $LAST_EPOCH)) - if [ $epoch_diff -gt $epoch_target ] + if [ -f ~/.zsh-update ] then - if [ "$DISABLE_UPDATE_PROMPT" = "true" ] + . ~/.zsh-update + + if [[ -z "$LAST_EPOCH" ]]; then + _update_zsh_update && return 0; + fi + + epoch_diff=$(($(_current_epoch) - $LAST_EPOCH)) + if [ $epoch_diff -gt $epoch_target ] then - _upgrade_zsh - else - echo "[Oh My Zsh] Would you like to check for updates? [Y/n]: \c" - read line - if [[ "$line" == Y* ]] || [[ "$line" == y* ]] || [ -z "$line" ]; then + if [ "$DISABLE_UPDATE_PROMPT" = "true" ] + then _upgrade_zsh else - _update_zsh_update + echo "[Oh My Zsh] Would you like to check for updates? [Y/n]: \c" + read line + if [[ "$line" == Y* ]] || [[ "$line" == y* ]] || [ -z "$line" ]; then + _upgrade_zsh + else + _update_zsh_update + fi fi fi + else + # create the zsh file + _update_zsh_update fi -else - # create the zsh file - _update_zsh_update + + rm -r $ZSH/log/update.lock fi From 4fa6be02300ff1bbf3772be0c8f7993a46c3769e Mon Sep 17 00:00:00 2001 From: Fabian Wolff Date: Mon, 3 Oct 2016 11:52:25 +0200 Subject: [PATCH 0051/1083] Use rmdir instead of rm -r --- tools/check_for_upgrade.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/check_for_upgrade.sh b/tools/check_for_upgrade.sh index d1b174c6d..3c9a4e4ca 100644 --- a/tools/check_for_upgrade.sh +++ b/tools/check_for_upgrade.sh @@ -60,5 +60,5 @@ then _update_zsh_update fi - rm -r $ZSH/log/update.lock + rmdir $ZSH/log/update.lock fi From 1f64fa92f524d47a87320a4baf9d9883fd23ab5e Mon Sep 17 00:00:00 2001 From: Fabian Wolff Date: Mon, 3 Oct 2016 11:58:15 +0200 Subject: [PATCH 0052/1083] Convert "if then" statements to "if; then" one-liners --- tools/check_for_upgrade.sh | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/tools/check_for_upgrade.sh b/tools/check_for_upgrade.sh index 3c9a4e4ca..a57f6da0f 100644 --- a/tools/check_for_upgrade.sh +++ b/tools/check_for_upgrade.sh @@ -29,10 +29,8 @@ fi # Cancel upgrade if git is unavailable on the system whence git >/dev/null || return 0 -if mkdir "$ZSH/log/update.lock" 2>/dev/null -then - if [ -f ~/.zsh-update ] - then +if mkdir "$ZSH/log/update.lock" 2>/dev/null; then + if [ -f ~/.zsh-update ]; then . ~/.zsh-update if [[ -z "$LAST_EPOCH" ]]; then @@ -40,10 +38,8 @@ then fi epoch_diff=$(($(_current_epoch) - $LAST_EPOCH)) - if [ $epoch_diff -gt $epoch_target ] - then - if [ "$DISABLE_UPDATE_PROMPT" = "true" ] - then + if [ $epoch_diff -gt $epoch_target ]; then + if [ "$DISABLE_UPDATE_PROMPT" = "true" ]; then _upgrade_zsh else echo "[Oh My Zsh] Would you like to check for updates? [Y/n]: \c" From 0887a7eb504debd8714bb914b99a2d6343f6b131 Mon Sep 17 00:00:00 2001 From: Henrik Johansson Date: Fri, 8 Aug 2014 14:09:07 +0200 Subject: [PATCH 0053/1083] Added simple support for Cargo - the Rust build system --- plugins/cargo/cargo.plugin.zsh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 plugins/cargo/cargo.plugin.zsh diff --git a/plugins/cargo/cargo.plugin.zsh b/plugins/cargo/cargo.plugin.zsh new file mode 100644 index 000000000..e1dc953dd --- /dev/null +++ b/plugins/cargo/cargo.plugin.zsh @@ -0,0 +1,22 @@ +function _cargo_commands() { + local ret=1 state + _arguments ':subcommand:->subcommand' && ret=0 + + case $state in + subcommand) + subcommands=( + "build:Build the current project" + "clean:Clean up after a build" + "help:Help about available commands" + "new:Create a new project" + "test:Run the tests" + "update:Updates list of known packages" + "run:Builds and runs the currecnt project" + ) + _describe -t subcommands 'cargo subcommands' subcommands && ret=0 + esac + + return ret +} + +compdef _cargo_commands cargo From 9d35d3a5d5db6e3b5aa3935bdb3660b607bf599d Mon Sep 17 00:00:00 2001 From: FireWave Date: Mon, 3 Oct 2016 14:58:51 -0400 Subject: [PATCH 0054/1083] Revert "Change confusing 12h-time without AM/PM to system-localized time" This reverts commit 06d52a60389a85107ed8cc2e302a1e66f719f738. --- themes/xiong-chiamiov-plus.zsh-theme | 2 +- themes/xiong-chiamiov.zsh-theme | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/themes/xiong-chiamiov-plus.zsh-theme b/themes/xiong-chiamiov-plus.zsh-theme index 26cc38487..095dae290 100644 --- a/themes/xiong-chiamiov-plus.zsh-theme +++ b/themes/xiong-chiamiov-plus.zsh-theme @@ -1,6 +1,6 @@ # user, host, full path, and time/date # on two lines for easier vgrepping # entry in a nice long thread on the Arch Linux forums: http://bbs.archlinux.org/viewtopic.php?pid=521888#p521888 -PROMPT=$'%{\e[0;34m%}%B┌─[%b%{\e[0m%}%{\e[1;32m%}%n%{\e[1;30m%}@%{\e[0m%}%{\e[0;36m%}%m%{\e[0;34m%}%B]%b%{\e[0m%} - %b%{\e[0;34m%}%B[%b%{\e[1;37m%}%~%{\e[0;34m%}%B]%b%{\e[0m%} - %{\e[0;34m%}%B[%b%{\e[0;33m%}'%D{"%c"}%b$'%{\e[0;34m%}%B]%b%{\e[0m%} +PROMPT=$'%{\e[0;34m%}%B┌─[%b%{\e[0m%}%{\e[1;32m%}%n%{\e[1;30m%}@%{\e[0m%}%{\e[0;36m%}%m%{\e[0;34m%}%B]%b%{\e[0m%} - %b%{\e[0;34m%}%B[%b%{\e[1;37m%}%~%{\e[0;34m%}%B]%b%{\e[0m%} - %{\e[0;34m%}%B[%b%{\e[0;33m%}'%D{"%a %b %d, %I:%M"}%b$'%{\e[0;34m%}%B]%b%{\e[0m%} %{\e[0;34m%}%B└─%B[%{\e[1;35m%}$%{\e[0;34m%}%B] <$(git_prompt_info)>%{\e[0m%}%b ' PS2=$' \e[0;34m%}%B>%{\e[0m%}%b ' diff --git a/themes/xiong-chiamiov.zsh-theme b/themes/xiong-chiamiov.zsh-theme index 9cf17f47c..7c4c2e4f8 100644 --- a/themes/xiong-chiamiov.zsh-theme +++ b/themes/xiong-chiamiov.zsh-theme @@ -1,6 +1,6 @@ # user, host, full path, and time/date # on two lines for easier vgrepping # entry in a nice long thread on the Arch Linux forums: http://bbs.archlinux.org/viewtopic.php?pid=521888#p521888 -PROMPT=$'%{\e[0;34m%}%B┌─[%b%{\e[0m%}%{\e[1;32m%}%n%{\e[1;30m%}@%{\e[0m%}%{\e[0;36m%}%m%{\e[0;34m%}%B]%b%{\e[0m%} - %b%{\e[0;34m%}%B[%b%{\e[1;37m%}%~%{\e[0;34m%}%B]%b%{\e[0m%} - %{\e[0;34m%}%B[%b%{\e[0;33m%}'%D{"%c"}%b$'%{\e[0;34m%}%B]%b%{\e[0m%} +PROMPT=$'%{\e[0;34m%}%B┌─[%b%{\e[0m%}%{\e[1;32m%}%n%{\e[1;30m%}@%{\e[0m%}%{\e[0;36m%}%m%{\e[0;34m%}%B]%b%{\e[0m%} - %b%{\e[0;34m%}%B[%b%{\e[1;37m%}%~%{\e[0;34m%}%B]%b%{\e[0m%} - %{\e[0;34m%}%B[%b%{\e[0;33m%}'%D{"%a %b %d, %I:%M"}%b$'%{\e[0;34m%}%B]%b%{\e[0m%} %{\e[0;34m%}%B└─%B[%{\e[1;35m%}$%{\e[0;34m%}%B]>%{\e[0m%}%b ' PS2=$' \e[0;34m%}%B>%{\e[0m%}%b ' From fe605e142fdaaec6282764c8fe88af27241338f3 Mon Sep 17 00:00:00 2001 From: FireWave Date: Mon, 3 Oct 2016 15:00:39 -0400 Subject: [PATCH 0055/1083] Change confusing 12h without AM/PM to a clean 24h display. It was not possible to simply add AM/PM since strftime return blank for %p %P --- themes/xiong-chiamiov-plus.zsh-theme | 2 +- themes/xiong-chiamiov.zsh-theme | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/themes/xiong-chiamiov-plus.zsh-theme b/themes/xiong-chiamiov-plus.zsh-theme index 095dae290..5fb4fe6f4 100644 --- a/themes/xiong-chiamiov-plus.zsh-theme +++ b/themes/xiong-chiamiov-plus.zsh-theme @@ -1,6 +1,6 @@ # user, host, full path, and time/date # on two lines for easier vgrepping # entry in a nice long thread on the Arch Linux forums: http://bbs.archlinux.org/viewtopic.php?pid=521888#p521888 -PROMPT=$'%{\e[0;34m%}%B┌─[%b%{\e[0m%}%{\e[1;32m%}%n%{\e[1;30m%}@%{\e[0m%}%{\e[0;36m%}%m%{\e[0;34m%}%B]%b%{\e[0m%} - %b%{\e[0;34m%}%B[%b%{\e[1;37m%}%~%{\e[0;34m%}%B]%b%{\e[0m%} - %{\e[0;34m%}%B[%b%{\e[0;33m%}'%D{"%a %b %d, %I:%M"}%b$'%{\e[0;34m%}%B]%b%{\e[0m%} +PROMPT=$'%{\e[0;34m%}%B┌─[%b%{\e[0m%}%{\e[1;32m%}%n%{\e[1;30m%}@%{\e[0m%}%{\e[0;36m%}%m%{\e[0;34m%}%B]%b%{\e[0m%} - %b%{\e[0;34m%}%B[%b%{\e[1;37m%}%~%{\e[0;34m%}%B]%b%{\e[0m%} - %{\e[0;34m%}%B[%b%{\e[0;33m%}'%D{"%a %b %d, %H:%M"}%b$'%{\e[0;34m%}%B]%b%{\e[0m%} %{\e[0;34m%}%B└─%B[%{\e[1;35m%}$%{\e[0;34m%}%B] <$(git_prompt_info)>%{\e[0m%}%b ' PS2=$' \e[0;34m%}%B>%{\e[0m%}%b ' diff --git a/themes/xiong-chiamiov.zsh-theme b/themes/xiong-chiamiov.zsh-theme index 7c4c2e4f8..0ed335fb5 100644 --- a/themes/xiong-chiamiov.zsh-theme +++ b/themes/xiong-chiamiov.zsh-theme @@ -1,6 +1,6 @@ # user, host, full path, and time/date # on two lines for easier vgrepping # entry in a nice long thread on the Arch Linux forums: http://bbs.archlinux.org/viewtopic.php?pid=521888#p521888 -PROMPT=$'%{\e[0;34m%}%B┌─[%b%{\e[0m%}%{\e[1;32m%}%n%{\e[1;30m%}@%{\e[0m%}%{\e[0;36m%}%m%{\e[0;34m%}%B]%b%{\e[0m%} - %b%{\e[0;34m%}%B[%b%{\e[1;37m%}%~%{\e[0;34m%}%B]%b%{\e[0m%} - %{\e[0;34m%}%B[%b%{\e[0;33m%}'%D{"%a %b %d, %I:%M"}%b$'%{\e[0;34m%}%B]%b%{\e[0m%} +PROMPT=$'%{\e[0;34m%}%B┌─[%b%{\e[0m%}%{\e[1;32m%}%n%{\e[1;30m%}@%{\e[0m%}%{\e[0;36m%}%m%{\e[0;34m%}%B]%b%{\e[0m%} - %b%{\e[0;34m%}%B[%b%{\e[1;37m%}%~%{\e[0;34m%}%B]%b%{\e[0m%} - %{\e[0;34m%}%B[%b%{\e[0;33m%}'%D{"%a %b %d, %H:%M"}%b$'%{\e[0;34m%}%B]%b%{\e[0m%} %{\e[0;34m%}%B└─%B[%{\e[1;35m%}$%{\e[0;34m%}%B]>%{\e[0m%}%b ' PS2=$' \e[0;34m%}%B>%{\e[0m%}%b ' From 6b7003c3efcabe5ce185d5c2a1a8b708d92dfb82 Mon Sep 17 00:00:00 2001 From: Laurent Commarieu Date: Mon, 26 Sep 2016 15:26:38 +0200 Subject: [PATCH 0056/1083] feat(plugin): add nomad --- plugins/nomad/README.md | 11 +++++++++ plugins/nomad/_nomad | 51 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 plugins/nomad/README.md create mode 100644 plugins/nomad/_nomad diff --git a/plugins/nomad/README.md b/plugins/nomad/README.md new file mode 100644 index 000000000..ff07e917b --- /dev/null +++ b/plugins/nomad/README.md @@ -0,0 +1,11 @@ +## About + +Plugin for Nomad, a tool from Hashicorp for easily deploy applications at any scale. + +### Requirements + + * [Nomad](https://nomadproject.io/) + +### Usage + + * Type `nomad` into your prompt and hit `TAB` to see available completion options diff --git a/plugins/nomad/_nomad b/plugins/nomad/_nomad new file mode 100644 index 000000000..25169f394 --- /dev/null +++ b/plugins/nomad/_nomad @@ -0,0 +1,51 @@ +#compdef nomad + +local -a _nomad_cmds +_nomad_cmds=( + 'agent:Runs a Nomad agent' + 'agent-info:Display status information about the local agent' + 'alloc-status:Display allocation status information and metadata' + 'client-config:View or modify client configuration details' + 'eval-status:Display evaluation status and placement failure reasons' + 'fs:Inspect the contents of an allocation directory' + 'init:Create an example job file' + 'inspect:Inspect a submitted job' + 'logs:Streams the logs of a task.' + 'node-drain:Toggle drain mode on a given node' + 'node-status:Display status information about nodes' + 'plan:Dry-run a job update to determine its effects' + 'run:Run a new job or update an existing' + 'server-force-leave:Force a server into the left state' + 'server-join:Join server nodes together' + 'server-members:Display a list of known servers and their' + 'status:Display status information about jobs' + 'stop:Stop a running job' + 'validate:Checks if a given job specification is valid' + 'version:Prints the Nomad version' +) + + +__allocstatus() { + _arguments \ + '-address=[(addr) The address of the Nomad server. Overrides the NOMAD_ADDR environment variable if set. Default = http://127.0.0.1:4646]' \ + '-region=[(region) The region of the Nomad servers to forward commands to. Overrides the NOMAD_REGION environment variable if set. Defaults to the Agent s local region.]' \ + '-no-color[Disables colored command output.]' \ + '-short[Display short output. Shows only the most recent task event.]' \ + '-stats[Display detailed resource usage statistics.]' \ + '-verbose[Show full information.]' \ + '-json[Output the allocation in its JSON format.]' \ + '-t[Format and display allocation using a Go template.]' +} + +_arguments '*:: :->command' + +if (( CURRENT == 1 )); then + _describe -t commands "nomad command" _nomad_cmds + return +fi + +local -a _command_args +case "$words[1]" in + alloc-status) + __allocstatus ;; +esac From dfd7bf9f4141fe6d2ec9cd067b01ad9920e80a24 Mon Sep 17 00:00:00 2001 From: Laurent Commarieu Date: Mon, 3 Oct 2016 21:11:54 +0200 Subject: [PATCH 0057/1083] feat(nomad): add common commands and new readme --- plugins/nomad/README.md | 16 ++++--- plugins/nomad/_nomad | 104 +++++++++++++++++++++++++++++++++++++++- 2 files changed, 113 insertions(+), 7 deletions(-) diff --git a/plugins/nomad/README.md b/plugins/nomad/README.md index ff07e917b..04b361683 100644 --- a/plugins/nomad/README.md +++ b/plugins/nomad/README.md @@ -1,11 +1,15 @@ -## About +# Nomad -Plugin for Nomad, a tool from Hashicorp for easily deploy applications at any scale. +The `nomad` plugin provides a simple autocompletion for [Nomad](https://nomadproject.io/), a tool from Hashicorp for easily deploy applications at any scale. -### Requirements +## Usage - * [Nomad](https://nomadproject.io/) +1. Enable the `nomad` plugin: -### Usage + ```zsh + plugins=(... nomad) + ``` - * Type `nomad` into your prompt and hit `TAB` to see available completion options +2. Install [Nomad](https://nomadproject.io/) + +3. Type `nomad` into your prompt and hit `TAB` to see available completion options. diff --git a/plugins/nomad/_nomad b/plugins/nomad/_nomad index 25169f394..1c935a02e 100644 --- a/plugins/nomad/_nomad +++ b/plugins/nomad/_nomad @@ -24,7 +24,6 @@ _nomad_cmds=( 'version:Prints the Nomad version' ) - __allocstatus() { _arguments \ '-address=[(addr) The address of the Nomad server. Overrides the NOMAD_ADDR environment variable if set. Default = http://127.0.0.1:4646]' \ @@ -37,6 +36,93 @@ __allocstatus() { '-t[Format and display allocation using a Go template.]' } +__evalstatus() { + _arguments \ + '-address=[(addr) The address of the Nomad server. Overrides the NOMAD_ADDR environment variable if set. Default = http://127.0.0.1:4646]' \ + '-region=[(region) The region of the Nomad servers to forward commands to. Overrides the NOMAD_REGION environment variable if set. Defaults to the Agent s local region.]' \ + '-no-color[Disables colored command output.]' \ + '-monitor[Monitor an outstanding evaluation.]' \ + '-verbose[Show full information.]' \ + '-json[Output the allocation in its JSON format.]' \ + '-t[Format and display allocation using a Go template.]' +} + +__inspect() { + _arguments \ + '-address=[(addr) The address of the Nomad server. Overrides the NOMAD_ADDR environment variable if set. Default = http://127.0.0.1:4646]' \ + '-region=[(region) The region of the Nomad servers to forward commands to. Overrides the NOMAD_REGION environment variable if set. Defaults to the Agent s local region.]' \ + '-no-color[Disables colored command output.]' \ + '-json[Output the allocation in its JSON format.]' \ + '-t[Format and display allocation using a Go template.]' +} + +__logs() { + _arguments \ + '-address=[(addr) The address of the Nomad server. Overrides the NOMAD_ADDR environment variable if set. Default = http://127.0.0.1:4646]' \ + '-region=[(region) The region of the Nomad servers to forward commands to. Overrides the NOMAD_REGION environment variable if set. Defaults to the Agent s local region.]' \ + '-no-color[Disables colored command output.]' \ + '-stderr[ Display stderr logs.]' \ + '-job[ Use a random allocation from the specified job ID.]' \ + '-verbose[Show full information.]' \ + '-f[Causes the output to not stop when the end of the logs are reached, but rather to wait for additional output.]' \ + '-tail[Show the logs contents with offsets relative to the end of the logs. If no offset is given, -n is defaulted to 10.]' \ + '-n[Sets the tail location in best-efforted number of lines relative to the end of the logs.]' \ + '-c[Sets the tail location in number of bytes relative to the end of the logs.]' +} + +__nodestatus() { + _arguments \ + '-address=[(addr) The address of the Nomad server. Overrides the NOMAD_ADDR environment variable if set. Default = http://127.0.0.1:4646]' \ + '-region=[(region) The region of the Nomad servers to forward commands to. Overrides the NOMAD_REGION environment variable if set. Defaults to the Agent s local region.]' \ + '-no-color[Disables colored command output.]' \ + '-self[Query the status of the local node.]' \ + '-allocs[ Display a count of running allocations for each node.]' \ + '-short[Display short output. Shows only the most recent task event.]' \ + '-stats[Display detailed resource usage statistics.]' \ + '-verbose[Show full information.]' \ + '-json[Output the allocation in its JSON format.]' \ + '-t[Format and display allocation using a Go template.]' +} + +__plan() { + _arguments \ + '-address=[(addr) The address of the Nomad server. Overrides the NOMAD_ADDR environment variable if set. Default = http://127.0.0.1:4646]' \ + '-region=[(region) The region of the Nomad servers to forward commands to. Overrides the NOMAD_REGION environment variable if set. Defaults to the Agent s local region.]' \ + '-no-color[Disables colored command output.]' \ + '-diff[Determines whether the diff between the remote job and planned job is shown. Defaults to true.]' +} + +__run() { + _arguments \ + '-address=[(addr) The address of the Nomad server. Overrides the NOMAD_ADDR environment variable if set. Default = http://127.0.0.1:4646]' \ + '-region=[(region) The region of the Nomad servers to forward commands to. Overrides the NOMAD_REGION environment variable if set. Defaults to the Agent s local region.]' \ + '-no-color[Disables colored command output.]' \ + '-check-index[If set, the job is only registered or updated if the the passed job modify index matches the server side version. If a check-index value of zero is passed, the job is only registered if it does not yet exist. If a non-zero value is passed, it ensures that the job is being updated from a known state. The use of this flag is most common in conjunction with plan command.]' \ + '-detach[Return immediately instead of entering monitor mode. After job submission, the evaluation ID will be printed to the screen, which can be used to examine the evaluation using the eval-status command.]' \ + '-output[Output the JSON that would be submitted to the HTTP API without submitting the job.]' \ + '-verbose[Show full information.]' +} + +__status() { + _arguments \ + '-address=[(addr) The address of the Nomad server. Overrides the NOMAD_ADDR environment variable if set. Default = http://127.0.0.1:4646]' \ + '-region=[(region) The region of the Nomad servers to forward commands to. Overrides the NOMAD_REGION environment variable if set. Defaults to the Agent s local region.]' \ + '-no-color[Disables colored command output.]' \ + '-short[Display short output. Shows only the most recent task event.]' \ + '-evals[Display the evaluations associated with the job.]' \ + '-verbose[Show full information.]' +} + +__stop() { + _arguments \ + '-address=[(addr) The address of the Nomad server. Overrides the NOMAD_ADDR environment variable if set. Default = http://127.0.0.1:4646]' \ + '-region=[(region) The region of the Nomad servers to forward commands to. Overrides the NOMAD_REGION environment variable if set. Defaults to the Agent s local region.]' \ + '-no-color[Disables colored command output.]' \ + '-detach[Return immediately instead of entering monitor mode. After the deregister command is submitted, a new evaluation ID is printed to the screen, which can be used to examine the evaluation using the eval-status command.]' \ + '-yes[Automatic yes to prompts.]' \ + '-verbose[Show full information.]' +} + _arguments '*:: :->command' if (( CURRENT == 1 )); then @@ -48,4 +134,20 @@ local -a _command_args case "$words[1]" in alloc-status) __allocstatus ;; + eval-status) + __evalstatus ;; + inspect) + __inspect ;; + logs) + __logs ;; + node-status) + __nodestatus ;; + plan) + __plan ;; + run) + __run ;; + status) + __status ;; + stop) + __stop ;; esac From 915b0e46f275d19e66f8ad7762edc4fcb28967e6 Mon Sep 17 00:00:00 2001 From: Zaki Manian Date: Tue, 14 Jun 2016 10:53:58 +0200 Subject: [PATCH 0058/1083] Add completion for cargo, the rust build tool MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Copy of the official repository: https://github.com/rust-lang/cargo/tree/master/src/etc Signed-off-by: Marc Cornellà --- plugins/cargo/_cargo | 497 +++++++++++++++++++++++++++++++++ plugins/cargo/cargo.plugin.zsh | 22 -- 2 files changed, 497 insertions(+), 22 deletions(-) create mode 100644 plugins/cargo/_cargo delete mode 100644 plugins/cargo/cargo.plugin.zsh diff --git a/plugins/cargo/_cargo b/plugins/cargo/_cargo new file mode 100644 index 000000000..175859202 --- /dev/null +++ b/plugins/cargo/_cargo @@ -0,0 +1,497 @@ +#compdef cargo + +typeset -A opt_args +autoload -U regexp-replace + +_cargo() { + +_arguments \ + '(- 1 *)'{-h,--help}'[show help message]' \ + '(- 1 *)'--list'[list installed commands]' \ + '(- 1 *)'{-v,--verbose}'[use verbose output]' \ + '(- 1 *)'--color'[colorization option]' \ + '(- 1 *)'{-V,--version}'[show version information]' \ + '1: :_cargo_cmds' \ + '*:: :->args' + +case $state in + args) + case $words[1] in + bench) + _arguments \ + '--features=[space separated feature list]' \ + '--all-features[enable all available features]' \ + '(-h, --help)'{-h,--help}'[show help message]' \ + '(-j, --jobs)'{-j,--jobs}'[number of parallel jobs, defaults to # of CPUs]' \ + "${command_scope_spec[@]}" \ + '--manifest-path=[path to manifest]: :_files -/' \ + '--no-default-features[do not build the default features]' \ + '--no-run[compile but do not run]' \ + '(-p,--package)'{-p=,--package=}'[package to run benchmarks for]:packages:_get_package_names' \ + '--target=[target triple]' \ + '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ + '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ + '--color=:colorization option:(auto always never)' \ + ;; + + build) + _arguments \ + '--features=[space separated feature list]' \ + '--all-features[enable all available features]' \ + '(-h, --help)'{-h,--help}'[show help message]' \ + '(-j, --jobs)'{-j,--jobs}'[number of parallel jobs, defaults to # of CPUs]' \ + "${command_scope_spec[@]}" \ + '--manifest-path=[path to manifest]: :_files -/' \ + '--no-default-features[do not build the default features]' \ + '(-p,--package)'{-p=,--package=}'[package to build]:packages:_get_package_names' \ + '--release=[build in release mode]' \ + '--target=[target triple]' \ + '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ + '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ + '--color=:colorization option:(auto always never)' \ + ;; + + clean) + _arguments \ + '(-h, --help)'{-h,--help}'[show help message]' \ + '--manifest-path=[path to manifest]: :_files -/' \ + '(-p,--package)'{-p=,--package=}'[package to clean]:packages:_get_package_names' \ + '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ + '--release[whether or not to clean release artifacts]' \ + '--target=[target triple(default:all)]' \ + '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ + '--color=:colorization option:(auto always never)' \ + ;; + + doc) + _arguments \ + '--features=[space separated feature list]' \ + '--all-features[enable all available features]' \ + '(-h, --help)'{-h,--help}'[show help message]' \ + '(-j, --jobs)'{-j,--jobs}'[number of parallel jobs, defaults to # of CPUs]' \ + '--manifest-path=[path to manifest]: :_files -/' \ + '--no-deps[do not build docs for dependencies]' \ + '--no-default-features[do not build the default features]' \ + '--open[open docs in browser after the build]' \ + '(-p, --package)'{-p,--package}'=[package to document]' \ + '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ + '--release[build artifacts in release mode, with optimizations]' \ + '--target=[build for the target triple]' \ + '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ + '--color=:colorization option:(auto always never)' \ + ;; + + fetch) + _arguments \ + '(-h, --help)'{-h,--help}'[show help message]' \ + '--manifest-path=[path to manifest]: :_files -/' \ + '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ + '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ + '--color=:colorization option:(auto always never)' \ + ;; + + generate-lockfile) + _arguments \ + '(-h, --help)'{-h,--help}'[show help message]' \ + '--manifest-path=[path to manifest]: :_files -/' \ + '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ + '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ + '--color=:colorization option:(auto always never)' \ + ;; + + git-checkout) + _arguments \ + '(-h, --help)'{-h,--help}'[show help message]' \ + 'q(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ + '--reference=[REF]' \ + '--url=[URL]' \ + '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ + '--color=:colorization option:(auto always never)' \ + ;; + + help) + _arguments \ + '(-h, --help)'{-h,--help}'[show help message]' \ + '*: :_cargo_cmds' \ + ;; + + init) + _arguments \ + '--bin[use binary template]' \ + '--vcs:initialize a new repo with a given VCS:(git hg none)' \ + '(-h, --help)'{-h,--help}'[show help message]' \ + '--name=[set the resulting package name]' \ + '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ + '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ + '--color=:colorization option:(auto always never)' \ + ;; + + install) + _arguments \ + '--bin=[only install the specified binary]' \ + '--branch=[branch to use when installing from git]' \ + '--color=:colorization option:(auto always never)' \ + '--debug[build in debug mode instead of release mode]' \ + '--example[install the specified example instead of binaries]' \ + '--features=[space separated feature list]' \ + '--all-features[enable all available features]' \ + '--git=[URL from which to install the crate]' \ + '(-h, --help)'{-h,--help}'[show help message]' \ + '(-j, --jobs)'{-j,--jobs}'[number of parallel jobs, defaults to # of CPUs]' \ + '--no-default-features[do not build the default features]' \ + '--path=[local filesystem path to crate to install]' \ + '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ + '--rev=[specific commit to use when installing from git]' \ + '--root=[directory to install packages into]' \ + '--tag=[tag to use when installing from git]' \ + '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ + '--vers=[version to install from crates.io]' \ + ;; + + locate-project) + _arguments \ + '(-h, --help)'{-h,--help}'[show help message]' \ + '--manifest-path=[path to manifest]: :_files -/' \ + ;; + + login) + _arguments \ + '(-h, --help)'{-h,--help}'[show help message]' \ + '--host=[Host to set the token for]' \ + '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ + '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ + '--color=:colorization option:(auto always never)' \ + ;; + + metadata) + _arguments \ + '(-h, --help)'{-h,--help}'[show help message]' \ + '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ + '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ + "--no-deps[output information only about the root package and don't fetch dependencies]" \ + '--no-default-features[do not include the default feature]' \ + '--manifest-path=[path to manifest]: :_files -/' \ + '--features=[space separated feature list]' \ + '--all-features[enable all available features]' \ + '--format-version=[format version(default: 1)]' \ + '--color=:colorization option:(auto always never)' \ + ;; + + new) + _arguments \ + '--bin[use binary template]' \ + '--vcs:initialize a new repo with a given VCS:(git hg none)' \ + '(-h, --help)'{-h,--help}'[show help message]' \ + '--name=[set the resulting package name]' \ + '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ + '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ + '--color=:colorization option:(auto always never)' \ + ;; + + owner) + _arguments \ + '(-a, --add)'{-a,--add}'[add owner LOGIN]' \ + '(-h, --help)'{-h,--help}'[show help message]' \ + '--index[registry index]' \ + '(-l, --list)'{-l,--list}'[list owners of a crate]' \ + '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ + '(-r, --remove)'{-r,--remove}'[remove owner LOGIN]' \ + '--token[API token to use when authenticating]' \ + '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ + '--color=:colorization option:(auto always never)' \ + ;; + + package) + _arguments \ + '(-h, --help)'{-h,--help}'[show help message]' \ + '(-l, --list)'{-l,--list}'[print files included in a package without making one]' \ + '--manifest-path=[path to manifest]: :_files -/' \ + '--no-metadata[ignore warnings about a lack of human-usable metadata]' \ + '--no-verify[do not build to verify contents]' \ + '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ + '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ + '--color=:colorization option:(auto always never)' \ + ;; + + pkgid) + _arguments \ + '(-h, --help)'{-h,--help}'[show help message]' \ + '--manifest-path=[path to manifest]: :_files -/' \ + '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ + '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ + '--color=:colorization option:(auto always never)' \ + ;; + + publish) + _arguments \ + '(-h, --help)'{-h,--help}'[show help message]' \ + '--host=[Host to set the token for]' \ + '--manifest-path=[path to manifest]: :_files -/' \ + '--no-verify[Do not verify tarball until before publish]' \ + '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ + '--token[token to use when uploading]' \ + '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ + '--color=:colorization option:(auto always never)' \ + ;; + + read-manifest) + _arguments \ + '(-h, --help)'{-h,--help}'[show help message]' \ + '--manifest-path=[path to manifest]: :_files -/' \ + '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ + '--color=:colorization option:(auto always never)' \ + ;; + + run) + _arguments \ + '--example=[name of the bin target]' \ + '--features=[space separated feature list]' \ + '--all-features[enable all available features]' \ + '(-h, --help)'{-h,--help}'[show help message]' \ + '(-j, --jobs)'{-j,--jobs}'[number of parallel jobs, defaults to # of CPUs]' \ + '--manifest-path=[path to manifest]: :_files -/' \ + '--bin=[name of the bin target]' \ + '--no-default-features[do not build the default features]' \ + '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ + '--release=[build in release mode]' \ + '--target=[target triple]' \ + '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ + '--color=:colorization option:(auto always never)' \ + '*: :_normal' \ + ;; + + rustc) + _arguments \ + '--color=:colorization option:(auto always never)' \ + '--features=[features to compile for the package]' \ + '--all-features[enable all available features]' \ + '(-h, --help)'{-h,--help}'[show help message]' \ + '(-j, --jobs)'{-j,--jobs}'=[number of parallel jobs, defaults to # of CPUs]' \ + '--manifest-path=[path to the manifest to fetch dependencies for]' \ + '--no-default-features[do not compile default features for the package]' \ + '(-p, --package)'{-p,--package}'=[profile to compile for]' \ + '--profile=[profile to build the selected target for]' \ + '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ + '--release[build artifacts in release mode, with optimizations]' \ + '--target=[target triple which compiles will be for]' \ + '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ + "${command_scope_spec[@]}" \ + ;; + + rustdoc) + _arguments \ + '--color=:colorization option:(auto always never)' \ + '--features=[space-separated list of features to also build]' \ + '--all-features[enable all available features]' \ + '(-h, --help)'{-h,--help}'[show help message]' \ + '(-j, --jobs)'{-j,--jobs}'=[number of parallel jobs, defaults to # of CPUs]' \ + '--manifest-path=[path to the manifest to document]' \ + '--no-default-features[do not build the `default` feature]' \ + '--open[open the docs in a browser after the operation]' \ + '(-p, --package)'{-p,--package}'=[package to document]' \ + '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ + '--release[build artifacts in release mode, with optimizations]' \ + '--target=[build for the target triple]' \ + '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ + "${command_scope_spec[@]}" \ + ;; + + search) + _arguments \ + '--color=:colorization option:(auto always never)' \ + '(-h, --help)'{-h,--help}'[show help message]' \ + '--host=[host of a registry to search in]' \ + '--limit=[limit the number of results]' \ + '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ + '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ + ;; + + test) + _arguments \ + '--features=[space separated feature list]' \ + '--all-features[enable all available features]' \ + '(-h, --help)'{-h,--help}'[show help message]' \ + '(-j, --jobs)'{-j,--jobs}'[number of parallel jobs, defaults to # of CPUs]' \ + '--manifest-path=[path to manifest]: :_files -/' \ + '--test=[test name]: :_test_names' \ + '--no-default-features[do not build the default features]' \ + '--no-fail-fast[run all tests regardless of failure]' \ + '--no-run[compile but do not run]' \ + '(-p,--package)'{-p=,--package=}'[package to run tests for]:packages:_get_package_names' \ + '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ + '--release[build artifacts in release mode, with optimizations]' \ + '--target=[target triple]' \ + '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ + '--color=:colorization option:(auto always never)' \ + '1: :_test_names' \ + ;; + + uninstall) + _arguments \ + '--bin=[only uninstall the binary NAME]' \ + '--color=:colorization option:(auto always never)' \ + '(-h, --help)'{-h,--help}'[show help message]' \ + '(-q, --quiet)'{-q,--quiet}'[less output printed to stdout]' \ + '--root=[directory to uninstall packages from]' \ + '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ + ;; + + update) + _arguments \ + '--aggressive=[force dependency update]' \ + '(-h, --help)'{-h,--help}'[show help message]' \ + '--manifest-path=[path to manifest]: :_files -/' \ + '(-p,--package)'{-p=,--package=}'[package to update]:packages:__get_package_names' \ + '--precise=[update single dependency to PRECISE]: :' \ + '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ + '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ + '--color=:colorization option:(auto always never)' \ + ;; + + verify-project) + _arguments \ + '(-h, --help)'{-h,--help}'[show help message]' \ + '--manifest-path=[path to manifest]: :_files -/' \ + '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ + '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ + '--color=:colorization option:(auto always never)' \ + ;; + + version) + _arguments \ + '(-h, --help)'{-h,--help}'[show help message]' \ + '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ + '--color=:colorization option:(auto always never)' \ + ;; + + yank) + _arguments \ + '(-h, --help)'{-h,--help}'[show help message]' \ + '--index[registry index]' \ + '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \ + '--token[API token to use when authenticating]' \ + '--undo[undo a yank, putting a version back into the index]' \ + '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \ + '--color=:colorization option:(auto always never)' \ + '--vers[yank version]' \ + ;; + esac + ;; +esac +} + +_cargo_cmds(){ +local -a commands;commands=( +'bench:execute all benchmarks of a local package' +'build:compile the current project' +'clean:remove generated artifacts' +'doc:build package documentation' +'fetch:fetch package dependencies' +'generate-lockfile:create lockfile' +'git-checkout:git checkout' +'help:get help for commands' +'init:create new project in current directory' +'install:install a Rust binary' +'locate-project:print "Cargo.toml" location' +'login:login to remote server' +'metadata:the metadata for a project in json' +'new:create a new project' +'owner:manage the owners of a crate on the registry' +'package:assemble local package into a distributable tarball' +'pkgid:print a fully qualified package specification' +'publish:upload package to the registry' +'read-manifest:print manifest in JSON format' +'run:run the main binary of the local package' +'rustc:compile a package and all of its dependencies' +'rustdoc:build documentation for a package' +'search:search packages on crates.io' +'test:execute all unit and tests of a local package' +'uninstall:remove a Rust binary' +'update:update dependencies' +'verify-project:check Cargo.toml' +'version:show version information' +'yank:remove pushed file from index' +) +_describe 'command' commands + +} + + +#FIXME: Disabled until fixed +#gets package names from the manifest file +_get_package_names() +{ +} + +#TODO:see if it makes sense to have 'locate-project' to have non-json output. +#strips package name from json stuff +_locate_manifest(){ +local manifest=`cargo locate-project 2>/dev/null` +regexp-replace manifest '\{"root":"|"\}' '' +echo $manifest +} + +# Extracts the values of "name" from the array given in $1 and shows them as +# command line options for completion +_get_names_from_array() +{ + local -a filelist; + local manifest=$(_locate_manifest) + if [[ -z $manifest ]]; then + return 0 + fi + + local last_line + local -a names; + local in_block=false + local block_name=$1 + names=() + while read line + do + if [[ $last_line == "[[$block_name]]" ]]; then + in_block=true + else + if [[ $last_line =~ '.*\[\[.*' ]]; then + in_block=false + fi + fi + + if [[ $in_block == true ]]; then + if [[ $line =~ '.*name.*=' ]]; then + regexp-replace line '^.*name *= *|"' "" + names+=$line + fi + fi + + last_line=$line + done < $manifest + _describe $block_name names + +} + +#Gets the test names from the manifest file +_test_names() +{ + _get_names_from_array "test" +} + +#Gets the bench names from the manifest file +_benchmark_names() +{ + _get_names_from_array "bench" +} + +# These flags are mutally exclusive specifiers for the scope of a command; as +# they are used in multiple places without change, they are expanded into the +# appropriate command's `_arguments` where appropriate. +set command_scope_spec +command_scope_spec=( + '(--bin --example --test --lib)--bench=[benchmark name]: :_benchmark_names' + '(--bench --bin --test --lib)--example=[example name]' + '(--bench --example --test --lib)--bin=[binary name]' + '(--bench --bin --example --test)--lib=[library name]' + '(--bench --bin --example --lib)--test=[test name]' +) + + +_cargo diff --git a/plugins/cargo/cargo.plugin.zsh b/plugins/cargo/cargo.plugin.zsh deleted file mode 100644 index e1dc953dd..000000000 --- a/plugins/cargo/cargo.plugin.zsh +++ /dev/null @@ -1,22 +0,0 @@ -function _cargo_commands() { - local ret=1 state - _arguments ':subcommand:->subcommand' && ret=0 - - case $state in - subcommand) - subcommands=( - "build:Build the current project" - "clean:Clean up after a build" - "help:Help about available commands" - "new:Create a new project" - "test:Run the tests" - "update:Updates list of known packages" - "run:Builds and runs the currecnt project" - ) - _describe -t subcommands 'cargo subcommands' subcommands && ret=0 - esac - - return ret -} - -compdef _cargo_commands cargo From 16bd691b3bd5ca9319e677b66096337e9bac1795 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Tue, 4 Oct 2016 00:17:38 +0200 Subject: [PATCH 0059/1083] Add README for the cargo plugin --- plugins/cargo/README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 plugins/cargo/README.md diff --git a/plugins/cargo/README.md b/plugins/cargo/README.md new file mode 100644 index 000000000..5fa688d21 --- /dev/null +++ b/plugins/cargo/README.md @@ -0,0 +1,11 @@ +# cargo + +This plugin adds completion for the Rust build tool [`cargo`](https://github.com/rust-lang/cargo). + +To use it, add `cargo` to the plugins array in your zshrc file: + +```zsh +plugins=(... cargo) +``` + +Updated on October 4th, 2016. From 2a0223370a2e5bae604344a735ad7b53f30b0cab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Ordon?= Date: Mon, 3 Oct 2016 23:37:35 +0100 Subject: [PATCH 0060/1083] Add an alias for React Native Link command (#5491) --- plugins/react-native/react-native.plugin.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/react-native/react-native.plugin.zsh b/plugins/react-native/react-native.plugin.zsh index 7323f1d2e..9463a98b3 100644 --- a/plugins/react-native/react-native.plugin.zsh +++ b/plugins/react-native/react-native.plugin.zsh @@ -3,4 +3,5 @@ alias rnios4s='react-native run-ios --simulator "iPhone 4s"' alias rnios5='react-native run-ios --simulator "iPhone 5"' alias rnios5s='react-native run-ios --simulator "iPhone 5s"' alias rnios='react-native run-ios' +alias rnlink='react-native link' From d57f36dab82b332be6fd7362c0916b226709834b Mon Sep 17 00:00:00 2001 From: Mats Faugli Date: Tue, 4 Oct 2016 00:47:59 +0200 Subject: [PATCH 0061/1083] Add jgitflow maven goals (#5489) --- plugins/mvn/mvn.plugin.zsh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/mvn/mvn.plugin.zsh b/plugins/mvn/mvn.plugin.zsh index 625aad949..04bd186af 100644 --- a/plugins/mvn/mvn.plugin.zsh +++ b/plugins/mvn/mvn.plugin.zsh @@ -110,6 +110,8 @@ function listMavenCompletions { help:active-profiles help:all-profiles help:describe help:effective-pom help:effective-settings help:evaluate help:expressions help:system # release release:clean release:prepare release:rollback release:perform release:stage release:branch release:update-versions + # jgitflow + jgitflow:feature-start jgitflow:feature-finish jgitflow:release-start jgitflow:release-finish jgitflow:hotfix-start jgitflow:hotfix-finish jgitflow:build-number # repository repository:bundle-create repository:bundle-pack # source From 81981ef248e6e05d11affd4fca40bcfb98306b0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Tue, 4 Oct 2016 01:03:16 +0200 Subject: [PATCH 0062/1083] Fix cp plugin completion and refactor (#5427) * cp plugin: change cpv to function so that completion works * cp plugin: show numbers in units of 1024 (K,M,G,T) Use `-h` level (3): output numbers in units of 1024. See the manpage of rsync for more information. * cp plugin: add a README file * cp plugin: recurse directories * cp plugin: remove `--` to separate files from options This has some undesired effects, like having `cpv --help` be a file not found error. Use `--` yourself if you need it (which you generally don't): ```zsh cpv -- -some-file-with-hyphens.txt /tmp ``` Added this same info to the README. --- plugins/cp/README.md | 32 ++++++++++++++++++++++++++++++++ plugins/cp/cp.plugin.zsh | 18 ++++-------------- 2 files changed, 36 insertions(+), 14 deletions(-) create mode 100644 plugins/cp/README.md diff --git a/plugins/cp/README.md b/plugins/cp/README.md new file mode 100644 index 000000000..e8a9b6ccc --- /dev/null +++ b/plugins/cp/README.md @@ -0,0 +1,32 @@ +# cp plugin + +This plugin defines a `cpv` function that uses `rsync` so that you +get the features and security of this command. + +To enable, add `cp` to your `plugins` array in your zshrc file: + +```zsh +plugins=(... cp) +``` + +## Description + +The enabled options for rsync are: + +- `-p`: preserves permissions. + +- `-o`: preserves owner. + +* `-g`: preserves group. + +* `-b`: make a backup of the original file instead of overwriting it, if it exists. + +* `-r`: recurse directories. + +* `-hhh`: outputs numbers in human-readable format, in units of 1024 (K, M, G, T). + +* `--backup-dir=/tmp/rsync`: move backup copies to "/tmp/rsync". + +* `-e /dev/null`: only work on local files (disable remote shells). + +* `--progress`: display progress. diff --git a/plugins/cp/cp.plugin.zsh b/plugins/cp/cp.plugin.zsh index 7355a9990..fe6ea87a8 100644 --- a/plugins/cp/cp.plugin.zsh +++ b/plugins/cp/cp.plugin.zsh @@ -1,14 +1,4 @@ -#Show progress while file is copying - -# Rsync options are: -# -p - preserve permissions -# -o - preserve owner -# -g - preserve group -# -h - output in human-readable format -# --progress - display progress -# -b - instead of just overwriting an existing file, save the original -# --backup-dir=/tmp/rsync - move backup copies to "/tmp/rsync" -# -e /dev/null - only work on local files -# -- - everything after this is an argument, even if it looks like an option - -alias cpv="rsync -poghb --backup-dir=/tmp/rsync -e /dev/null --progress --" +cpv() { + rsync -pogbr -hhh --backup-dir=/tmp/rsync -e /dev/null --progress "$@" +} +compdef _files cpv From efa7c7b7ff72953368dfaba979e3014826bf1837 Mon Sep 17 00:00:00 2001 From: Hong Xu Date: Sun, 2 Oct 2016 19:15:57 -0700 Subject: [PATCH 0063/1083] set better default colors for GNU ls instead of none. GNU coreutils ship a color setup command by default which can be used to set a good default color theme for ls: https://www.gnu.org/software/coreutils/manual/html_node/dircolors-invocation.html --- lib/theme-and-appearance.zsh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/theme-and-appearance.zsh b/lib/theme-and-appearance.zsh index 5c5bb0e6d..585f872e1 100644 --- a/lib/theme-and-appearance.zsh +++ b/lib/theme-and-appearance.zsh @@ -5,7 +5,7 @@ export LSCOLORS="Gxfxcxdxbxegedabagacad" # Enable ls colors if [ "$DISABLE_LS_COLORS" != "true" ] then - # Find the option for using colors in ls, depending on the version: Linux or BSD + # Find the option for using colors in ls, depending on the version: GNU or BSD if [[ "$(uname -s)" == "NetBSD" ]]; then # On NetBSD, test if "gls" (GNU ls) is installed (this one supports colors); # otherwise, leave ls as is, because NetBSD's ls doesn't support -G @@ -18,6 +18,8 @@ then gls --color -d . &>/dev/null 2>&1 && alias ls='gls --color=tty' colorls -G -d . &>/dev/null 2>&1 && alias ls='colorls -G' else + # For GNU ls, we use the default ls color theme. They can later be overwritten by themes. + type dircolors >/dev/null 2>&1 && eval "$(dircolors)" ls --color -d . &>/dev/null 2>&1 && alias ls='ls --color=tty' || alias ls='ls -G' fi fi From 6c08286c8e0ca4d2b48679d2692f0ce4ac443f4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Tue, 4 Oct 2016 01:25:07 +0200 Subject: [PATCH 0064/1083] Use `$commands[]` to check for command existence --- lib/theme-and-appearance.zsh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/theme-and-appearance.zsh b/lib/theme-and-appearance.zsh index 585f872e1..43e245e16 100644 --- a/lib/theme-and-appearance.zsh +++ b/lib/theme-and-appearance.zsh @@ -19,7 +19,8 @@ then colorls -G -d . &>/dev/null 2>&1 && alias ls='colorls -G' else # For GNU ls, we use the default ls color theme. They can later be overwritten by themes. - type dircolors >/dev/null 2>&1 && eval "$(dircolors)" + (( $+commands[dircolors] )) && eval "$(dircolors)" + ls --color -d . &>/dev/null 2>&1 && alias ls='ls --color=tty' || alias ls='ls -G' fi fi From 6304a789ab280e4a6e984faedd4b046f703327e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Tue, 4 Oct 2016 01:25:36 +0200 Subject: [PATCH 0065/1083] Only set default LS_COLORS if not set before Also, force the use of Bourne-style shell syntax with `dircolors -b`. --- lib/theme-and-appearance.zsh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/theme-and-appearance.zsh b/lib/theme-and-appearance.zsh index 43e245e16..621cd067b 100644 --- a/lib/theme-and-appearance.zsh +++ b/lib/theme-and-appearance.zsh @@ -19,7 +19,9 @@ then colorls -G -d . &>/dev/null 2>&1 && alias ls='colorls -G' else # For GNU ls, we use the default ls color theme. They can later be overwritten by themes. - (( $+commands[dircolors] )) && eval "$(dircolors)" + if [[ -z "$LS_COLORS" ]]; then + (( $+commands[dircolors] )) && eval "$(dircolors -b)" + fi ls --color -d . &>/dev/null 2>&1 && alias ls='ls --color=tty' || alias ls='ls -G' fi From c2e3a410ea7975f72bf7f0d5b4550ac4375b1e10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Tue, 4 Oct 2016 01:24:48 +0200 Subject: [PATCH 0066/1083] Fix style of theme-and-appearance.zsh --- lib/theme-and-appearance.zsh | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/lib/theme-and-appearance.zsh b/lib/theme-and-appearance.zsh index 621cd067b..a3bb24677 100644 --- a/lib/theme-and-appearance.zsh +++ b/lib/theme-and-appearance.zsh @@ -1,41 +1,37 @@ # ls colors autoload -U colors && colors -export LSCOLORS="Gxfxcxdxbxegedabagacad" # Enable ls colors -if [ "$DISABLE_LS_COLORS" != "true" ] -then - # Find the option for using colors in ls, depending on the version: GNU or BSD +export LSCOLORS="Gxfxcxdxbxegedabagacad" + +if [[ "$DISABLE_LS_COLORS" != "true" ]]; then + # Find the option for using colors in ls, depending on the version if [[ "$(uname -s)" == "NetBSD" ]]; then # On NetBSD, test if "gls" (GNU ls) is installed (this one supports colors); # otherwise, leave ls as is, because NetBSD's ls doesn't support -G - gls --color -d . &>/dev/null 2>&1 && alias ls='gls --color=tty' + gls --color -d . &>/dev/null && alias ls='gls --color=tty' elif [[ "$(uname -s)" == "OpenBSD" ]]; then # On OpenBSD, "gls" (ls from GNU coreutils) and "colorls" (ls from base, # with color and multibyte support) are available from ports. "colorls" # will be installed on purpose and can't be pulled in by installing # coreutils, so prefer it to "gls". - gls --color -d . &>/dev/null 2>&1 && alias ls='gls --color=tty' - colorls -G -d . &>/dev/null 2>&1 && alias ls='colorls -G' + gls --color -d . &>/dev/null && alias ls='gls --color=tty' + colorls -G -d . &>/dev/null && alias ls='colorls -G' else # For GNU ls, we use the default ls color theme. They can later be overwritten by themes. if [[ -z "$LS_COLORS" ]]; then (( $+commands[dircolors] )) && eval "$(dircolors -b)" fi - ls --color -d . &>/dev/null 2>&1 && alias ls='ls --color=tty' || alias ls='ls -G' + ls --color -d . &>/dev/null && alias ls='ls --color=tty' || alias ls='ls -G' fi fi setopt auto_cd setopt multios +setopt prompt_subst -if [[ x$WINDOW != x ]] -then - SCREEN_NO="%B$WINDOW%b " -else - SCREEN_NO="" -fi +[[ -n "$WINDOW" ]] && SCREEN_NO="%B$WINDOW%b " || SCREEN_NO="" # Apply theming defaults PS1="%n@%m:%~%# " @@ -45,6 +41,3 @@ ZSH_THEME_GIT_PROMPT_PREFIX="git:(" # Prefix at the very beginning of th ZSH_THEME_GIT_PROMPT_SUFFIX=")" # At the very end of the prompt ZSH_THEME_GIT_PROMPT_DIRTY="*" # Text to display if the branch is dirty ZSH_THEME_GIT_PROMPT_CLEAN="" # Text to display if the branch is clean - -# Setup the prompt with pretty colors -setopt prompt_subst From 86126233bb5bb99ced64b95c16a4e4ed776fd8de Mon Sep 17 00:00:00 2001 From: slavaGanzin Date: Tue, 4 Oct 2016 12:21:18 +0300 Subject: [PATCH 0067/1083] specify globalias modes --- plugins/globalias/globalias.plugin.zsh | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/plugins/globalias/globalias.plugin.zsh b/plugins/globalias/globalias.plugin.zsh index 95a0e3072..bac657c47 100644 --- a/plugins/globalias/globalias.plugin.zsh +++ b/plugins/globalias/globalias.plugin.zsh @@ -4,8 +4,11 @@ globalias() { zle self-insert } zle -N globalias -bindkey -e " " globalias -bindkey -v " " globalias -bindkey -e "^ " magic-space # control-space to bypass completion -bindkey -v "^ " magic-space -bindkey -M isearch " " magic-space # normal space during searches + +# space expands all global aliases +bindkey -M emacs " " globalias +bindkey -M viins " " globalias + +# control-space to make a normal space +bindkey -M emacs "^ " magic-space +bindkey -M viins "^ " magic-space From 75f87dd24ec60bd243ffbe7c9dbd1daec5b51ae2 Mon Sep 17 00:00:00 2001 From: slavaGanzin Date: Tue, 4 Oct 2016 14:03:37 +0300 Subject: [PATCH 0068/1083] README for globalias --- plugins/globalias/README.md | 37 ++++++++++++++++++++++++++ plugins/globalias/globalias.plugin.zsh | 3 +++ 2 files changed, 40 insertions(+) create mode 100644 plugins/globalias/README.md diff --git a/plugins/globalias/README.md b/plugins/globalias/README.md new file mode 100644 index 000000000..db2e5bee0 --- /dev/null +++ b/plugins/globalias/README.md @@ -0,0 +1,37 @@ +#Globalias + + +Expands all globes, backtick expressions and aliases(including global). + +``` +$ touch {1..10} +#expands to +$ touch 1 2 3 4 5 6 7 8 9 10 + +$ mkdir "`date -R`" +#expands to +$ mkdir Tue,\ 04\ Oct\ 2016\ 13:54:03\ +0300 + +#.zshrc: +alias -g G="| grep --color=auto -P" +alias l='ls --color=auto -lah' + +$ lG +#expands to +$ ls --color=auto -lah | grep --color=auto -P + +ls **/*.json +#expands to +ls folder/file.json anotherfolder/another.json +``` + +####Returns autocompletion to your custom aliases: +``` +#.zsrc +alias S="sudo systemctl" + +$ S +#expands to: +sudo systemctl s +#trigger autocompletion +``` diff --git a/plugins/globalias/globalias.plugin.zsh b/plugins/globalias/globalias.plugin.zsh index bac657c47..bf4cfc030 100644 --- a/plugins/globalias/globalias.plugin.zsh +++ b/plugins/globalias/globalias.plugin.zsh @@ -12,3 +12,6 @@ bindkey -M viins " " globalias # control-space to make a normal space bindkey -M emacs "^ " magic-space bindkey -M viins "^ " magic-space + +# normal space during searches +bindkey -M isearch " " magic-space From 6eaa868cd9ad8447973a53f09453121d58366a6a Mon Sep 17 00:00:00 2001 From: slavaGanzin Date: Tue, 4 Oct 2016 14:05:41 +0300 Subject: [PATCH 0069/1083] fix comment --- plugins/globalias/globalias.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/globalias/globalias.plugin.zsh b/plugins/globalias/globalias.plugin.zsh index bf4cfc030..9602a9606 100644 --- a/plugins/globalias/globalias.plugin.zsh +++ b/plugins/globalias/globalias.plugin.zsh @@ -5,7 +5,7 @@ globalias() { } zle -N globalias -# space expands all global aliases +# space expands all aliases, including global bindkey -M emacs " " globalias bindkey -M viins " " globalias From f701b4de0fb55b71e2cfb17522a08fba741ff170 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Tue, 4 Oct 2016 13:55:11 +0200 Subject: [PATCH 0070/1083] Fix formatting and usage section Also: - Changes `globes` (which doesn't exist) to `glob expressions`. - Delete the `trigger autocompletion to your current aliases` use case, since that's not really implemented. --- plugins/globalias/README.md | 55 +++++++++++++++++++++++++++---------- 1 file changed, 40 insertions(+), 15 deletions(-) diff --git a/plugins/globalias/README.md b/plugins/globalias/README.md index db2e5bee0..ba9888ccb 100644 --- a/plugins/globalias/README.md +++ b/plugins/globalias/README.md @@ -1,37 +1,62 @@ -#Globalias +# Globalias plugin +Expands all glob expressions, subcommands and aliases (including global). -Expands all globes, backtick expressions and aliases(including global). +Idea from: http://blog.patshead.com/2012/11/automatically-expaning-zsh-global-aliases---simplified.html. + +## Usage + +Add `globalias` to the plugins array in your zshrc file: + +```zsh +plugins=(... globalias) +``` + +Then just press `SPACE` to trigger the expansion of a command you've written. + +If you only want to insert a space without expanding the command line, press +`CTRL`+`SPACE`. + +## Examples + +#### Glob expressions ``` $ touch {1..10} -#expands to +# expands to $ touch 1 2 3 4 5 6 7 8 9 10 +$ ls **/*.json +# expands to +$ ls folder/file.json anotherfolder/another.json +``` + +#### Subcommands + +``` $ mkdir "`date -R`" -#expands to +# expands to $ mkdir Tue,\ 04\ Oct\ 2016\ 13:54:03\ +0300 -#.zshrc: +``` + +#### Aliases + +``` +# .zshrc: alias -g G="| grep --color=auto -P" alias l='ls --color=auto -lah' $ lG -#expands to +# expands to $ ls --color=auto -lah | grep --color=auto -P - -ls **/*.json -#expands to -ls folder/file.json anotherfolder/another.json ``` -####Returns autocompletion to your custom aliases: ``` -#.zsrc +# .zsrc: alias S="sudo systemctl" $ S -#expands to: -sudo systemctl s -#trigger autocompletion +# expands to: +$ sudo systemctl ``` From 3cc61701bd7fd0a3fa6cb3c70f2b927a1e51970a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Tue, 4 Oct 2016 13:56:25 +0200 Subject: [PATCH 0071/1083] Update per-directory-history plugin to latest version (#5493) Latest version: February 17, 2016 - dd81201 --- plugins/per-directory-history/README.md | 5 ++--- .../per-directory-history/per-directory-history.zsh | 12 +++++++----- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/plugins/per-directory-history/README.md b/plugins/per-directory-history/README.md index d8ff93dc0..196f74e6c 100644 --- a/plugins/per-directory-history/README.md +++ b/plugins/per-directory-history/README.md @@ -27,9 +27,8 @@ Usage 2. The default mode if per directory history, interact with your history as normal. 3. Press ^G (the Control and G keys simultaneously) to toggle between local - and global histories. - - + and global histories. If you would prefer a different shortcut to toggle + set the PER_DIRECTORY_HISTORY_TOGGLE environment variable. ------------------------------------------------------------------------------- Configuration diff --git a/plugins/per-directory-history/per-directory-history.zsh b/plugins/per-directory-history/per-directory-history.zsh index bdee341bd..1242dc420 100644 --- a/plugins/per-directory-history/per-directory-history.zsh +++ b/plugins/per-directory-history/per-directory-history.zsh @@ -30,7 +30,7 @@ # ################################################################################ # -# Copyright (c) 2012 Jim Hester +# Copyright (c) 2014 Jim Hester # # This software is provided 'as-is', without any express or implied warranty. # In no event will the authors be held liable for any damages arising from the @@ -57,6 +57,7 @@ #------------------------------------------------------------------------------- [[ -z $HISTORY_BASE ]] && HISTORY_BASE="$HOME/.directory_history" +[[ -z $PER_DIRECTORY_HISTORY_TOGGLE ]] && PER_DIRECTORY_HISTORY_TOGGLE='^G' #------------------------------------------------------------------------------- # toggle global/directory history used for searching - ctrl-G by default @@ -76,7 +77,7 @@ function per-directory-history-toggle-history() { autoload per-directory-history-toggle-history zle -N per-directory-history-toggle-history -bindkey '^G' per-directory-history-toggle-history +bindkey $PER_DIRECTORY_HISTORY_TOGGLE per-directory-history-toggle-history #------------------------------------------------------------------------------- # implementation details @@ -108,7 +109,7 @@ function _per-directory-history-change-directory() { } function _per-directory-history-addhistory() { - print -Sr -- ${1%%$'\n'} + print -Sr -- "${1%%$'\n'}" fc -p $_per_directory_history_directory } @@ -140,8 +141,9 @@ function _per-directory-history-set-global-history() { #add functions to the exec list for chpwd and zshaddhistory -chpwd_functions=(${chpwd_functions[@]} "_per-directory-history-change-directory") -zshaddhistory_functions=(${zshaddhistory_functions[@]} "_per-directory-history-addhistory") +autoload -U add-zsh-hook +add-zsh-hook chpwd _per-directory-history-change-directory +add-zsh-hook zshaddhistory _per-directory-history-addhistory #start in directory mode mkdir -p ${_per_directory_history_directory:h} From 7f9b7733507d57a6cd4f38d0c0db830647c1940d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Tue, 4 Oct 2016 17:23:20 +0200 Subject: [PATCH 0072/1083] Fix compdef commands in git plugin The command `compdef command=git` returns an error in some cases, the appropriate command is `compdef _git command`. Fixes #5442 --- plugins/git/git.plugin.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 28fb253dd..178f1deb2 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -76,7 +76,7 @@ alias gcd='git checkout develop' alias gcmsg='git commit -m' alias gco='git checkout' alias gcount='git shortlog -sn' -compdef gcount=git +compdef _git gcount alias gcp='git cherry-pick' alias gcpa='git cherry-pick --abort' alias gcpc='git cherry-pick --continue' @@ -159,7 +159,7 @@ alias ghh='git help' alias gignore='git update-index --assume-unchanged' alias gignored='git ls-files -v | grep "^[[:lower:]]"' alias git-svn-dcommit-push='git svn dcommit && git push github master:svntrunk' -compdef git-svn-dcommit-push=git +compdef _git git-svn-dcommit-push=git alias gk='\gitk --all --branches' compdef _git gk='gitk' From a1200f5bccd7c0ebe327ccbc554d56247136d48c Mon Sep 17 00:00:00 2001 From: slavaGanzin Date: Thu, 29 Sep 2016 19:05:49 +0300 Subject: [PATCH 0073/1083] git auto fetch on change directory --- plugins/git-auto-fetch/git-auto-fetch.plugin.zsh | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 plugins/git-auto-fetch/git-auto-fetch.plugin.zsh diff --git a/plugins/git-auto-fetch/git-auto-fetch.plugin.zsh b/plugins/git-auto-fetch/git-auto-fetch.plugin.zsh new file mode 100644 index 000000000..841f47baf --- /dev/null +++ b/plugins/git-auto-fetch/git-auto-fetch.plugin.zsh @@ -0,0 +1,5 @@ +function git_fetch_on_chpwd { + ([[ -d .git ]] && git fetch --all >! ./.git/FETCH_LOG &) +} +chpwd_functions=(${chpwd_functions[@]} "git_fetch_on_chpwd") +unset git_fetch_on_cpwd From 1427fbffef68d5796c8296ba105f325598b809f8 Mon Sep 17 00:00:00 2001 From: slavaGanzin Date: Thu, 29 Sep 2016 22:14:04 +0300 Subject: [PATCH 0074/1083] redirect output --- plugins/git-auto-fetch/git-auto-fetch.plugin.zsh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/git-auto-fetch/git-auto-fetch.plugin.zsh b/plugins/git-auto-fetch/git-auto-fetch.plugin.zsh index 841f47baf..cbf6984a0 100644 --- a/plugins/git-auto-fetch/git-auto-fetch.plugin.zsh +++ b/plugins/git-auto-fetch/git-auto-fetch.plugin.zsh @@ -1,5 +1,5 @@ function git_fetch_on_chpwd { - ([[ -d .git ]] && git fetch --all >! ./.git/FETCH_LOG &) + ([[ -d .git ]] && git fetch --all &>! ./.git/FETCH_LOG &) } -chpwd_functions=(${chpwd_functions[@]} "git_fetch_on_chpwd") -unset git_fetch_on_cpwd +chpwd_functions+=(git_fetch_on_chpwd) +git_fetch_on_chpwd From 25fcf0c265c682f092ce49a6849e5e09b38dffa9 Mon Sep 17 00:00:00 2001 From: slavaGanzin Date: Tue, 4 Oct 2016 21:26:19 +0300 Subject: [PATCH 0075/1083] git-auto-fetch: README.md --- plugins/git-auto-fetch/README.md | 22 +++++++++++++++++++ .../git-auto-fetch/git-auto-fetch.plugin.zsh | 12 +++++++++- 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 plugins/git-auto-fetch/README.md diff --git a/plugins/git-auto-fetch/README.md b/plugins/git-auto-fetch/README.md new file mode 100644 index 000000000..7f5eac49d --- /dev/null +++ b/plugins/git-auto-fetch/README.md @@ -0,0 +1,22 @@ +# Git auto fetch + +Automatically fetches all changes from all remotes every time you cd into yout git-initialized project. + +####Usage +Add ```git-auto-fetch``` to the plugins array in your zshrc file: +```shell +plugins=(... git-auto-fetch) +``` + +Every time you change directory to your git project all remotes will be fetched in background. Log of ```git fetch --all``` will be saved into .git/FETCH_LOG + +####Toggle auto fetch per folder +If you are using mobile connection or for any other reason you can disable git-auto-fetch for any folder: + +```shell +$ cd to/your/project +$ git-auto-fetch +disabled +$ git-auto-fetch +enabled +``` diff --git a/plugins/git-auto-fetch/git-auto-fetch.plugin.zsh b/plugins/git-auto-fetch/git-auto-fetch.plugin.zsh index cbf6984a0..87535b251 100644 --- a/plugins/git-auto-fetch/git-auto-fetch.plugin.zsh +++ b/plugins/git-auto-fetch/git-auto-fetch.plugin.zsh @@ -1,5 +1,15 @@ function git_fetch_on_chpwd { - ([[ -d .git ]] && git fetch --all &>! ./.git/FETCH_LOG &) + ([[ -d .git ]] && [[ ! -f ".git/NO_AUTO_FETCH" ]] && git fetch --all &>! .git/FETCH_LOG &) +} + +function git-auto-fetch { + [[ ! -d .git ]] && return + if [[ -f ".git/NO_AUTO_FETCH" ]]; then + rm ".git/NO_AUTO_FETCH" && echo "disabled" + else + touch ".git/NO_AUTO_FETCH" && echo "enabled" + fi } chpwd_functions+=(git_fetch_on_chpwd) git_fetch_on_chpwd +unset git_fetch_on_chpwd From ac7dcdb21cfb57180c7d8007d95232ee62086997 Mon Sep 17 00:00:00 2001 From: slavaGanzin Date: Thu, 6 Oct 2016 16:55:21 +0300 Subject: [PATCH 0076/1083] add colors --- plugins/git-auto-fetch/git-auto-fetch.plugin.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/git-auto-fetch/git-auto-fetch.plugin.zsh b/plugins/git-auto-fetch/git-auto-fetch.plugin.zsh index 87535b251..0bcefa931 100644 --- a/plugins/git-auto-fetch/git-auto-fetch.plugin.zsh +++ b/plugins/git-auto-fetch/git-auto-fetch.plugin.zsh @@ -5,9 +5,9 @@ function git_fetch_on_chpwd { function git-auto-fetch { [[ ! -d .git ]] && return if [[ -f ".git/NO_AUTO_FETCH" ]]; then - rm ".git/NO_AUTO_FETCH" && echo "disabled" + rm ".git/NO_AUTO_FETCH" && echo "${fg_bold[red]}disabled${reset_color}" else - touch ".git/NO_AUTO_FETCH" && echo "enabled" + touch ".git/NO_AUTO_FETCH" && echo "${fg_bold[green]}enabled${reset_color}" fi } chpwd_functions+=(git_fetch_on_chpwd) From d69f2850afc189310b40141c839480b42f71775c Mon Sep 17 00:00:00 2001 From: diego Date: Fri, 7 Oct 2016 23:54:54 +0200 Subject: [PATCH 0077/1083] Add non 0 exit code for missing jump targets (#5500) This allows for the user to combine the jump command with something else. In my example cd and jump are now combined like this: ```bash jumpcd() { jump $1 > /dev/null || cd $1 } alias cd="jumpcd" ``` --- plugins/jump/jump.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/jump/jump.plugin.zsh b/plugins/jump/jump.plugin.zsh index e58e7373d..86d9553a2 100644 --- a/plugins/jump/jump.plugin.zsh +++ b/plugins/jump/jump.plugin.zsh @@ -9,7 +9,7 @@ export MARKPATH=$HOME/.marks jump() { - cd -P "$MARKPATH/$1" 2>/dev/null || echo "No such mark: $1" + cd -P "$MARKPATH/$1" 2>/dev/null || {echo "No such mark: $1"; return 1} } mark() { From cd37d19ddaf9cc5acbf443f93f88ca355f74090d Mon Sep 17 00:00:00 2001 From: Florian Boulay Date: Sat, 8 Oct 2016 08:26:10 +0200 Subject: [PATCH 0078/1083] Add m4a format in the common aliases plugin (#5502) The m4a file format can be opened in the command line with mplayer --- plugins/common-aliases/common-aliases.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/common-aliases/common-aliases.plugin.zsh b/plugins/common-aliases/common-aliases.plugin.zsh index c7aafd8b8..128db6e5f 100644 --- a/plugins/common-aliases/common-aliases.plugin.zsh +++ b/plugins/common-aliases/common-aliases.plugin.zsh @@ -63,7 +63,7 @@ if is-at-least 4.2.0; then _image_fts=(jpg jpeg png gif mng tiff tif xpm) for ft in $_image_fts ; do alias -s $ft=$XIVIEWER; done - _media_fts=(ape avi flv mkv mov mp3 mpeg mpg ogg ogm rm wav webm) + _media_fts=(ape avi flv m4a mkv mov mp3 mpeg mpg ogg ogm rm wav webm) for ft in $_media_fts ; do alias -s $ft=mplayer ; done #read documents From 3be4108d722269720c71138a211dd744ade66f5d Mon Sep 17 00:00:00 2001 From: Michel Filipe Date: Sun, 9 Oct 2016 14:36:47 -0300 Subject: [PATCH 0079/1083] remove duplicate alias (#5508) Removing one "apt-get autoremove" alias because it is duplicated. --- plugins/ubuntu/ubuntu.plugin.zsh | 2 -- 1 file changed, 2 deletions(-) diff --git a/plugins/ubuntu/ubuntu.plugin.zsh b/plugins/ubuntu/ubuntu.plugin.zsh index d924f8861..ffde284fe 100644 --- a/plugins/ubuntu/ubuntu.plugin.zsh +++ b/plugins/ubuntu/ubuntu.plugin.zsh @@ -29,7 +29,6 @@ compdef _ppap ppap='sudo ppa-purge' alias ag='sudo apt-get' # age - but without sudo alias aga='sudo apt-get autoclean' # aac -alias agar='sudo apt-get autoremove' alias agb='sudo apt-get build-dep' # abd alias agc='sudo apt-get clean' # adc alias agd='sudo apt-get dselect-upgrade' # ads @@ -44,7 +43,6 @@ alias agar='sudo apt-get autoremove' compdef _ag ag='sudo apt-get' compdef _aga aga='sudo apt-get autoclean' -compdef _agar agar='sudo apt-get autoremove' compdef _agb agb='sudo apt-get build-dep' compdef _agc agc='sudo apt-get clean' compdef _agd agd='sudo apt-get dselect-upgrade' From 98cd3973d23dfb83aa60f5d11bbb31e2dc714fad Mon Sep 17 00:00:00 2001 From: Hong Date: Mon, 10 Oct 2016 11:40:17 -0700 Subject: [PATCH 0080/1083] Take advantage of LS_COLORS for the color of completion if GNU ls is used. (#5510) --- lib/theme-and-appearance.zsh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/theme-and-appearance.zsh b/lib/theme-and-appearance.zsh index a3bb24677..12bcd2849 100644 --- a/lib/theme-and-appearance.zsh +++ b/lib/theme-and-appearance.zsh @@ -24,6 +24,9 @@ if [[ "$DISABLE_LS_COLORS" != "true" ]]; then fi ls --color -d . &>/dev/null && alias ls='ls --color=tty' || alias ls='ls -G' + + # Take advantage of $LS_COLORS for completion as well. + zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}" fi fi From 028fdf2e9948fa720599a63cd36124eff95cb6fc Mon Sep 17 00:00:00 2001 From: slavaGanzin Date: Mon, 10 Oct 2016 22:33:09 +0300 Subject: [PATCH 0081/1083] add coloring --- .../git-auto-fetch/git-auto-fetch.plugin.zsh | 27 +++++++++++-------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/plugins/git-auto-fetch/git-auto-fetch.plugin.zsh b/plugins/git-auto-fetch/git-auto-fetch.plugin.zsh index 0bcefa931..949709e4c 100644 --- a/plugins/git-auto-fetch/git-auto-fetch.plugin.zsh +++ b/plugins/git-auto-fetch/git-auto-fetch.plugin.zsh @@ -1,15 +1,20 @@ -function git_fetch_on_chpwd { - ([[ -d .git ]] && [[ ! -f ".git/NO_AUTO_FETCH" ]] && git fetch --all &>! .git/FETCH_LOG &) +function git-fetch-on-chpwd { + (`git rev-parse --is-inside-work-tree 2>/dev/null` && + dir=`git rev-parse --git-dir` && + [[ ! -f $dir/NO_AUTO_FETCH ]] && + git fetch --all &>! $dir/FETCH_LOG &) } function git-auto-fetch { - [[ ! -d .git ]] && return - if [[ -f ".git/NO_AUTO_FETCH" ]]; then - rm ".git/NO_AUTO_FETCH" && echo "${fg_bold[red]}disabled${reset_color}" - else - touch ".git/NO_AUTO_FETCH" && echo "${fg_bold[green]}enabled${reset_color}" - fi + `git rev-parse --is-inside-work-tree 2>/dev/null` || return + guard="`git rev-parse --git-dir`/NO_AUTO_FETCH" + + (rm $guard 2>/dev/null && + echo "${fg_bold[green]}enabled${reset_color}") || + (touch $guard && + echo "${fg_bold[red]}disabled${reset_color}") } -chpwd_functions+=(git_fetch_on_chpwd) -git_fetch_on_chpwd -unset git_fetch_on_chpwd + +chpwd_functions+=(git-fetch-on-chpwd) +git-fetch-on-chpwd +unset git-fetch-on-chpwd From 9f2977f3eb969a8b026d1fc84394bef0d1a9ee78 Mon Sep 17 00:00:00 2001 From: slavaGanzin Date: Mon, 10 Oct 2016 22:30:47 +0300 Subject: [PATCH 0082/1083] reimplement --- $ | 0 disabled | 0 echo | 0 plugins/zsh-syntax-highlighting | 1 + 4 files changed, 1 insertion(+) create mode 100644 $ create mode 100644 disabled create mode 100644 echo create mode 160000 plugins/zsh-syntax-highlighting diff --git a/$ b/$ new file mode 100644 index 000000000..e69de29bb diff --git a/disabled b/disabled new file mode 100644 index 000000000..e69de29bb diff --git a/echo b/echo new file mode 100644 index 000000000..e69de29bb diff --git a/plugins/zsh-syntax-highlighting b/plugins/zsh-syntax-highlighting new file mode 160000 index 000000000..094329eb1 --- /dev/null +++ b/plugins/zsh-syntax-highlighting @@ -0,0 +1 @@ +Subproject commit 094329eb145e00b810e65415ed4b9ad58aa7c34a From a56eac7a71a774a4d97bb9456f36b8eb495329d5 Mon Sep 17 00:00:00 2001 From: Hong Date: Mon, 10 Oct 2016 13:24:30 -0700 Subject: [PATCH 0083/1083] Use OSTYPE instead of uname whenever possible for better speed. (#5496) --- lib/theme-and-appearance.zsh | 4 ++-- plugins/battery/battery.plugin.zsh | 2 +- plugins/gitfast/git-completion.bash | 2 +- plugins/sublime/sublime.plugin.zsh | 2 +- plugins/zsh-navigation-tools/_n-kill | 4 ++-- plugins/zsh-navigation-tools/n-kill | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/theme-and-appearance.zsh b/lib/theme-and-appearance.zsh index 12bcd2849..039a59d2a 100644 --- a/lib/theme-and-appearance.zsh +++ b/lib/theme-and-appearance.zsh @@ -6,11 +6,11 @@ export LSCOLORS="Gxfxcxdxbxegedabagacad" if [[ "$DISABLE_LS_COLORS" != "true" ]]; then # Find the option for using colors in ls, depending on the version - if [[ "$(uname -s)" == "NetBSD" ]]; then + if [[ "$OSTYPE" == netbsd* ]]; then # On NetBSD, test if "gls" (GNU ls) is installed (this one supports colors); # otherwise, leave ls as is, because NetBSD's ls doesn't support -G gls --color -d . &>/dev/null && alias ls='gls --color=tty' - elif [[ "$(uname -s)" == "OpenBSD" ]]; then + elif [[ "$OSTYPE" == openbsd* ]]; then # On OpenBSD, "gls" (ls from GNU coreutils) and "colorls" (ls from base, # with color and multibyte support) are available from ports. "colorls" # will be installed on purpose and can't be pulled in by installing diff --git a/plugins/battery/battery.plugin.zsh b/plugins/battery/battery.plugin.zsh index 0bb9e77f0..da229cf35 100644 --- a/plugins/battery/battery.plugin.zsh +++ b/plugins/battery/battery.plugin.zsh @@ -64,7 +64,7 @@ if [[ "$OSTYPE" = darwin* ]] ; then [[ $(ioreg -rc "AppleSmartBattery"| grep '^.*"IsCharging"\ =\ ' | sed -e 's/^.*"IsCharging"\ =\ //') == "Yes" ]] } -elif [[ $(uname) == "Linux" ]] ; then +elif [[ "$OSTYPE" = linux* ]] ; then function battery_is_charging() { ! [[ $(acpi 2>/dev/null | grep -c '^Battery.*Discharging') -gt 0 ]] diff --git a/plugins/gitfast/git-completion.bash b/plugins/gitfast/git-completion.bash index e3918c87e..8ce6b5c5f 100644 --- a/plugins/gitfast/git-completion.bash +++ b/plugins/gitfast/git-completion.bash @@ -2771,6 +2771,6 @@ __git_complete gitk __gitk_main # when the user has tab-completed the executable name and consequently # included the '.exe' suffix. # -if [ Cygwin = "$(uname -o 2>/dev/null)" ]; then +if [[ "$OSTYPE" = cygwin* ]]; then __git_complete git.exe __git_main fi diff --git a/plugins/sublime/sublime.plugin.zsh b/plugins/sublime/sublime.plugin.zsh index 75a39eab1..f84b7032a 100644 --- a/plugins/sublime/sublime.plugin.zsh +++ b/plugins/sublime/sublime.plugin.zsh @@ -1,4 +1,4 @@ -if [[ $('uname') == 'Linux' ]]; then +if [[ "$OSTYPE" == linux* ]]; then local _sublime_linux_paths > /dev/null 2>&1 _sublime_linux_paths=( "$HOME/bin/sublime_text" diff --git a/plugins/zsh-navigation-tools/_n-kill b/plugins/zsh-navigation-tools/_n-kill index 8a4ec9da7..6f5d47971 100644 --- a/plugins/zsh-navigation-tools/_n-kill +++ b/plugins/zsh-navigation-tools/_n-kill @@ -10,8 +10,8 @@ integer cygwin=0 local IFS=" " -case "$(uname)" in - CYGWIN*) list=( `command ps -Wa` ); cygwin=1 ;; +case "$OSTYPE" in + cygwin*) list=( `command ps -Wa` ); cygwin=1 ;; *) list=( `command ps -o pid,uid,command -A` ) ;; esac diff --git a/plugins/zsh-navigation-tools/n-kill b/plugins/zsh-navigation-tools/n-kill index 0d10565e4..76050f969 100644 --- a/plugins/zsh-navigation-tools/n-kill +++ b/plugins/zsh-navigation-tools/n-kill @@ -42,8 +42,8 @@ NLIST_NONSELECTABLE_ELEMENTS=( 1 ) type ps 2>/dev/null 1>&2 || { echo >&2 "Error: \`ps' not found"; return 1 } -case "$(uname)" in - CYGWIN*) list=( `command ps -Wa` ) ;; +case "$OSTYPE" in + cygwin*) list=( `command ps -Wa` ) ;; *) list=( `command ps -o pid,uid,command -A` ) ;; esac From f7d4f985ac391e4532a5e6331e0c296fad4a913c Mon Sep 17 00:00:00 2001 From: Hong Date: Mon, 10 Oct 2016 14:01:37 -0700 Subject: [PATCH 0084/1083] Use $+commands to check the existence of a command in clipboard.zsh. (#5519) --- lib/clipboard.zsh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/clipboard.zsh b/lib/clipboard.zsh index b663800a4..2c93d1bb5 100644 --- a/lib/clipboard.zsh +++ b/lib/clipboard.zsh @@ -31,13 +31,13 @@ function clipcopy() { cat $file > /dev/clipboard fi else - if which xclip &>/dev/null; then + if (( $+commands[xclip] )); then if [[ -z $file ]]; then xclip -in -selection clipboard else xclip -in -selection clipboard $file fi - elif which xsel &>/dev/null; then + elif (( $+commands[xsel] )); then if [[ -z $file ]]; then xsel --clipboard --input else @@ -74,9 +74,9 @@ function clippaste() { elif [[ $OSTYPE == cygwin* ]]; then cat /dev/clipboard else - if which xclip &>/dev/null; then + if (( $+commands[xclip] )); then xclip -out -selection clipboard - elif which xsel &>/dev/null; then + elif (( $+commands[xsel] )); then xsel --clipboard --output else print "clipcopy: Platform $OSTYPE not supported or xclip/xsel not installed" >&2 From 628d0bb10664453fe55c1e725ab89fa42dc4ab0a Mon Sep 17 00:00:00 2001 From: rossmcf Date: Mon, 10 Oct 2016 15:42:55 +0100 Subject: [PATCH 0085/1083] Fix ls colouring for Darwin. (#5516) --- lib/theme-and-appearance.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/theme-and-appearance.zsh b/lib/theme-and-appearance.zsh index 039a59d2a..0fd3c44db 100644 --- a/lib/theme-and-appearance.zsh +++ b/lib/theme-and-appearance.zsh @@ -6,7 +6,7 @@ export LSCOLORS="Gxfxcxdxbxegedabagacad" if [[ "$DISABLE_LS_COLORS" != "true" ]]; then # Find the option for using colors in ls, depending on the version - if [[ "$OSTYPE" == netbsd* ]]; then + if [[ "$OSTYPE" == netbsd* ]] || [[ "$OSTYPE" == darwin* ]]; then # On NetBSD, test if "gls" (GNU ls) is installed (this one supports colors); # otherwise, leave ls as is, because NetBSD's ls doesn't support -G gls --color -d . &>/dev/null && alias ls='gls --color=tty' From c24dfa1ab4abb1f28fad7666f3bc24f3abced801 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Tue, 11 Oct 2016 09:24:43 +0200 Subject: [PATCH 0086/1083] Fix ls coloring in MacOS if gls is not installed Fixes #5520. --- lib/theme-and-appearance.zsh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/theme-and-appearance.zsh b/lib/theme-and-appearance.zsh index 0fd3c44db..467b770d6 100644 --- a/lib/theme-and-appearance.zsh +++ b/lib/theme-and-appearance.zsh @@ -6,7 +6,7 @@ export LSCOLORS="Gxfxcxdxbxegedabagacad" if [[ "$DISABLE_LS_COLORS" != "true" ]]; then # Find the option for using colors in ls, depending on the version - if [[ "$OSTYPE" == netbsd* ]] || [[ "$OSTYPE" == darwin* ]]; then + if [[ "$OSTYPE" == netbsd* ]]; then # On NetBSD, test if "gls" (GNU ls) is installed (this one supports colors); # otherwise, leave ls as is, because NetBSD's ls doesn't support -G gls --color -d . &>/dev/null && alias ls='gls --color=tty' @@ -17,6 +17,8 @@ if [[ "$DISABLE_LS_COLORS" != "true" ]]; then # coreutils, so prefer it to "gls". gls --color -d . &>/dev/null && alias ls='gls --color=tty' colorls -G -d . &>/dev/null && alias ls='colorls -G' + elif [[ "$OSTYPE" == darwin* ]]; then + gls --color -d . &>/dev/null && alias ls='gls --color=tty' || alias ls='ls -G' else # For GNU ls, we use the default ls color theme. They can later be overwritten by themes. if [[ -z "$LS_COLORS" ]]; then From c861430d3e8ff202b84b2a89c3caa6e414e2f8c1 Mon Sep 17 00:00:00 2001 From: Chenje Katanda Date: Thu, 13 Oct 2016 17:33:44 -0400 Subject: [PATCH 0087/1083] readme change OS X to macOS Change OS X to macOS in the read me file in line with apples rebranding of the operating system. --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6da731890..2b0856c2d 100644 --- a/README.md +++ b/README.md @@ -18,9 +18,9 @@ To learn more, visit [ohmyz.sh](http://ohmyz.sh) and follow [@ohmyzsh](https://t ### Prerequisites -__Disclaimer:__ _Oh My Zsh works best on OS X and Linux._ +__Disclaimer:__ _Oh My Zsh works best on macOS and Linux._ -* Unix-based operating system (OS X or Linux) +* Unix-based operating system (macOS or Linux) * [Zsh](http://www.zsh.org) should be installed (v4.3.9 or more recent). If not pre-installed (`zsh --version` to confirm), check the following instruction here: [Installing ZSH](https://github.com/robbyrussell/oh-my-zsh/wiki/Installing-ZSH) * `curl` or `wget` should be installed * `git` should be installed From 015598b8a82457a03ab9d75f770bbd333599a601 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Mon, 10 Oct 2016 20:33:40 +0200 Subject: [PATCH 0088/1083] Display suvash prompt w/o Ruby; refactor code --- themes/suvash.zsh-theme | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/themes/suvash.zsh-theme b/themes/suvash.zsh-theme index c87f64558..1680973df 100644 --- a/themes/suvash.zsh-theme +++ b/themes/suvash.zsh-theme @@ -5,26 +5,30 @@ function prompt_char { } function virtualenv_info { - [ $VIRTUAL_ENV ] && echo '('`basename $VIRTUAL_ENV`') ' + [[ -n "$VIRTUAL_ENV" ]] && echo '('${VIRTUAL_ENV:t}') ' } -function collapse_pwd { - echo $(pwd | sed -e "s,^$HOME,~,") +function ruby_prompt { + if (( $+commands[rvm-prompt] )); then + print -n $ZSH_THEME_RUBY_PROMPT_PREFIX + print -n $(~/.rvm/bin/rvm-prompt) + print -n $ZSH_THEME_RUBY_PROMPT_SUFFIX + elif (( $+commands[rbenv] )); then + print -n $ZSH_THEME_RUBY_PROMPT_PREFIX + print -n $(rbenv version | sed -e "s/ (set.*$//") + print -n $ZSH_THEME_RUBY_PROMPT_SUFFIX + fi + return 0 } -if which rvm-prompt &> /dev/null; then - PROMPT='%{$fg[magenta]%}%n%{$reset_color%} at %{$fg[yellow]%}%m%{$reset_color%} in %{$fg_bold[green]%}${PWD/#$HOME/~}%{$reset_color%}$(git_prompt_info) using %{$reset_color%}%{$fg[red]%}$(~/.rvm/bin/rvm-prompt)%{$reset_color%} -$(virtualenv_info)$(prompt_char) ' -else - if which rbenv &> /dev/null; then - PROMPT='%{$fg[magenta]%}%n%{$reset_color%} at %{$fg[yellow]%}%m%{$reset_color%} in %{$fg_bold[green]%}${PWD/#$HOME/~}%{$reset_color%}$(git_prompt_info) using %{$reset_color%}%{$fg[red]%}$(rbenv version | sed -e "s/ (set.*$//")%{$reset_color%} -$(virtualenv_info)$(prompt_char) ' - fi -fi +PROMPT='%F{magenta}%n%f at %F{yellow}%m%f in %B%F{green}%~%f%b$(git_prompt_info)$(ruby_prompt) +$(virtualenv_info) $(prompt_char) ' +ZSH_THEME_GIT_PROMPT_PREFIX=' on %F{magenta}' +ZSH_THEME_GIT_PROMPT_SUFFIX='%f' +ZSH_THEME_GIT_PROMPT_DIRTY='%F{green}!' +ZSH_THEME_GIT_PROMPT_UNTRACKED='%F{green}?' +ZSH_THEME_GIT_PROMPT_CLEAN='' -ZSH_THEME_GIT_PROMPT_PREFIX=" on %{$fg[magenta]%}" -ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[green]%}!" -ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[green]%}?" -ZSH_THEME_GIT_PROMPT_CLEAN="" +ZSH_THEME_RUBY_PROMPT_PREFIX=' using %F{red}' +ZSH_THEME_RUBY_PROMPT_SUFFIX='%f' From cff228e342a797b6ac0da7edb431f5f66de79ae4 Mon Sep 17 00:00:00 2001 From: Jocelyn Thode Date: Sat, 15 Oct 2016 14:02:01 +0200 Subject: [PATCH 0089/1083] Update bira theme (#4954) * Add '#' instead of '$' when in root * Make return code bold --- themes/bira.zsh-theme | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/themes/bira.zsh-theme b/themes/bira.zsh-theme index 1ead93553..4b2853c32 100644 --- a/themes/bira.zsh-theme +++ b/themes/bira.zsh-theme @@ -4,8 +4,10 @@ local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" if [[ $UID -eq 0 ]]; then local user_host='%{$terminfo[bold]$fg[red]%}%n@%m%{$reset_color%}' + local user_symbol='#' else local user_host='%{$terminfo[bold]$fg[green]%}%n@%m%{$reset_color%}' + local user_symbol='$' fi local current_dir='%{$terminfo[bold]$fg[blue]%} %~%{$reset_color%}' @@ -20,8 +22,9 @@ fi local git_branch='$(git_prompt_info)%{$reset_color%}' PROMPT="╭─${user_host} ${current_dir} ${rvm_ruby} ${git_branch} -╰─%B$%b " -RPS1="${return_code}" +╰─%B${user_symbol}%b " +RPS1="%B${return_code}%b" ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}‹" ZSH_THEME_GIT_PROMPT_SUFFIX="› %{$reset_color%}" + From 5cd7ad38cbb691c70377b5c82d3de5b0af076164 Mon Sep 17 00:00:00 2001 From: kennyklee Date: Mon, 17 Oct 2016 01:00:14 -0700 Subject: [PATCH 0090/1083] Fix regex for optional http(s), and variable reference inside osascript. --- plugins/droplr/droplr.plugin.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/droplr/droplr.plugin.zsh b/plugins/droplr/droplr.plugin.zsh index 296a8b98b..af0a21299 100644 --- a/plugins/droplr/droplr.plugin.zsh +++ b/plugins/droplr/droplr.plugin.zsh @@ -7,8 +7,8 @@ droplr() { return 1 fi - if [[ "$1" =~ ^http[|s]:// ]]; then - osascript -e "tell app 'Droplr' to shorten '$1'" + if [[ "$1" =~ ^https?:// ]]; then + osascript -e 'tell app "Droplr" to shorten "'"$1"'"' else open -ga /Applications/Droplr.app "$1" fi From 7d8618ec9a3a311a8df3cd2062e7fb2277fb8604 Mon Sep 17 00:00:00 2001 From: Sayalee Pote Date: Tue, 18 Oct 2016 00:57:58 +0530 Subject: [PATCH 0091/1083] Update README with grammar corrections (#5503) --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 2b0856c2d..c304c75d3 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,7 @@ Oh My Zsh comes with a shit load of plugins to take advantage of. You can take a #### Enabling Plugins -If you spot a plugin (or several) that you would like to use with Oh My Zsh, you will need to edit the `~/.zshrc` file. Once you open it with your favorite editor, you'll see a spot to list all the plugins that you'd like Oh My Zsh to load in initialization. +If you spot a plugin (or several) that you would like to use with Oh My Zsh, you will need to edit the `~/.zshrc` file. Once you open it with your favorite editor, you'll see a spot to list all the plugins that you'd like Oh My Zsh to load on initialization. For example, this line might begin to look like... @@ -67,7 +67,7 @@ We'll admit it. Early in the Oh My Zsh world, we may have gotten a bit too theme #### Selecting a Theme -_Robby's theme is the default one. It's not the fanciest one. It's not the simplest one. It's just right (for him)._ +_Robby's theme is the default one. It's not the fanciest one. It's not the simplest one. It's just the right one (for him)._ Once you find a theme that you want to use, you will need to edit the `~/.zshrc` file. You'll see an environment variable (all caps) in there that looks like: @@ -81,7 +81,7 @@ To use a different theme, simply change the value to match the name of your desi ZSH_THEME="agnoster" # (this is one of the fancy ones) ``` -Open up a new terminal window and your prompt should look something like... +Open up a new terminal window and your prompt should look something like this: ![Agnoster theme](https://cloud.githubusercontent.com/assets/2618447/6316862/70f58fb6-ba03-11e4-82c9-c083bf9a6574.png) @@ -129,7 +129,7 @@ cp ~/.zshrc ~/.zshrc.orig ##### 3. Create a new zsh configuration file -You can create a new zsh config file by copying the template that we included for you. +You can create a new zsh config file by copying the template that we have included for you. ```shell cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc @@ -208,7 +208,7 @@ Thank you so much! ## Follow Us -We're on the social medias. +We're on the social media. * [@ohmyzsh](https://twitter.com/ohmyzsh) on Twitter. You should follow it. * [Oh My Zsh](https://www.facebook.com/Oh-My-Zsh-296616263819290/) on Facebook. From f94d4e6a4019ed7fcc5470655b1154b3d1f67913 Mon Sep 17 00:00:00 2001 From: Mason Date: Tue, 18 Oct 2016 13:42:27 -0500 Subject: [PATCH 0092/1083] Change from OSX to macOS in README (#5545) --- oh-my-zsh.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index ed258f0ea..a7de646f2 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -53,7 +53,7 @@ done # Figure out the SHORT hostname if [[ "$OSTYPE" = darwin* ]]; then - # OS X's $HOST changes with dhcp, etc. Use ComputerName if possible. + # macOS's $HOST changes with dhcp, etc. Use ComputerName if possible. SHORT_HOST=$(scutil --get ComputerName 2>/dev/null) || SHORT_HOST=${HOST/.*/} else SHORT_HOST=${HOST/.*/} From 37bf9186a03a4e15dcccd1da76b9c6f597cc8e71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Tue, 25 Oct 2016 05:43:11 +0200 Subject: [PATCH 0093/1083] Update docker completion (2015-10-25) Closes #5568 Source: https://github.com/docker/docker/commit/c9fdf9abf8d6443598808809b900d96e04adfcb1 --- plugins/docker/_docker | 53 ++++++++++++++++++++++++++++-------------- 1 file changed, 36 insertions(+), 17 deletions(-) diff --git a/plugins/docker/_docker b/plugins/docker/_docker index 1366fd61b..415e731f3 100644 --- a/plugins/docker/_docker +++ b/plugins/docker/_docker @@ -57,7 +57,7 @@ __docker_get_containers() { type=$1; shift [[ $kind = (stopped|all) ]] && args=($args -a) - lines=(${(f)"$(_call_program commands docker $docker_options ps --format 'table' --no-trunc $args)"}) + lines=(${(f)${:-"$(_call_program commands docker $docker_options ps --format 'table' --no-trunc $args)"$'\n'}}) # Parse header line to find columns local i=1 j=1 k header=${lines[1]} @@ -153,7 +153,7 @@ __docker_images() { [[ $PREFIX = -* ]] && return 1 integer ret=1 declare -a images - images=(${${${(f)"$(_call_program commands docker $docker_options images)"}[2,-1]}/(#b)([^ ]##) ##([^ ]##) ##([^ ]##)*/${match[3]}:${(r:15:: :::)match[2]} in ${match[1]}}) + images=(${${${(f)${:-"$(_call_program commands docker $docker_options images)"$'\n'}}[2,-1]}/(#b)([^ ]##) ##([^ ]##) ##([^ ]##)*/${match[3]}:${(r:15:: :::)match[2]} in ${match[1]}}) _describe -t docker-images "images" images && ret=0 __docker_repositories_with_tags && ret=0 return ret @@ -162,7 +162,7 @@ __docker_images() { __docker_repositories() { [[ $PREFIX = -* ]] && return 1 declare -a repos - repos=(${${${(f)"$(_call_program commands docker $docker_options images)"}%% *}[2,-1]}) + repos=(${${${(f)${:-"$(_call_program commands docker $docker_options images)"$'\n'}}%% *}[2,-1]}) repos=(${repos#}) _describe -t docker-repos "repositories" repos } @@ -172,7 +172,7 @@ __docker_repositories_with_tags() { integer ret=1 declare -a repos onlyrepos matched declare m - repos=(${${${${(f)"$(_call_program commands docker $docker_options images)"}[2,-1]}/ ##/:::}%% *}) + repos=(${${${${(f)${:-"$(_call_program commands docker $docker_options images)"$'\n'}}[2,-1]}/ ##/:::}%% *}) repos=(${${repos%:::}#}) # Check if we have a prefix-match for the current prefix. onlyrepos=(${repos%::*}) @@ -208,7 +208,7 @@ __docker_search() { if ( [[ ${(P)+cachename} -eq 0 ]] || _cache_invalid ${cachename#_} ) \ && ! _retrieve_cache ${cachename#_}; then _message "Searching for ${searchterm}..." - result=(${${${(f)"$(_call_program commands docker $docker_options search $searchterm)"}%% *}[2,-1]}) + result=(${${${(f)${:-"$(_call_program commands docker $docker_options search $searchterm)"$'\n'}}%% *}[2,-1]}) _store_cache ${cachename#_} result fi _wanted dockersearch expl 'available images' compadd -a result @@ -219,7 +219,7 @@ __docker_get_log_options() { integer ret=1 local log_driver=${opt_args[--log-driver]:-"all"} - local -a awslogs_options fluentd_options gelf_options journald_options json_file_options syslog_options splunk_options + local -a awslogs_options fluentd_options gelf_options journald_options json_file_options logentries_options syslog_options splunk_options awslogs_options=("awslogs-region" "awslogs-group" "awslogs-stream") fluentd_options=("env" "fluentd-address" "fluentd-async-connect" "fluentd-buffer-limit" "fluentd-retry-wait" "fluentd-max-retries" "labels" "tag") @@ -227,6 +227,7 @@ __docker_get_log_options() { gelf_options=("env" "gelf-address" "gelf-compression-level" "gelf-compression-type" "labels" "tag") journald_options=("env" "labels" "tag") json_file_options=("env" "labels" "max-file" "max-size") + logentries_options=("logentries-token") syslog_options=("env" "labels" "syslog-address" "syslog-facility" "syslog-format" "syslog-tls-ca-cert" "syslog-tls-cert" "syslog-tls-key" "syslog-tls-skip-verify" "tag") splunk_options=("env" "labels" "splunk-caname" "splunk-capath" "splunk-format" "splunk-gzip" "splunk-gzip-level" "splunk-index" "splunk-insecureskipverify" "splunk-source" "splunk-sourcetype" "splunk-token" "splunk-url" "splunk-verify-connection" "tag") @@ -236,6 +237,7 @@ __docker_get_log_options() { [[ $log_driver = (gelf|all) ]] && _describe -t gelf-options "gelf options" gelf_options "$@" && ret=0 [[ $log_driver = (journald|all) ]] && _describe -t journald-options "journald options" journald_options "$@" && ret=0 [[ $log_driver = (json-file|all) ]] && _describe -t json-file-options "json-file options" json_file_options "$@" && ret=0 + [[ $log_driver = (logentries|all) ]] && _describe -t logentries-options "logentries options" logentries_options "$@" && ret=0 [[ $log_driver = (syslog|all) ]] && _describe -t syslog-options "syslog options" syslog_options "$@" && ret=0 [[ $log_driver = (splunk|all) ]] && _describe -t splunk-options "splunk options" splunk_options "$@" && ret=0 @@ -333,6 +335,9 @@ __docker_complete_ps_filters() { (id) __docker_containers_ids && ret=0 ;; + (is-task) + _describe -t boolean-filter-opts "filter options" boolean_opts && ret=0 + ;; (name) __docker_containers_names && ret=0 ;; @@ -504,7 +509,7 @@ __docker_get_networks() { type=$1; shift - lines=(${(f)"$(_call_program commands docker $docker_options network ls)"}) + lines=(${(f)${:-"$(_call_program commands docker $docker_options network ls)"$'\n'}}) # Parse header line to find columns local i=1 j=1 k header=${lines[1]} @@ -720,7 +725,7 @@ __docker_nodes() { filter=$1; shift [[ $filter != "none" ]] && args=("-f $filter") - lines=(${(f)"$(_call_program commands docker $docker_options node ls $args)"}) + lines=(${(f)${:-"$(_call_program commands docker $docker_options node ls $args)"$'\n'}}) # Parse header line to find columns local i=1 j=1 k header=${lines[1]} declare -A begin end @@ -792,7 +797,7 @@ __docker_node_commands() { "ls:List nodes in the swarm" "promote:Promote a node as manager in the swarm" "rm:Remove one or more nodes from the swarm" - "ps:List tasks running on a node, defaults to current node" + "ps:List tasks running on one or more nodes, defaults to current node" "update:Update a node" ) _describe -t docker-node-commands "docker node command" _docker_node_subcommands @@ -847,7 +852,7 @@ __docker_node_subcommand() { "($help)*"{-f=,--filter=}"[Provide filter values]:filter:->filter-options" \ "($help)--no-resolve[Do not map IDs to Names]" \ "($help)--no-trunc[Do not truncate output]" \ - "($help -)1:node:__docker_complete_nodes" && ret=0 + "($help -)*:node:__docker_complete_nodes" && ret=0 case $state in (filter-options) __docker_node_complete_ps_filters && ret=0 @@ -881,7 +886,7 @@ __docker_complete_plugins() { local line s declare -a lines plugins - lines=(${(f)"$(_call_program commands docker $docker_options plugin ls)"}) + lines=(${(f)${:-"$(_call_program commands docker $docker_options plugin ls)"$'\n'}}) # Parse header line to find columns local i=1 j=1 k header=${lines[1]} @@ -1007,7 +1012,7 @@ __docker_services() { type=$1; shift - lines=(${(f)"$(_call_program commands docker $docker_options service ls)"}) + lines=(${(f)${:-"$(_call_program commands docker $docker_options service ls)"$'\n'}}) # Parse header line to find columns local i=1 j=1 k header=${lines[1]} @@ -1103,6 +1108,8 @@ __docker_service_subcommand() { "($help)--stop-grace-period=[Time to wait before force killing a container]:grace period: " "($help)--update-delay=[Delay between updates]:delay: " "($help)--update-failure-action=[Action on update failure]:mode:(pause continue)" + "($help)--update-max-failure-ratio=[Failure rate to tolerate during an update]:fraction: " + "($help)--update-monitor=[Duration after each task update to monitor for failure]:window: " "($help)--update-parallelism=[Maximum number of tasks updated simultaneously]:number: " "($help -u --user)"{-u=,--user=}"[Username or UID]:user:_users" "($help)--with-registry-auth[Send registry authentication details to swarm agents]" @@ -1178,8 +1185,10 @@ __docker_service_subcommand() { "($help)--arg=[Service command args]:arguments: _normal" \ "($help)*--container-label-add=[Add or update container labels]:label: " \ "($help)*--container-label-rm=[Remove a container label by its key]:label: " \ + "($help)--force[Force update]" \ "($help)*--group-rm=[Remove previously added user groups from the container]:group:_groups" \ "($help)--image=[Service image tag]:image:__docker_repositories" \ + "($help)--rollback[Rollback to previous specification]" \ "($help -)1:service:__docker_complete_services" && ret=0 ;; (help) @@ -1293,7 +1302,7 @@ __docker_volumes() { integer ret=1 declare -a lines volumes - lines=(${(f)"$(_call_program commands docker $docker_options volume ls)"}) + lines=(${(f)${:-"$(_call_program commands docker $docker_options volume ls)"$'\n'}}) # Parse header line to find columns local i=1 j=1 k header=${lines[1]} @@ -1506,6 +1515,7 @@ __docker_subcommand() { $opts_build_create_run \ $opts_build_create_run_update \ "($help)*--build-arg[Build-time variables]:=: " \ + "($help)--compress[Compress the build context using gzip]" \ "($help -f --file)"{-f=,--file=}"[Name of the Dockerfile]:Dockerfile:_files" \ "($help)--force-rm[Always remove intermediate containers]" \ "($help)*--label=[Set metadata for an image]:label=value: " \ @@ -1594,6 +1604,7 @@ __docker_subcommand() { "($help -g --graph)"{-g=,--graph=}"[Root of the Docker runtime]:path:_directories" \ "($help -H --host)"{-H=,--host=}"[tcp://host:port to bind/connect to]:host: " \ "($help)--icc[Enable inter-container communication]" \ + "($help)--init-path=[Path to the docker-init binary]:docker-init binary:_files" \ "($help)*--insecure-registry=[Enable insecure registry communication]:registry: " \ "($help)--ip=[Default IP when binding container ports]" \ "($help)--ip-forward[Enable net.ipv4.ip_forward]" \ @@ -1669,6 +1680,7 @@ __docker_subcommand() { $opts_help \ $opts_attach_exec_run_start \ "($help -d --detach)"{-d,--detach}"[Detached mode: leave the container running in the background]" \ + "($help -e --env)"{-e,--env}"[Set environment variables]" \ "($help -i --interactive)"{-i,--interactive}"[Keep stdin open even if not attached]" \ "($help)--privileged[Give extended Linux capabilities to the command]" \ "($help -t --tty)"{-t,--tty}"[Allocate a pseudo-tty]" \ @@ -1704,7 +1716,7 @@ __docker_subcommand() { "($help -a --all)"{-a,--all}"[Show all images]" \ "($help)--digests[Show digests]" \ "($help)*"{-f=,--filter=}"[Filter values]:filter:->filter-options" \ - "($help)--format[Pretty-print images using a Go template]:template: " \ + "($help)--format=[Pretty-print images using a Go template]:template: " \ "($help)--no-trunc[Do not truncate output]" \ "($help -q --quiet)"{-q,--quiet}"[Only show numeric IDs]" \ "($help -): :__docker_repositories" && ret=0 @@ -1726,7 +1738,7 @@ __docker_subcommand() { (info|version) _arguments $(__docker_arguments) \ $opts_help \ - "($help -f --format)"{-f=,--format=}"[Format the output using the given go template]:template: " && ret=0 + "($help -f --format)"{-f=,--format=}"[Format the output using the given go template]:template: " && ret=0 ;; (inspect) local state @@ -1851,7 +1863,7 @@ __docker_subcommand() { "($help -a --all)"{-a,--all}"[Show all containers]" \ "($help)--before=[Show only container created before...]:containers:__docker_containers" \ "($help)*"{-f=,--filter=}"[Filter values]:filter:__docker_complete_ps_filters" \ - "($help)--format[Pretty-print containers using a Go template]:template: " \ + "($help)--format=[Pretty-print containers using a Go template]:template: " \ "($help -l --latest)"{-l,--latest}"[Show only the latest created container]" \ "($help -n --last)"{-n=,--last=}"[Show n last created containers (includes all states)]:n:(1 5 10 25 50)" \ "($help)--no-trunc[Do not truncate output]" \ @@ -1878,12 +1890,18 @@ __docker_subcommand() { "($help -):old name:__docker_containers" \ "($help -):new name: " && ret=0 ;; - (restart|stop) + (stop) _arguments $(__docker_arguments) \ $opts_help \ "($help -t --time)"{-t=,--time=}"[Number of seconds to try to stop for before killing the container]:seconds to before killing:(1 5 10 30 60)" \ "($help -)*:containers:__docker_runningcontainers" && ret=0 ;; + (restart) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -t --time)"{-t=,--time=}"[Number of seconds to try to stop for before killing the container]:seconds to before killing:(1 5 10 30 60)" \ + "($help -)*:containers:__docker_containers_ids" && ret=0 + ;; (rm) _arguments $(__docker_arguments) \ $opts_help \ @@ -1999,6 +2017,7 @@ __docker_subcommand() { _arguments $(__docker_arguments) \ $opts_help \ "($help -a --all)"{-a,--all}"[Show all containers (default shows just running)]" \ + "($help)--format=[Pretty-print images using a Go template]:template: " \ "($help)--no-stream[Disable streaming stats and only pull the first result]" \ "($help -)*:containers:__docker_runningcontainers" && ret=0 ;; From 3bd6be10769097351156c6460db78b5f529f4b03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Tue, 25 Oct 2016 06:04:08 +0200 Subject: [PATCH 0094/1083] Change link to agnoster wiki + format changes https://github.com/robbyrussell/oh-my-zsh/wiki/Themes#agnoster --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 268c1b39d..5902c419e 100644 --- a/README.md +++ b/README.md @@ -78,9 +78,9 @@ ZSH_THEME="robbyrussell" To use a different theme, simply change the value to match the name of your desired theme. For example: ```shell -ZSH_THEME="agnoster" # (this is one of the fancy ones ; - # you might need to install a specific font on your console's host for this to work ; - # see https://github.com/powerline/fonts/tree/master/DejaVuSansMono) +ZSH_THEME="agnoster" # (this is one of the fancy ones) +# you might need to install a special Powerline font on your console's host for this to work +# see https://github.com/robbyrussell/oh-my-zsh/wiki/Themes#agnoster ``` Open up a new terminal window and your prompt should look something like... From b1efd04f947ca9d391cf36dbca643b3845d8acee Mon Sep 17 00:00:00 2001 From: jotadrilo Date: Tue, 25 Oct 2016 06:25:07 +0200 Subject: [PATCH 0095/1083] add docker-compose down alias (#5557) * add docker-compose down alias * rename `docker-compose down` alias to `dcdn` --- 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 7e3307017..4e4ac114a 100644 --- a/plugins/docker-compose/docker-compose.plugin.zsh +++ b/plugins/docker-compose/docker-compose.plugin.zsh @@ -18,5 +18,6 @@ alias dcrm='docker-compose rm' alias dcr='docker-compose run' alias dcstop='docker-compose stop' alias dcup='docker-compose up' +alias dcdn='docker-compose down' alias dcl='docker-compose logs' alias dclf='docker-compose logs -f' From d9695a8b00c6960417726e49a32df4cf760e055e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Ordon?= Date: Tue, 25 Oct 2016 05:29:35 +0100 Subject: [PATCH 0096/1083] Add more simulator aliases (#5550) --- plugins/react-native/react-native.plugin.zsh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/react-native/react-native.plugin.zsh b/plugins/react-native/react-native.plugin.zsh index 9463a98b3..f19cba820 100644 --- a/plugins/react-native/react-native.plugin.zsh +++ b/plugins/react-native/react-native.plugin.zsh @@ -2,6 +2,8 @@ alias rnand='react-native run-android' alias rnios4s='react-native run-ios --simulator "iPhone 4s"' alias rnios5='react-native run-ios --simulator "iPhone 5"' alias rnios5s='react-native run-ios --simulator "iPhone 5s"' +alias rnios6='react-native run-ios --simulator "iPhone 6"' +alias rnios6s='react-native run-ios --simulator "iPhone 6s"' alias rnios='react-native run-ios' alias rnlink='react-native link' From 0ee89d965ecaa4f32cf2d1039e9d84a73eb206cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Tue, 25 Oct 2016 07:17:29 +0200 Subject: [PATCH 0097/1083] Add brew completion missing disclaimer --- plugins/brew/brew.plugin.zsh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/plugins/brew/brew.plugin.zsh b/plugins/brew/brew.plugin.zsh index 5b5847328..d4289c98e 100644 --- a/plugins/brew/brew.plugin.zsh +++ b/plugins/brew/brew.plugin.zsh @@ -2,3 +2,19 @@ alias brews='brew list -1' alias bubo='brew update && brew outdated' alias bubc='brew upgrade && brew cleanup' alias bubu='bubo && bubc' + +if mkdir "$ZSH_CACHE_DIR/.brew-completion-message" 2>/dev/null; then + print -P '%F{yellow}'Oh My Zsh brew plugin: + cat <<-'EOF' + + With the advent of their 1.0 release, Homebrew has decided to bundle + the zsh completion as part of the brew installation, so we no longer + ship it with the brew plugin; now it only has brew aliases. + + If you find that brew completion no longer works, make sure you have + your Homebrew installation fully up to date. + + You will only see this message once. + EOF + print -P '%f' +fi From dbee3dd9c69c8d2e3299f2f7e7c68fabd06e33c5 Mon Sep 17 00:00:00 2001 From: slavaGanzin Date: Wed, 26 Oct 2016 23:47:51 +0300 Subject: [PATCH 0098/1083] 1. autofetch on zle-line-init 2. GIT_AUTO_FETCH_INTERVAL --- plugins/git-auto-fetch/README.md | 11 ++++++++-- .../git-auto-fetch/git-auto-fetch.plugin.zsh | 20 +++++++++++++++---- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/plugins/git-auto-fetch/README.md b/plugins/git-auto-fetch/README.md index 7f5eac49d..04f1c9445 100644 --- a/plugins/git-auto-fetch/README.md +++ b/plugins/git-auto-fetch/README.md @@ -1,6 +1,6 @@ # Git auto fetch -Automatically fetches all changes from all remotes every time you cd into yout git-initialized project. +Automatically fetches all changes from all remotes while you are working in git-initialized directory. ####Usage Add ```git-auto-fetch``` to the plugins array in your zshrc file: @@ -8,7 +8,14 @@ Add ```git-auto-fetch``` to the plugins array in your zshrc file: plugins=(... git-auto-fetch) ``` -Every time you change directory to your git project all remotes will be fetched in background. Log of ```git fetch --all``` will be saved into .git/FETCH_LOG +Every time you launch a command in your shell all remotes will be fetched in background. +By default autofetch will be triggered only if last fetch was done at least 60 seconds ago. +You can change fetch interval in your .zshrc: +``` +GIT_AUTO_FETCH_INTERVAL=1200 #in seconds +``` +Log of ```git fetch --all``` will be saved into .git/FETCH_LOG + ####Toggle auto fetch per folder If you are using mobile connection or for any other reason you can disable git-auto-fetch for any folder: diff --git a/plugins/git-auto-fetch/git-auto-fetch.plugin.zsh b/plugins/git-auto-fetch/git-auto-fetch.plugin.zsh index 949709e4c..e9946ef3f 100644 --- a/plugins/git-auto-fetch/git-auto-fetch.plugin.zsh +++ b/plugins/git-auto-fetch/git-auto-fetch.plugin.zsh @@ -1,7 +1,10 @@ -function git-fetch-on-chpwd { +GIT_AUTO_FETCH_INTERVAL=${GIT_AUTO_FETCH_INTERVAL:=60} + +function git-fetch-all { (`git rev-parse --is-inside-work-tree 2>/dev/null` && dir=`git rev-parse --git-dir` && [[ ! -f $dir/NO_AUTO_FETCH ]] && + (( `date +%s` - `date -r $dir/FETCH_LOG +%s` > $GIT_AUTO_FETCH_INTERVAL )) && git fetch --all &>! $dir/FETCH_LOG &) } @@ -15,6 +18,15 @@ function git-auto-fetch { echo "${fg_bold[red]}disabled${reset_color}") } -chpwd_functions+=(git-fetch-on-chpwd) -git-fetch-on-chpwd -unset git-fetch-on-chpwd +eval "original-$(declare -f zle-line-init)" + +function zle-line-init () { + git-fetch-all + original-zle-line-init +} +zle -N zle-line-init + +# chpwd_functions+=(git-fetch-on-chpwd) +# git-fetch-on-chpwd +unset git-auto-fetch +unset original-zle-line-init From 41ad705f93bfb1cd75e4c69d1cc936107556b827 Mon Sep 17 00:00:00 2001 From: slavaGanzin Date: Thu, 27 Oct 2016 00:03:31 +0300 Subject: [PATCH 0099/1083] cut comments --- plugins/git-auto-fetch/git-auto-fetch.plugin.zsh | 5 ----- 1 file changed, 5 deletions(-) diff --git a/plugins/git-auto-fetch/git-auto-fetch.plugin.zsh b/plugins/git-auto-fetch/git-auto-fetch.plugin.zsh index e9946ef3f..7dbd63fe1 100644 --- a/plugins/git-auto-fetch/git-auto-fetch.plugin.zsh +++ b/plugins/git-auto-fetch/git-auto-fetch.plugin.zsh @@ -25,8 +25,3 @@ function zle-line-init () { original-zle-line-init } zle -N zle-line-init - -# chpwd_functions+=(git-fetch-on-chpwd) -# git-fetch-on-chpwd -unset git-auto-fetch -unset original-zle-line-init From 80924959c4f41bcebe7b7c667f2d7489bf8fcb74 Mon Sep 17 00:00:00 2001 From: Tanin Rojanapiansatith Date: Fri, 21 Oct 2016 00:35:55 +0100 Subject: [PATCH 0100/1083] Clarify how to open ~/.zshrc file in README.md Closes #5558 --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0e39f4c55..eecde1551 100644 --- a/README.md +++ b/README.md @@ -49,9 +49,9 @@ Oh My Zsh comes with a shit load of plugins to take advantage of. You can take a #### Enabling Plugins -If you spot a plugin (or several) that you would like to use with Oh My Zsh, you will need to edit the `~/.zshrc` file. Once you open it with your favorite editor, you'll see a spot to list all the plugins that you'd like Oh My Zsh to load on initialization. +Once you spot a plugin (or several) that you'd like to use with Oh My Zsh, you'll need to enable them in the `.zshrc` file. You'll find the zshrc file in your `$HOME` directory. Open it with your favorite text editor and you'll see a spot to list all the plugins you want to load. -For example, this line might begin to look like... +For example, this line might begin to look like this: ```shell plugins=(git bundler osx rake ruby) From d47a7221924b4fa0b1859913d505f50a6c276da1 Mon Sep 17 00:00:00 2001 From: Marco De Bortoli Date: Tue, 1 Nov 2016 15:49:50 +1100 Subject: [PATCH 0101/1083] PHP suffix alias should be removed PHP can be executed as CLI script but due to the automated attempt to add browser support to that extension such ability is prevented in certain circumstances. --- plugins/common-aliases/common-aliases.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/common-aliases/common-aliases.plugin.zsh b/plugins/common-aliases/common-aliases.plugin.zsh index 128db6e5f..0908c8a38 100644 --- a/plugins/common-aliases/common-aliases.plugin.zsh +++ b/plugins/common-aliases/common-aliases.plugin.zsh @@ -54,7 +54,7 @@ alias mv='mv -i' # depends on the SUFFIX :) if is-at-least 4.2.0; then # open browser on urls - _browser_fts=(htm html de org net com at cx nl se dk dk php) + _browser_fts=(htm html de org net com at cx nl se dk dk) for ft in $_browser_fts ; do alias -s $ft=$BROWSER ; done _editor_fts=(cpp cxx cc c hh h inl asc txt TXT tex) From fc4e0cd7ba47bc87fe707f2bac8edb3461cfdd36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Wed, 2 Nov 2016 11:02:58 +0100 Subject: [PATCH 0102/1083] common-aliases: check if $BROWSER is defined on browser aliases --- plugins/common-aliases/common-aliases.plugin.zsh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/common-aliases/common-aliases.plugin.zsh b/plugins/common-aliases/common-aliases.plugin.zsh index 0908c8a38..e888ff076 100644 --- a/plugins/common-aliases/common-aliases.plugin.zsh +++ b/plugins/common-aliases/common-aliases.plugin.zsh @@ -54,8 +54,10 @@ alias mv='mv -i' # depends on the SUFFIX :) if is-at-least 4.2.0; then # open browser on urls - _browser_fts=(htm html de org net com at cx nl se dk dk) - for ft in $_browser_fts ; do alias -s $ft=$BROWSER ; done + if [[ -n "$BROWSER" ]]; then + _browser_fts=(htm html de org net com at cx nl se dk dk) + for ft in $_browser_fts ; do alias -s $ft=$BROWSER ; done + fi _editor_fts=(cpp cxx cc c hh h inl asc txt TXT tex) for ft in $_editor_fts ; do alias -s $ft=$EDITOR ; done From cb26c2f6145ab36a2bb3b3d5392959cf741f2608 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Wed, 2 Nov 2016 11:03:47 +0100 Subject: [PATCH 0103/1083] common-aliases: minor style fixes --- plugins/common-aliases/common-aliases.plugin.zsh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/common-aliases/common-aliases.plugin.zsh b/plugins/common-aliases/common-aliases.plugin.zsh index e888ff076..d47b20e40 100644 --- a/plugins/common-aliases/common-aliases.plugin.zsh +++ b/plugins/common-aliases/common-aliases.plugin.zsh @@ -56,17 +56,17 @@ if is-at-least 4.2.0; then # open browser on urls if [[ -n "$BROWSER" ]]; then _browser_fts=(htm html de org net com at cx nl se dk dk) - for ft in $_browser_fts ; do alias -s $ft=$BROWSER ; done + for ft in $_browser_fts; do alias -s $ft=$BROWSER; done fi _editor_fts=(cpp cxx cc c hh h inl asc txt TXT tex) - for ft in $_editor_fts ; do alias -s $ft=$EDITOR ; done + for ft in $_editor_fts; do alias -s $ft=$EDITOR; done _image_fts=(jpg jpeg png gif mng tiff tif xpm) - for ft in $_image_fts ; do alias -s $ft=$XIVIEWER; done + for ft in $_image_fts; do alias -s $ft=$XIVIEWER; done _media_fts=(ape avi flv m4a mkv mov mp3 mpeg mpg ogg ogm rm wav webm) - for ft in $_media_fts ; do alias -s $ft=mplayer ; done + for ft in $_media_fts; do alias -s $ft=mplayer; done #read documents alias -s pdf=acroread From 0f62b7a8d8708910e75fedb9d7b8e3d8559a34da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Wed, 2 Nov 2016 11:17:58 +0100 Subject: [PATCH 0104/1083] common-aliases: check if `$XIVIEWER` is defined and minor fixes --- plugins/common-aliases/common-aliases.plugin.zsh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/plugins/common-aliases/common-aliases.plugin.zsh b/plugins/common-aliases/common-aliases.plugin.zsh index d47b20e40..742798f27 100644 --- a/plugins/common-aliases/common-aliases.plugin.zsh +++ b/plugins/common-aliases/common-aliases.plugin.zsh @@ -55,15 +55,17 @@ alias mv='mv -i' if is-at-least 4.2.0; then # open browser on urls if [[ -n "$BROWSER" ]]; then - _browser_fts=(htm html de org net com at cx nl se dk dk) + _browser_fts=(htm html de org net com at cx nl se dk) for ft in $_browser_fts; do alias -s $ft=$BROWSER; done fi _editor_fts=(cpp cxx cc c hh h inl asc txt TXT tex) for ft in $_editor_fts; do alias -s $ft=$EDITOR; done - _image_fts=(jpg jpeg png gif mng tiff tif xpm) - for ft in $_image_fts; do alias -s $ft=$XIVIEWER; done + if [[ -n "$XIVIEWER" ]]; then + _image_fts=(jpg jpeg png gif mng tiff tif xpm) + for ft in $_image_fts; do alias -s $ft=$XIVIEWER; done + fi _media_fts=(ape avi flv m4a mkv mov mp3 mpeg mpg ogg ogm rm wav webm) for ft in $_media_fts; do alias -s $ft=mplayer; done @@ -85,4 +87,3 @@ fi # Make zsh know about hosts already accessed by SSH zstyle -e ':completion:*:(ssh|scp|sftp|rsh|rsync):hosts' hosts 'reply=(${=${${(f)"$(cat {/etc/ssh_,~/.ssh/known_}hosts(|2)(N) /dev/null)"}%%[# ]*}//,/ })' - From 73591101b6db1e67ad3a0c2f90c81bc8174f4056 Mon Sep 17 00:00:00 2001 From: psprint Date: Wed, 2 Nov 2016 13:08:58 +0100 Subject: [PATCH 0105/1083] znt: Update to v2.2.7 (#5576) --- plugins/zsh-navigation-tools/NEWS | 17 ++++++ plugins/zsh-navigation-tools/README.md | 54 +++++++++++++++++++ plugins/zsh-navigation-tools/n-history | 32 ++++++++--- plugins/zsh-navigation-tools/n-list | 3 +- plugins/zsh-navigation-tools/znt-tmux.zsh | 50 +++++++++++++++++ .../zsh-navigation-tools.plugin.zsh | 35 ++++++------ 6 files changed, 167 insertions(+), 24 deletions(-) create mode 100644 plugins/zsh-navigation-tools/NEWS create mode 100755 plugins/zsh-navigation-tools/znt-tmux.zsh diff --git a/plugins/zsh-navigation-tools/NEWS b/plugins/zsh-navigation-tools/NEWS new file mode 100644 index 000000000..acd9f2ebc --- /dev/null +++ b/plugins/zsh-navigation-tools/NEWS @@ -0,0 +1,17 @@ +------------------------------------- +CHANGES FROM PREVIOUS VERSIONS OF ZNT +------------------------------------- + +Changes from 2.2.1 to 2.2.7 +--------------------------- + +Tmux integration has been added – bind file znt-tmux.zsh in Tmux as +described in README.md and e.g. run local history on remote hosts. Tmux +opens new window with n-history, and pastes selected history entry into +immediate previous window (e.g. a remote session). Fixed plugin.zsh file +to not use (outer scope) positional parameters. This fixes problem with +Grlm's Zsh configuration. The file now doesn't use "test" builtin (but +[[ instead), because it can be shadowed by alias or command. Private +history has been fixed to not overwrite its history file with the same +content. This improves performance when switching to private history +view. diff --git a/plugins/zsh-navigation-tools/README.md b/plugins/zsh-navigation-tools/README.md index 7a679fe67..ed532a161 100644 --- a/plugins/zsh-navigation-tools/README.md +++ b/plugins/zsh-navigation-tools/README.md @@ -34,6 +34,60 @@ want to copy your previous data (from e.g. ~/.zhistory) into the new location. ## News +* 06-10-2016 + - Tmux-integration – Ctrl-b-h in Tmux to open n-history in new window. + Then select history entry, it will be copied to the original Tmux window. + Use this to execute local commands on remote hosts. All that is needed is + this line added to ~/.tmux.conf: + + bind h run-shell -b "$ZNT_REPO_DIR/znt-tmux.zsh" + +* 16-05-2016 + - n-kill has completion. It proposes *words* from what's in `ps -A`. Giving n-kill + arguments means grepping – it will start only with matching `ps` entries. + +* 15-05-2016 + - Fixed problem where zsh-syntax-highlighting could render n-history slow (for + long history entries). + +* 14-05-2016 + - Configuration can be set from zshrc. Example: + + znt_list_instant_select=1 + znt_list_border=0 + znt_list_bold=1 + znt_list_colorpair="green/black" + znt_functions_keywords=( "zplg" "zgen" "match" ) + znt_cd_active_text="underline" + znt_env_nlist_coloring_color=$'\x1b[00;33m' + znt_cd_hotlist=( "~/.config/znt" "/usr/share/zsh/site-functions" "/usr/share/zsh" + "/usr/local/share/zsh/site-functions" "/usr/local/share/zsh" + "/usr/local/bin" ) + +* 10-05-2016 + - Search query rotation – use Ctrl-A to rotate entered words right. + Words `1 2 3` become `3 1 2`. + +* 09-05-2016 + - New feature: n-help tool, available also from n-history via H key. It + displays help screen with various information on ZNT. + +* 08-05-2016 + - Approximate matching – pressing f or Ctrl-F will enter FIX mode, in + which 1 or 2 errors are allowed in what is searched. This utilizes + original Zsh approximate matching features and is intended to be used + after entering search query, when a typo is discovered. + +* 06-05-2016 + - Private history can be edited. Use e key or Ctrl-E for that when in + n-history. Your $EDITOR will start. This is a way to have handy set + of bookmarks prepared in private history's file. + - Border can be disabled. Use following snippet in ~/.config/znt/n-list.conf + or any other tool-targetted config file: + + # Should draw the border? + local border=0 + * 30-04-2016 - New feature: color themes. Use Ctrl-T and Ctrl-G to browse predefined themes. They are listed in ~/.config/znt/n-list.conf. Use the file to diff --git a/plugins/zsh-navigation-tools/n-history b/plugins/zsh-navigation-tools/n-history index af475dcb8..b425ecd10 100644 --- a/plugins/zsh-navigation-tools/n-history +++ b/plugins/zsh-navigation-tools/n-history @@ -307,7 +307,7 @@ while (( 1 )); do elif [ "$active_view" = "1" ]; then if [ -s "$private_history_db" ]; then local title=$'\x1b[00;32m'"Private history:"$'\x1b[00;00m\0' - () { fc -ap -R "$private_history_db"; list=( "$title" ${history[@]} ) } + () { fc -Rap "$private_history_db" 20000 0; list=( "$title" ${history[@]} ) } else list=( "Private history - history entries selected via this tool will be put here" ) fi @@ -335,21 +335,37 @@ done if [ "$REPLY" -gt 0 ]; then selected="$reply[REPLY]" + + # Append to private history + if [[ "$active_view" = "0" ]]; then + local newline=$'\n' + local selected_ph="${selected//$newline/\\$newline}" + print -r -- "$selected_ph" >> "$private_history_db" + fi + + # TMUX? + if [[ "$ZNT_TMUX_MODE" = "1" ]]; then + tmux send -t "$ZNT_TMUX_ORIGIN_SESSION:$ZNT_TMUX_ORIGIN_WINDOW.$ZNT_TMUX_ORIGIN_PANE" "$selected" + tmux kill-window + return 0 # ZLE? - if [ "${(t)CURSOR}" = "integer-local-special" ]; then + elif [ "${(t)CURSOR}" = "integer-local-special" ]; then zle .redisplay zle .kill-buffer LBUFFER+="$selected" - - # Append to private history - local newline=$'\n' - selected="${selected//$newline/\\$newline}" - [ "$active_view" = "0" ] && print -r -- "$selected" >> "$private_history_db" else print -zr -- "$selected" fi else - [ "${(t)CURSOR}" = "integer-local-special" ] && zle redisplay + # TMUX? + if [[ "$ZNT_TMUX_MODE" = "1" ]]; then + tmux kill-window + # ZLE? + elif [[ "${(t)CURSOR}" = "integer-local-special" ]]; then + zle redisplay + fi fi +return 0 + # vim: set filetype=zsh: diff --git a/plugins/zsh-navigation-tools/n-list b/plugins/zsh-navigation-tools/n-list index f3d2e5b3e..3fe5542a6 100644 --- a/plugins/zsh-navigation-tools/n-list +++ b/plugins/zsh-navigation-tools/n-list @@ -310,8 +310,9 @@ while (( 1 )); do colsearch_pattern="${search_buffer// ##/|(#a2)}" list=( "${(@M)list:#(#ia2)*$~search_pattern*}" ) else - # Patterns will be *foo*~^*bar* and (foo|bar) + # Pattern will be *foo*~^*bar* (inventor: Mikael Magnusson) search_pattern="${search_buffer// ##/*~^*}" + # Pattern will be (foo|bar) colsearch_pattern="${search_buffer// ##/|}" list=( "${(@M)list:#(#i)*$~search_pattern*}" ) fi diff --git a/plugins/zsh-navigation-tools/znt-tmux.zsh b/plugins/zsh-navigation-tools/znt-tmux.zsh new file mode 100755 index 000000000..6a96e97a1 --- /dev/null +++ b/plugins/zsh-navigation-tools/znt-tmux.zsh @@ -0,0 +1,50 @@ +#!/usr/bin/env zsh + +# Copyright (c) 2016, Zsolt Lengyel +# Modifications copyright (c) 2016, Sebastian Gniazdowski + +# +# This script opens a new, temporary tmux pane and runs n-history. When +# a selection is made, the result (history entry) is pasted back into +# original tmux pane, and the temporary pane is closed. This allows to +# use local history on remote machines. +# +# To use, put this line to your ~/.tmux.conf. The tool is invoked with: +# Ctrl+b h +# +# bind h run-shell -b "$ZNT_REPO_DIR/znt-tmux.zsh" +# + +# get and save the current active tmux pane id +active_pane=$(tmux display -p -F ':#{session_id}:#I:#P:#{pane_active}:#{window_active}:#{session_attached}' ) +a_active_pane=("${(@s/:/)active_pane}") + +active_session=${a_active_pane[2]//$} +active_window=$a_active_pane[3] +active_pane=$a_active_pane[4] + +# set variables for upcoming window +tmux setenv -t $active_session:$active_window.$active_pane "ZNT_TMUX_MODE" 1 +tmux setenv -t $active_session:$active_window.$active_pane "ZNT_TMUX_ORIGIN_SESSION" "$active_session" +tmux setenv -t $active_session:$active_window.$active_pane "ZNT_TMUX_ORIGIN_WINDOW" "$active_window" +tmux setenv -t $active_session:$active_window.$active_pane "ZNT_TMUX_ORIGIN_PANE" "$active_pane" + +# create a new window in the active session and call it znt-hist +tmux new-window -t $active_session: -n znt-hist + +# unset the variables, so only above single window has them +tmux setenv -u -t $active_session:$active_window.$active_pane "ZNT_TMUX_MODE" +tmux setenv -u -t $active_session:$active_window.$active_pane "ZNT_TMUX_ORIGIN_SESSION" +tmux setenv -u -t $active_session:$active_window.$active_pane "ZNT_TMUX_ORIGIN_WINDOW" +tmux setenv -u -t $active_session:$active_window.$active_pane "ZNT_TMUX_ORIGIN_PANE" + +# znt's session id +znt_active_pane=$(tmux display -p -F ':#{session_id}:#I:#P:#{pane_active}:#{window_active}:#{session_attached}' ) +znt_a_active_pane=("${(@s/:/)znt_active_pane}") + +znt_active_session=${znt_a_active_pane[2]//$} +znt_active_window=$znt_a_active_pane[3] +znt_active_pane=$znt_a_active_pane[4] + +# call znt +tmux send -t "$znt_active_session:$znt_active_window.$znt_active_pane" n-history ENTER diff --git a/plugins/zsh-navigation-tools/zsh-navigation-tools.plugin.zsh b/plugins/zsh-navigation-tools/zsh-navigation-tools.plugin.zsh index b26549152..32b4ca064 100755 --- a/plugins/zsh-navigation-tools/zsh-navigation-tools.plugin.zsh +++ b/plugins/zsh-navigation-tools/zsh-navigation-tools.plugin.zsh @@ -1,38 +1,43 @@ #!/usr/bin/env zsh -REPO_DIR="${0%/*}" -CONFIG_DIR="$HOME/.config/znt" +0="${(%):-%N}" # this gives immunity to functionargzero being unset +export ZNT_REPO_DIR="${0%/*}" +export ZNT_CONFIG_DIR="$HOME/.config/znt" # # Copy configs # -if ! test -d "$HOME/.config"; then - mkdir "$HOME/.config" +if [[ ! -d "$HOME/.config" ]]; then + command mkdir "$HOME/.config" fi -if ! test -d "$CONFIG_DIR"; then - mkdir "$CONFIG_DIR" +if [[ ! -d "$ZNT_CONFIG_DIR" ]]; then + command mkdir "$ZNT_CONFIG_DIR" fi # 9 files -set n-aliases.conf n-env.conf n-history.conf n-list.conf n-panelize.conf n-cd.conf n-functions.conf n-kill.conf n-options.conf +unset __ZNT_CONFIG_FILES +typeset -ga __ZNT_CONFIG_FILES +set +A __ZNT_CONFIG_FILES n-aliases.conf n-env.conf n-history.conf n-list.conf n-panelize.conf n-cd.conf n-functions.conf n-kill.conf n-options.conf # Check for random 2 files if they exist # This will shift 0 - 7 elements -shift $(( RANDOM % 8 )) -if ! test -f "$CONFIG_DIR/$1" || ! test -f "$CONFIG_DIR/$2"; then +shift $(( RANDOM % 8 )) __ZNT_CONFIG_FILES +if [[ ! -f "$ZNT_CONFIG_DIR/${__ZNT_CONFIG_FILES[1]}" || ! -f "$ZNT_CONFIG_DIR/${__ZNT_CONFIG_FILES[2]}" ]]; then # Something changed - examine every file - set n-aliases.conf n-env.conf n-history.conf n-list.conf n-panelize.conf n-cd.conf n-functions.conf n-kill.conf n-options.conf - for i; do - if ! test -f "$CONFIG_DIR/$i"; then - cp "$REPO_DIR/.config/znt/$i" "$CONFIG_DIR" + set +A __ZNT_CONFIG_FILES n-aliases.conf n-env.conf n-history.conf n-list.conf n-panelize.conf n-cd.conf n-functions.conf n-kill.conf n-options.conf + unset __ZNT_CONFIG_FILE + typeset -g __ZNT_CONFIG_FILE + for __ZNT_CONFIG_FILE in "${__ZNT_CONFIG_FILES[@]}"; do + if [[ ! -f "$ZNT_CONFIG_DIR/$__ZNT_CONFIG_FILE" ]]; then + command cp "$ZNT_REPO_DIR/.config/znt/$__ZNT_CONFIG_FILE" "$ZNT_CONFIG_DIR" fi done + unset __ZNT_CONFIG_FILE fi -# Don't leave positional parameters being set -set -- +unset __ZNT_CONFIG_FILES # # Load functions From 1b799e9762067f912c0eb807cd5a55d8f122adfd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Wed, 2 Nov 2016 15:39:28 +0100 Subject: [PATCH 0106/1083] Check dircolors settings before using gls on darwin (#5570) `gls` seems to be installed by default or on most macOS systems, but its default color scheme sucks. This fix will make sure to only use it if it has been customised prior to running OMZ. Related: #5516, #5520. --- lib/theme-and-appearance.zsh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/theme-and-appearance.zsh b/lib/theme-and-appearance.zsh index 467b770d6..122e3fecb 100644 --- a/lib/theme-and-appearance.zsh +++ b/lib/theme-and-appearance.zsh @@ -4,6 +4,8 @@ autoload -U colors && colors # Enable ls colors export LSCOLORS="Gxfxcxdxbxegedabagacad" +# TODO organise this chaotic logic + if [[ "$DISABLE_LS_COLORS" != "true" ]]; then # Find the option for using colors in ls, depending on the version if [[ "$OSTYPE" == netbsd* ]]; then @@ -18,7 +20,12 @@ if [[ "$DISABLE_LS_COLORS" != "true" ]]; then gls --color -d . &>/dev/null && alias ls='gls --color=tty' colorls -G -d . &>/dev/null && alias ls='colorls -G' elif [[ "$OSTYPE" == darwin* ]]; then - gls --color -d . &>/dev/null && alias ls='gls --color=tty' || alias ls='ls -G' + # this is a good alias, it works by default just using $LSCOLORS + alias ls='ls -G' + + # only use coreutils ls if there is a dircolors customization present ($LS_COLORS or .dircolors file) + # otherwise, gls will use the default color scheme which is ugly af + [[ -n "$LS_COLORS" || -f "$HOME/.dircolors" ]] && gls --color -d . &>/dev/null && alias ls='gls --color=tty' else # For GNU ls, we use the default ls color theme. They can later be overwritten by themes. if [[ -z "$LS_COLORS" ]]; then From 40544a1d5d1a55f88c226213fe464ede8b454fec Mon Sep 17 00:00:00 2001 From: Eduardo Cuomo Date: Sun, 10 Apr 2016 13:20:59 -0300 Subject: [PATCH 0107/1083] Fix invalid "ls -G" alias. --- lib/theme-and-appearance.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/theme-and-appearance.zsh b/lib/theme-and-appearance.zsh index 122e3fecb..f368a48f0 100644 --- a/lib/theme-and-appearance.zsh +++ b/lib/theme-and-appearance.zsh @@ -21,7 +21,7 @@ if [[ "$DISABLE_LS_COLORS" != "true" ]]; then colorls -G -d . &>/dev/null && alias ls='colorls -G' elif [[ "$OSTYPE" == darwin* ]]; then # this is a good alias, it works by default just using $LSCOLORS - alias ls='ls -G' + ls -G . &>/dev/null && alias ls='ls -G' # only use coreutils ls if there is a dircolors customization present ($LS_COLORS or .dircolors file) # otherwise, gls will use the default color scheme which is ugly af @@ -32,7 +32,7 @@ if [[ "$DISABLE_LS_COLORS" != "true" ]]; then (( $+commands[dircolors] )) && eval "$(dircolors -b)" fi - ls --color -d . &>/dev/null && alias ls='ls --color=tty' || alias ls='ls -G' + ls --color -d . &>/dev/null && alias ls='ls --color=tty' || ls -G . &>/dev/null && alias ls='ls -G' # Take advantage of $LS_COLORS for completion as well. zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}" From cf37697920019c44245ba3e5b69fed68c8c3fff4 Mon Sep 17 00:00:00 2001 From: Sachin George Thomas Date: Wed, 2 Nov 2016 20:22:14 +0530 Subject: [PATCH 0108/1083] node: open module-specific node documentation (#5572) --- plugins/node/node.plugin.zsh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/node/node.plugin.zsh b/plugins/node/node.plugin.zsh index 2463815ac..e2f18a032 100644 --- a/plugins/node/node.plugin.zsh +++ b/plugins/node/node.plugin.zsh @@ -1,5 +1,6 @@ # Open the node api for your current version to the optional section. # TODO: Make the section part easier to use. function node-docs { - open_command "http://nodejs.org/docs/$(node --version)/api/all.html#all_$1" + local section=${1:-all} + open_command "http://nodejs.org/docs/$(node --version)/api/$section.html" } From b94d9e26e534c9729e8a9401a37e7a5b0906f0d5 Mon Sep 17 00:00:00 2001 From: Timothy Blumberg Date: Wed, 2 Nov 2016 12:53:54 -0400 Subject: [PATCH 0109/1083] Changed dsa --> rsa in zshrc.zsh-template file (#5603) --- templates/zshrc.zsh-template | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/zshrc.zsh-template b/templates/zshrc.zsh-template index 00d25bc93..af42e5b9f 100644 --- a/templates/zshrc.zsh-template +++ b/templates/zshrc.zsh-template @@ -73,7 +73,7 @@ source $ZSH/oh-my-zsh.sh # export ARCHFLAGS="-arch x86_64" # ssh -# export SSH_KEY_PATH="~/.ssh/dsa_id" +# export SSH_KEY_PATH="~/.ssh/rsa_id" # Set personal aliases, overriding those provided by oh-my-zsh libs, # plugins, and themes. Aliases can be placed here, though oh-my-zsh From 0b340bc3a5c58609a07987b296f773eaea17b274 Mon Sep 17 00:00:00 2001 From: "mingang.he" Date: Thu, 3 Nov 2016 21:10:08 +0800 Subject: [PATCH 0110/1083] Fix #5604: No DIR ( directory ) colors (#5605) --- lib/theme-and-appearance.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/theme-and-appearance.zsh b/lib/theme-and-appearance.zsh index f368a48f0..96f34aa81 100644 --- a/lib/theme-and-appearance.zsh +++ b/lib/theme-and-appearance.zsh @@ -32,7 +32,7 @@ if [[ "$DISABLE_LS_COLORS" != "true" ]]; then (( $+commands[dircolors] )) && eval "$(dircolors -b)" fi - ls --color -d . &>/dev/null && alias ls='ls --color=tty' || ls -G . &>/dev/null && alias ls='ls -G' + ls --color -d . &>/dev/null && alias ls='ls --color=tty' || { ls -G . &>/dev/null && alias ls='ls -G' } # Take advantage of $LS_COLORS for completion as well. zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}" From 6685aac42cf1feb0c686ef84516c97e1113678a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Thu, 10 Nov 2016 19:46:15 +0100 Subject: [PATCH 0111/1083] dircycle: fix error on insert-cycledleft if dirstack is empty --- plugins/dircycle/dircycle.plugin.zsh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/dircycle/dircycle.plugin.zsh b/plugins/dircycle/dircycle.plugin.zsh index 2f32277cf..8c58cab4c 100644 --- a/plugins/dircycle/dircycle.plugin.zsh +++ b/plugins/dircycle/dircycle.plugin.zsh @@ -9,6 +9,8 @@ # pushd -N: start counting from right of `dirs' output switch-to-dir () { + [[ ${#dirstack} -eq 0 ]] && return + while ! builtin pushd -q $1 &>/dev/null; do # We found a missing directory: pop it out of the dir stack builtin popd -q $1 From fe96d194210854e2dc170a226b166253091f2fc0 Mon Sep 17 00:00:00 2001 From: hjpotter92 Date: Fri, 11 Nov 2016 07:47:43 +0530 Subject: [PATCH 0112/1083] Update endpoint from HTTP to HTTPS (#5622) --- plugins/node/node.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/node/node.plugin.zsh b/plugins/node/node.plugin.zsh index e2f18a032..e196662c7 100644 --- a/plugins/node/node.plugin.zsh +++ b/plugins/node/node.plugin.zsh @@ -2,5 +2,5 @@ # TODO: Make the section part easier to use. function node-docs { local section=${1:-all} - open_command "http://nodejs.org/docs/$(node --version)/api/$section.html" + open_command "https://nodejs.org/docs/$(node --version)/api/$section.html" } From 62b0abdb6e4bedc0c28f97176bd76f74859d82ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Fri, 11 Nov 2016 15:20:11 +0100 Subject: [PATCH 0113/1083] brew: fix disclaimer shown if mkdir is aliased Fixes #5623. --- plugins/brew/brew.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/brew/brew.plugin.zsh b/plugins/brew/brew.plugin.zsh index d4289c98e..6fb7f3453 100644 --- a/plugins/brew/brew.plugin.zsh +++ b/plugins/brew/brew.plugin.zsh @@ -3,7 +3,7 @@ alias bubo='brew update && brew outdated' alias bubc='brew upgrade && brew cleanup' alias bubu='bubo && bubc' -if mkdir "$ZSH_CACHE_DIR/.brew-completion-message" 2>/dev/null; then +if command mkdir "$ZSH_CACHE_DIR/.brew-completion-message" 2>/dev/null; then print -P '%F{yellow}'Oh My Zsh brew plugin: cat <<-'EOF' From 3ed37f47cb1a9385e2238528839d7d91634f2c5b Mon Sep 17 00:00:00 2001 From: Derek Frank Date: Tue, 15 Nov 2016 15:38:32 -0800 Subject: [PATCH 0114/1083] fix(env): Do not override misc env set before sourcing oh-my-zsh (#5231) Sourcing oh-my-zsh happens in zshrc, which will override settings of profile and zshenv. Treat misc values, `PAGER` and `LESS`, as default settings without overriding existing values. Fixes: #1, robbyrussell/oh-my-zsh#3016 --- lib/misc.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/misc.zsh b/lib/misc.zsh index c81dab413..3052b7710 100644 --- a/lib/misc.zsh +++ b/lib/misc.zsh @@ -19,8 +19,8 @@ fi setopt long_list_jobs ## pager -export PAGER="less" -export LESS="-R" +env_default PAGER 'less' +env_default LESS '-R' ## super user alias alias _='sudo' From 3477ff25274fa75bd9e6110f391f6ad98ca2af72 Mon Sep 17 00:00:00 2001 From: Jason Kurian Date: Wed, 16 Nov 2016 04:42:46 -0500 Subject: [PATCH 0115/1083] feat: no CI on WIP commits (#5643) --- plugins/git/git.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 178f1deb2..9d8e4174a 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -237,4 +237,4 @@ alias gupv='git pull --rebase -v' alias glum='git pull upstream master' alias gwch='git whatchanged -p --abbrev-commit --pretty=medium' -alias gwip='git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit --no-verify -m "--wip--"' +alias gwip='git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit --no-verify -m "--wip-- [skip ci]"' From 41e65c0872fc29a604aea007aeba011334a6ac4c Mon Sep 17 00:00:00 2001 From: slavaGanzin Date: Thu, 17 Nov 2016 15:30:27 +0200 Subject: [PATCH 0116/1083] remove trash --- $ | 0 disabled | 0 echo | 0 plugins/zsh-syntax-highlighting | 1 - 4 files changed, 1 deletion(-) delete mode 100644 $ delete mode 100644 disabled delete mode 100644 echo delete mode 160000 plugins/zsh-syntax-highlighting diff --git a/$ b/$ deleted file mode 100644 index e69de29bb..000000000 diff --git a/disabled b/disabled deleted file mode 100644 index e69de29bb..000000000 diff --git a/echo b/echo deleted file mode 100644 index e69de29bb..000000000 diff --git a/plugins/zsh-syntax-highlighting b/plugins/zsh-syntax-highlighting deleted file mode 160000 index 094329eb1..000000000 --- a/plugins/zsh-syntax-highlighting +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 094329eb145e00b810e65415ed4b9ad58aa7c34a From a90527b46d67e70f92258849b265b6bfd5e910e0 Mon Sep 17 00:00:00 2001 From: slavaGanzin Date: Thu, 17 Nov 2016 15:51:40 +0200 Subject: [PATCH 0117/1083] fix FETCH_LOG bug --- plugins/git-auto-fetch/git-auto-fetch.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/git-auto-fetch/git-auto-fetch.plugin.zsh b/plugins/git-auto-fetch/git-auto-fetch.plugin.zsh index 7dbd63fe1..03fa911e7 100644 --- a/plugins/git-auto-fetch/git-auto-fetch.plugin.zsh +++ b/plugins/git-auto-fetch/git-auto-fetch.plugin.zsh @@ -4,7 +4,7 @@ function git-fetch-all { (`git rev-parse --is-inside-work-tree 2>/dev/null` && dir=`git rev-parse --git-dir` && [[ ! -f $dir/NO_AUTO_FETCH ]] && - (( `date +%s` - `date -r $dir/FETCH_LOG +%s` > $GIT_AUTO_FETCH_INTERVAL )) && + (( `date +%s` - `date -r $dir/FETCH_LOG +%s 2>/dev/null || echo 0` > $GIT_AUTO_FETCH_INTERVAL )) && git fetch --all &>! $dir/FETCH_LOG &) } From 9d43dc88bbc313921661c8b699e78550a2d86708 Mon Sep 17 00:00:00 2001 From: Eduardo Bizarro Date: Wed, 23 Nov 2016 15:50:14 -0200 Subject: [PATCH 0118/1083] Yarn (https://yarnpkg.com) completion support (#5542) * yarn completion --- plugins/yarn/yarn.plugin.zsh | 81 ++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 plugins/yarn/yarn.plugin.zsh diff --git a/plugins/yarn/yarn.plugin.zsh b/plugins/yarn/yarn.plugin.zsh new file mode 100644 index 000000000..47c503acb --- /dev/null +++ b/plugins/yarn/yarn.plugin.zsh @@ -0,0 +1,81 @@ +alias yi="yarn install" + +_yarn () +{ + local -a _1st_arguments _dopts _dev _production + local expl + typeset -A opt_args + + _dopts=( + '(--force)--force[This refetches all packages, even ones that were previously installed.]' + ) + + _installopts=( + '(--flat)--flat[Only allow one version of a package. On the first run this will prompt you to choose a single version for each package that is depended on at multiple version ranges.]' + '(--har)--har[Outputs an HTTP archive from all the network requests performed during the installation.]' + '(--no-lockfile)--no-lockfile[Don’t read or generate a yarn.lock lockfile.]' + '(--pure-lockfile)--pure-lockfile[Don’t generate a yarn.lock lockfile.]' + ) + + _dev=('(--dev)--dev[Save installed packages into the project"s package.json devDependencies]') + + _production=('(--production)--production[Do not install project devDependencies]') + + _1st_arguments=( + 'help:Display help information about yarn' \ + 'init:Initialize for the development of a package.' \ + 'add:Add a package to use in your current package.' \ + 'install:Install all the dependencies listed within package.json in the local node_modules folder.' \ + 'publish:Publish a package to a package manager.' \ + 'remove:Remove a package that will no longer be used in your current package.' \ + 'cache:Clear the local cache. It will be populated again the next time yarn or yarn install is run.' \ + 'clean:Frees up space by removing unnecessary files and folders from dependencies.' \ + 'check:Verifies that versions of the package dependencies in the current project’s package.json matches that of yarn’s lock file.' \ + 'ls:List all installed packages.' \ + 'global:Makes binaries available to use on your operating system.' \ + 'info: [] - fetch information about a package and return it in a tree format.' \ + 'outdated:Checks for outdated package dependencies.' \ + 'run:Runs a defined package script.' \ + 'self-update:Updates Yarn to the latest version.' \ + 'upgrade:Upgrades packages to their latest version based on the specified range.' \ + 'why: - Show information about why a package is installed.' + ) + _arguments \ + '*:: :->subcmds' && return 0 + + if (( CURRENT == 1 )); then + _describe -t commands "yarn subcommand" _1st_arguments + return + fi + + case "$words[1]" in + add) + _arguments \ + $_dopts \ + $_dev \ + $_production + ;; + install) + _arguments \ + $_installopts \ + $_dopts \ + $_dev \ + $_no_color \ + $_production + ;; + update) + _arguments \ + $_dopts + ;; + remove) + _arguments \ + $_dopts + ;; + *) + _arguments \ + ;; + esac + +} + +compdef _yarn yarn From 037764acc366bae0dc0f01c221c7a23ef04d3c83 Mon Sep 17 00:00:00 2001 From: Thomas Paul Mann Date: Mon, 28 Nov 2016 21:08:34 +0100 Subject: [PATCH 0119/1083] Add plugin for Swift Package Manager (#5670) * Add plugin for Swift Package Manager * swift-package-manager: Rename plugin to 'swift-pm' --- plugins/swift-pm/README.md | 22 ++++++++++++++++++++++ plugins/swift-pm/swift-pm.plugin.zsh | 8 ++++++++ 2 files changed, 30 insertions(+) create mode 100644 plugins/swift-pm/README.md create mode 100644 plugins/swift-pm/swift-pm.plugin.zsh diff --git a/plugins/swift-pm/README.md b/plugins/swift-pm/README.md new file mode 100644 index 000000000..8e6a0d5c4 --- /dev/null +++ b/plugins/swift-pm/README.md @@ -0,0 +1,22 @@ +# Swift Package Manager + +## Description + +This plugin provides a few utilities that make you faster on your daily work with the [Swift Package Manager](https://github.com/apple/swift-package-manager). + +To start using it, add the `swift-pm` plugin to your `plugins` array in `~/.zshrc`: + +```zsh +plugins=(... swift-pm) +``` + +## Aliases + +| Alias | Description | Command | +|-------|-------------------------------------|------------------------------------| +| `spi` | Initialize a new package | `swift package init` | +| `spf` | Fetch package dependencies | `swift package fetch` | +| `spu` | Update package dependencies | `swift package update` | +| `spx` | Generates an Xcode project | `swift package generate-xcodeproj` | +| `sps` | Print the resolved dependency graph | `swift package show-dependencies` | +| `spd` | Print parsed Package.swift as JSON | `swift package dump-package` | diff --git a/plugins/swift-pm/swift-pm.plugin.zsh b/plugins/swift-pm/swift-pm.plugin.zsh new file mode 100644 index 000000000..ef872ea34 --- /dev/null +++ b/plugins/swift-pm/swift-pm.plugin.zsh @@ -0,0 +1,8 @@ +# Some aliases to make your life with the Swift Package Manager faster ✌️ + +alias spi='swift package init' +alias spf='swift package fetch' +alias spu='swift package update' +alias spx='swift package generate-xcodeproj' +alias sps='swift package show-dependencies' +alias spd='swift package dump-package' From 6ee6a734c24b8f2cda43f230142f0f02cfb52fb3 Mon Sep 17 00:00:00 2001 From: Thomas Paul Mann Date: Wed, 30 Nov 2016 00:20:43 +0100 Subject: [PATCH 0120/1083] swift-pm: Rename plugin to 'swiftpm' (#5674) --- plugins/{swift-pm => swiftpm}/README.md | 4 ++-- .../swift-pm.plugin.zsh => swiftpm/swiftpm.plugin.zsh} | 0 2 files changed, 2 insertions(+), 2 deletions(-) rename plugins/{swift-pm => swiftpm}/README.md (89%) rename plugins/{swift-pm/swift-pm.plugin.zsh => swiftpm/swiftpm.plugin.zsh} (100%) diff --git a/plugins/swift-pm/README.md b/plugins/swiftpm/README.md similarity index 89% rename from plugins/swift-pm/README.md rename to plugins/swiftpm/README.md index 8e6a0d5c4..07ca25651 100644 --- a/plugins/swift-pm/README.md +++ b/plugins/swiftpm/README.md @@ -4,10 +4,10 @@ This plugin provides a few utilities that make you faster on your daily work with the [Swift Package Manager](https://github.com/apple/swift-package-manager). -To start using it, add the `swift-pm` plugin to your `plugins` array in `~/.zshrc`: +To start using it, add the `swiftpm` plugin to your `plugins` array in `~/.zshrc`: ```zsh -plugins=(... swift-pm) +plugins=(... swiftpm) ``` ## Aliases diff --git a/plugins/swift-pm/swift-pm.plugin.zsh b/plugins/swiftpm/swiftpm.plugin.zsh similarity index 100% rename from plugins/swift-pm/swift-pm.plugin.zsh rename to plugins/swiftpm/swiftpm.plugin.zsh From 937a7f66ef852c2d2a5da7907504f6d61ed92433 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Thu, 8 Dec 2016 02:10:18 +0100 Subject: [PATCH 0121/1083] Precise Unix-based wording Closes #5681 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index eecde1551..d56534977 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ To learn more, visit [ohmyz.sh](http://ohmyz.sh) and follow [@ohmyzsh](https://t __Disclaimer:__ _Oh My Zsh works best on macOS and Linux._ -* Unix-based operating system (macOS or Linux) +* Unix-like operating system (macOS or Linux) * [Zsh](http://www.zsh.org) should be installed (v4.3.9 or more recent). If not pre-installed (`zsh --version` to confirm), check the following instruction here: [Installing ZSH](https://github.com/robbyrussell/oh-my-zsh/wiki/Installing-ZSH) * `curl` or `wget` should be installed * `git` should be installed From 26aae6b5834e1342d9b95a894a5bb24159b367bf Mon Sep 17 00:00:00 2001 From: Rarylson Freitas Date: Thu, 8 Dec 2016 18:49:58 -0200 Subject: [PATCH 0122/1083] Fix (plugins debian and ubuntu): `apt-history list` using `zgrep` (#5695) Changing from `zcat` to `zgrep` because some `zcat` implementations do not work if the file is not compressed. --- plugins/debian/debian.plugin.zsh | 2 +- plugins/ubuntu/ubuntu.plugin.zsh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/debian/debian.plugin.zsh b/plugins/debian/debian.plugin.zsh index 31a772d60..28131ff80 100644 --- a/plugins/debian/debian.plugin.zsh +++ b/plugins/debian/debian.plugin.zsh @@ -192,7 +192,7 @@ apt-history () { awk '{print $4"="$5}' ;; list) - zcat $(ls -rt /var/log/dpkg*) + zgrep --no-filename '' $(ls -rt /var/log/dpkg*) ;; *) echo "Parameters:" diff --git a/plugins/ubuntu/ubuntu.plugin.zsh b/plugins/ubuntu/ubuntu.plugin.zsh index ffde284fe..030af0693 100644 --- a/plugins/ubuntu/ubuntu.plugin.zsh +++ b/plugins/ubuntu/ubuntu.plugin.zsh @@ -108,7 +108,7 @@ apt-history () { awk '{print $4"="$5}' ;; list) - zcat $(ls -rt /var/log/dpkg*) + zgrep --no-filename '' $(ls -rt /var/log/dpkg*) ;; *) echo "Parameters:" From 3b13dc07d823ebcb67ea429de305b5413e99ac1e Mon Sep 17 00:00:00 2001 From: Erik Zivkovic Date: Wed, 14 Dec 2016 17:25:48 +0100 Subject: [PATCH 0123/1083] gradle: extract simple task names from subproject tasks (#5704) Currently, only tasks with complete subproject specifier are added to .gradletasknamecache. Gradle commands can be called for all (sub-)projects they are defined for, using their name as defined in the subproject, here called "simple" task names. One example is "gradle clean". This patch adds support for parsing out those "simple" task names from the list of fully specified task names. The .gradletasknamecache file will contain both the fully specified names, and the "simple" names for your autocompletion pleasure. --- plugins/gradle/gradle.plugin.zsh | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/plugins/gradle/gradle.plugin.zsh b/plugins/gradle/gradle.plugin.zsh index b2015a351..65b9d4685 100644 --- a/plugins/gradle/gradle.plugin.zsh +++ b/plugins/gradle/gradle.plugin.zsh @@ -61,7 +61,7 @@ _gradle_does_task_list_need_generating () { } ############## -# Parse the tasks from `gradle(w) tasks --all` into .gradletasknamecache +# Parse the tasks from `gradle(w) tasks --all` and return them to the calling function. # All lines in the output from gradle(w) that are between /^-+$/ and /^\s*$/ # are considered to be tasks. If and when gradle adds support for listing tasks # for programmatic parsing, this method can be deprecated. @@ -76,7 +76,7 @@ _gradle_parse_tasks () { task_name_buffer="" elif [[ $line =~ ^\s*$ ]]; then if [[ "$lines_might_be_tasks" = true ]]; then - # If a newline is found, send the buffer to .gradletasknamecache + # If a newline is found, echo the buffer to the calling function while read -r task; do echo $task | awk '/[a-zA-Z0-9:-]+/ {print $1}' done <<< "$task_name_buffer" @@ -90,6 +90,25 @@ _gradle_parse_tasks () { done <<< "$1" } + +############## +# Gradle tasks from subprojects are allowed to be executed without specifying +# the subproject; that task will then be called on all subprojects. +# gradle(w) tasks --all only lists tasks per subproject, but when autocompleting +# we often want to be able to run a specific task on all subprojects, e.g. +# "gradle clean". +# This function uses the list of tasks from "gradle tasks --all", and for each +# line grabs everything after the last ":" and combines that output with the original +# output. The combined list is returned as the result of this function. +############## +_gradle_parse_and_extract_tasks () { + # All tasks + tasks=$(_gradle_parse_tasks "$1") + # Task name without sub project(s) prefix + simple_tasks=$(echo $tasks | awk 'BEGIN { FS = ":" } { print $NF }') + echo "$tasks\n$simple_tasks" +} + ############################################################################## # Discover the gradle tasks by running "gradle tasks --all" ############################################################################ @@ -97,7 +116,7 @@ _gradle_tasks () { if [[ -f build.gradle ]]; then _gradle_arguments if _gradle_does_task_list_need_generating; then - _gradle_parse_tasks "$(gradle tasks --all)" > .gradletasknamecache + _gradle_parse_and_extract_tasks "$(gradle tasks --all)" > .gradletasknamecache fi compadd -X "==== Gradle Tasks ====" $(cat .gradletasknamecache) fi @@ -107,7 +126,7 @@ _gradlew_tasks () { if [[ -f build.gradle ]]; then _gradle_arguments if _gradle_does_task_list_need_generating; then - _gradle_parse_tasks "$(./gradlew tasks --all)" > .gradletasknamecache + _gradle_parse_and_extract_tasks "$(./gradlew tasks --all)" > .gradletasknamecache fi compadd -X "==== Gradlew Tasks ====" $(cat .gradletasknamecache) fi From 8d35fa0e2f32dab6894ca06bfc333af94be97ec7 Mon Sep 17 00:00:00 2001 From: Arthur Date: Wed, 14 Dec 2016 22:49:08 +0600 Subject: [PATCH 0124/1083] add dotenv plugin (#4373) --- plugins/dotenv/README.md | 34 ++++++++++++++++++++++++++++++++ plugins/dotenv/dotenv.plugin.zsh | 10 ++++++++++ 2 files changed, 44 insertions(+) create mode 100644 plugins/dotenv/README.md create mode 100644 plugins/dotenv/dotenv.plugin.zsh diff --git a/plugins/dotenv/README.md b/plugins/dotenv/README.md new file mode 100644 index 000000000..ade09fbb2 --- /dev/null +++ b/plugins/dotenv/README.md @@ -0,0 +1,34 @@ +# dotenv + +Automatically load your project ENV variables from `.env` file when you `cd` into project root directory. + +Storing configuration in the environment is one of the tenets of a [twelve-factor app](http://www.12factor.net). Anything that is likely to change between deployment environments–such as resource handles for databases or credentials for external services–should be extracted from the code into environment variables. + +## Installation + +Just add the plugin to your `.zshrc`: + +```sh +plugins=(git man dotenv) +``` + +## Usage + +Create `.env` file inside your project directory and put your local ENV variables there. + +For example: +```sh +export AWS_S3_TOKEN=d84a83539134f28f412c652b09f9f98eff96c9a +export SECRET_KEY=7c6c72d959416d5aa368a409362ec6e2ac90d7f +export MONGO_URI=mongodb://127.0.0.1:27017 +export PORT=3001 +``` +`export` is optional. This format works as well: +```sh +AWS_S3_TOKEN=d84a83539134f28f412c652b09f9f98eff96c9a +SECRET_KEY=7c6c72d959416d5aa368a409362ec6e2ac90d7f +MONGO_URI=mongodb://127.0.0.1:27017 +PORT=3001 +``` + +**It's strongly recommended to add `.env` file to `.gitignore`**, because usually it contains sensitive information such as your credentials, secret keys, passwords etc. You don't want to commit this file, it supposed to be local only. diff --git a/plugins/dotenv/dotenv.plugin.zsh b/plugins/dotenv/dotenv.plugin.zsh new file mode 100644 index 000000000..9dd784229 --- /dev/null +++ b/plugins/dotenv/dotenv.plugin.zsh @@ -0,0 +1,10 @@ +#!/bin/zsh + +source_env() { + if [[ -f .env ]]; then + source .env + fi +} + +autoload -U add-zsh-hook +add-zsh-hook chpwd source_env From 67dad45b38b7f0bafcaf7679da6eb4596301843b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Wed, 14 Dec 2016 23:22:26 +0100 Subject: [PATCH 0125/1083] docker: update completion (upstream 2fe62f2) Closes #5683 --- plugins/docker/_docker | 1540 +++++++++++++++++++++++++++------------- 1 file changed, 1064 insertions(+), 476 deletions(-) diff --git a/plugins/docker/_docker b/plugins/docker/_docker index 415e731f3..8d00b13e6 100644 --- a/plugins/docker/_docker +++ b/plugins/docker/_docker @@ -113,27 +113,27 @@ __docker_get_containers() { return ret } -__docker_stoppedcontainers() { +__docker_complete_stopped_containers() { [[ $PREFIX = -* ]] && return 1 __docker_get_containers stopped all "$@" } -__docker_runningcontainers() { +__docker_complete_running_containers() { [[ $PREFIX = -* ]] && return 1 __docker_get_containers running all "$@" } -__docker_containers() { +__docker_complete_containers() { [[ $PREFIX = -* ]] && return 1 __docker_get_containers all all "$@" } -__docker_containers_ids() { +__docker_complete_containers_ids() { [[ $PREFIX = -* ]] && return 1 __docker_get_containers all ids "$@" } -__docker_containers_names() { +__docker_complete_containers_names() { [[ $PREFIX = -* ]] && return 1 __docker_get_containers all names "$@" } @@ -149,25 +149,27 @@ __docker_complete_info_plugins() { return ret } -__docker_images() { +__docker_complete_images() { [[ $PREFIX = -* ]] && return 1 integer ret=1 declare -a images images=(${${${(f)${:-"$(_call_program commands docker $docker_options images)"$'\n'}}[2,-1]}/(#b)([^ ]##) ##([^ ]##) ##([^ ]##)*/${match[3]}:${(r:15:: :::)match[2]} in ${match[1]}}) _describe -t docker-images "images" images && ret=0 - __docker_repositories_with_tags && ret=0 + __docker_complete_repositories_with_tags && ret=0 return ret } -__docker_repositories() { +__docker_complete_repositories() { [[ $PREFIX = -* ]] && return 1 + integer ret=1 declare -a repos repos=(${${${(f)${:-"$(_call_program commands docker $docker_options images)"$'\n'}}%% *}[2,-1]}) repos=(${repos#}) - _describe -t docker-repos "repositories" repos + _describe -t docker-repos "repositories" repos && ret=0 + return ret } -__docker_repositories_with_tags() { +__docker_complete_repositories_with_tags() { [[ $PREFIX = -* ]] && return 1 integer ret=1 declare -a repos onlyrepos matched @@ -244,7 +246,7 @@ __docker_get_log_options() { return ret } -__docker_log_drivers() { +__docker_complete_log_drivers() { [[ $PREFIX = -* ]] && return 1 integer ret=1 drivers=(awslogs etwlogs fluentd gcplogs gelf journald json-file none splunk syslog) @@ -252,7 +254,7 @@ __docker_log_drivers() { return ret } -__docker_log_options() { +__docker_complete_log_options() { [[ $PREFIX = -* ]] && return 1 integer ret=1 @@ -295,7 +297,7 @@ __docker_complete_pid() { if compset -P '*:'; then case "${${words[-1]%:*}#*=}" in (container) - __docker_runningcontainers && ret=0 + __docker_complete_running_containers && ret=0 ;; *) _message 'value' && ret=0 @@ -327,36 +329,40 @@ __docker_complete_ps_filters() { if compset -P '*='; then case "${${words[-1]%=*}#*=}" in (ancestor) - __docker_images && ret=0 + __docker_complete_images && ret=0 ;; (before|since) - __docker_containers && ret=0 + __docker_complete_containers && ret=0 + ;; + (health) + health_opts=('healthy' 'none' 'starting' 'unhealthy') + _describe -t health-filter-opts "health filter options" health_opts && ret=0 ;; (id) - __docker_containers_ids && ret=0 + __docker_complete_containers_ids && ret=0 ;; (is-task) _describe -t boolean-filter-opts "filter options" boolean_opts && ret=0 ;; (name) - __docker_containers_names && ret=0 + __docker_complete_containers_names && ret=0 ;; (network) - __docker_networks && ret=0 + __docker_complete_networks && ret=0 ;; (status) status_opts=('created' 'dead' 'exited' 'paused' 'restarting' 'running' 'removing') - _describe -t status-filter-opts "Status Filter Options" status_opts && ret=0 + _describe -t status-filter-opts "status filter options" status_opts && ret=0 ;; (volume) - __docker_volumes && ret=0 + __docker_complete_volumes && ret=0 ;; *) _message 'value' && ret=0 ;; esac else - opts=('ancestor' 'before' 'exited' 'id' 'label' 'name' 'network' 'since' 'status' 'volume') + opts=('ancestor' 'before' 'exited' 'health' 'id' 'label' 'name' 'network' 'since' 'status' 'volume') _describe -t filter-opts "Filter Options" opts -qS "=" && ret=0 fi @@ -393,12 +399,12 @@ __docker_complete_images_filters() { declare -a boolean_opts opts boolean_opts=('true' 'false') - opts=('before' 'dangling' 'label' 'since') + opts=('before' 'dangling' 'label' 'reference' 'since') if compset -P '*='; then case "${${words[-1]%=*}#*=}" in - (before|since) - __docker_images && ret=0 + (before|reference|since) + __docker_complete_images && ret=0 ;; (dangling) _describe -t boolean-filter-opts "filter options" boolean_opts && ret=0 @@ -424,7 +430,7 @@ __docker_complete_events_filter() { if compset -P '*='; then case "${${words[-1]%=*}#*=}" in (container) - __docker_containers && ret=0 + __docker_complete_containers && ret=0 ;; (daemon) emulate -L zsh @@ -444,10 +450,10 @@ __docker_complete_events_filter() { _describe -t event-filter-opts "event filter options" event_opts && ret=0 ;; (image) - __docker_images && ret=0 + __docker_complete_images && ret=0 ;; (network) - __docker_networks && ret=0 + __docker_complete_networks && ret=0 ;; (type) local -a type_opts @@ -455,7 +461,7 @@ __docker_complete_events_filter() { _describe -t type-filter-opts "type filter options" type_opts && ret=0 ;; (volume) - __docker_volumes && ret=0 + __docker_complete_volumes && ret=0 ;; *) _message 'value' && ret=0 @@ -468,6 +474,553 @@ __docker_complete_events_filter() { return ret } +# BO container + +__docker_container_commands() { + local -a _docker_container_subcommands + _docker_container_subcommands=( + "attach:Attach to a running container" + "commit:Create a new image from a container's changes" + "cp:Copy files/folders between a container and the local filesystem" + "create:Create a new container" + "diff:Inspect changes on a container's filesystem" + "exec:Run a command in a running container" + "export:Export a container's filesystem as a tar archive" + "inspect:Display detailed information on one or more containers" + "kill:Kill one or more running containers" + "logs:Fetch the logs of a container" + "ls:List containers" + "pause:Pause all processes within one or more containers" + "port:List port mappings or a specific mapping for the container" + "prune:Remove all stopped containers" + "rename:Rename a container" + "restart:Restart one or more containers" + "rm:Remove one or more containers" + "run:Run a command in a new container" + "start:Start one or more stopped containers" + "stats:Display a live stream of container(s) resource usage statistics" + "stop:Stop one or more running containers" + "top:Display the running processes of a container" + "unpause:Unpause all processes within one or more containers" + "update:Update configuration of one or more containers" + "wait:Block until one or more containers stop, then print their exit codes" + ) + _describe -t docker-container-commands "docker container command" _docker_container_subcommands +} + +__docker_container_subcommand() { + local -a _command_args opts_help opts_attach_exec_run_start opts_create_run opts_create_run_update + local expl help="--help" + integer ret=1 + + opts_attach_exec_run_start=( + "($help)--detach-keys=[Escape key sequence used to detach a container]:sequence:__docker_complete_detach_keys" + ) + opts_create_run=( + "($help -a --attach)"{-a=,--attach=}"[Attach to stdin, stdout or stderr]:device:(STDIN STDOUT STDERR)" + "($help)*--add-host=[Add a custom host-to-IP mapping]:host\:ip mapping: " + "($help)*--blkio-weight-device=[Block IO (relative device weight)]:device:Block IO weight: " + "($help)*--cap-add=[Add Linux capabilities]:capability: " + "($help)*--cap-drop=[Drop Linux capabilities]:capability: " + "($help)--cgroup-parent=[Parent cgroup for the container]:cgroup: " + "($help)--cidfile=[Write the container ID to the file]:CID file:_files" + "($help)--cpus=[Number of CPUs (default 0.000)]:cpus: " + "($help)*--device=[Add a host device to the container]:device:_files" + "($help)*--device-read-bps=[Limit the read rate (bytes per second) from a device]:device:IO rate: " + "($help)*--device-read-iops=[Limit the read rate (IO per second) from a device]:device:IO rate: " + "($help)*--device-write-bps=[Limit the write rate (bytes per second) to a device]:device:IO rate: " + "($help)*--device-write-iops=[Limit the write rate (IO per second) to a device]:device:IO rate: " + "($help)--disable-content-trust[Skip image verification]" + "($help)*--dns=[Custom DNS servers]:DNS server: " + "($help)*--dns-option=[Custom DNS options]:DNS option: " + "($help)*--dns-search=[Custom DNS search domains]:DNS domains: " + "($help)*"{-e=,--env=}"[Environment variables]:environment variable: " + "($help)--entrypoint=[Overwrite the default entrypoint of the image]:entry point: " + "($help)*--env-file=[Read environment variables from a file]:environment file:_files" + "($help)*--expose=[Expose a port from the container without publishing it]: " + "($help)*--group=[Set one or more supplementary user groups for the container]:group:_groups" + "($help -h --hostname)"{-h=,--hostname=}"[Container host name]:hostname:_hosts" + "($help -i --interactive)"{-i,--interactive}"[Keep stdin open even if not attached]" + "($help)--ip=[Container IPv4 address]:IPv4: " + "($help)--ip6=[Container IPv6 address]:IPv6: " + "($help)--ipc=[IPC namespace to use]:IPC namespace: " + "($help)--isolation=[Container isolation technology]:isolation:(default hyperv process)" + "($help)*--link=[Add link to another container]:link:->link" + "($help)*--link-local-ip=[Add a link-local address for the container]:IPv4/IPv6: " + "($help)*"{-l=,--label=}"[Container metadata]:label: " + "($help)--log-driver=[Default driver for container logs]:logging driver:__docker_complete_log_drivers" + "($help)*--log-opt=[Log driver specific options]:log driver options:__docker_complete_log_options" + "($help)--mac-address=[Container MAC address]:MAC address: " + "($help)--name=[Container name]:name: " + "($help)--network=[Connect a container to a network]:network mode:(bridge none container host)" + "($help)*--network-alias=[Add network-scoped alias for the container]:alias: " + "($help)--oom-kill-disable[Disable OOM Killer]" + "($help)--oom-score-adj[Tune the host's OOM preferences for containers (accepts -1000 to 1000)]" + "($help)--pids-limit[Tune container pids limit (set -1 for unlimited)]" + "($help -P --publish-all)"{-P,--publish-all}"[Publish all exposed ports]" + "($help)*"{-p=,--publish=}"[Expose a container's port to the host]:port:_ports" + "($help)--pid=[PID namespace to use]:PID namespace:__docker_complete_pid" + "($help)--privileged[Give extended privileges to this container]" + "($help)--read-only[Mount the container's root filesystem as read only]" + "($help)*--security-opt=[Security options]:security option: " + "($help)*--shm-size=[Size of '/dev/shm' (format is '')]:shm size: " + "($help)--stop-timeout=[Timeout (in seconds) to stop a container]:time: " + "($help)*--sysctl=-[sysctl options]:sysctl: " + "($help -t --tty)"{-t,--tty}"[Allocate a pseudo-tty]" + "($help -u --user)"{-u=,--user=}"[Username or UID]:user:_users" + "($help)*--ulimit=[ulimit options]:ulimit: " + "($help)--userns=[Container user namespace]:user namespace:(host)" + "($help)--tmpfs[mount tmpfs]" + "($help)*-v[Bind mount a volume]:volume: " + "($help)--volume-driver=[Optional volume driver for the container]:volume driver:(local)" + "($help)*--volumes-from=[Mount volumes from the specified container]:volume: " + "($help -w --workdir)"{-w=,--workdir=}"[Working directory inside the container]:directory:_directories" + ) + opts_create_run_update=( + "($help)--blkio-weight=[Block IO (relative weight), between 10 and 1000]:Block IO weight:(10 100 500 1000)" + "($help -c --cpu-shares)"{-c=,--cpu-shares=}"[CPU shares (relative weight)]:CPU shares:(0 10 100 200 500 800 1000)" + "($help)--cpu-period=[Limit the CPU CFS (Completely Fair Scheduler) period]:CPU period: " + "($help)--cpu-quota=[Limit the CPU CFS (Completely Fair Scheduler) quota]:CPU quota: " + "($help)--cpu-rt-period=[Limit the CPU real-time period]:CPU real-time period in microseconds: " + "($help)--cpu-rt-runtime=[Limit the CPU real-time runtime]:CPU real-time runtime in microseconds: " + "($help)--cpuset-cpus=[CPUs in which to allow execution]:CPUs: " + "($help)--cpuset-mems=[MEMs in which to allow execution]:MEMs: " + "($help)--kernel-memory=[Kernel memory limit in bytes]:Memory limit: " + "($help -m --memory)"{-m=,--memory=}"[Memory limit]:Memory limit: " + "($help)--memory-reservation=[Memory soft limit]:Memory limit: " + "($help)--memory-swap=[Total memory limit with swap]:Memory limit: " + "($help)--restart=[Restart policy]:restart policy:(no on-failure always unless-stopped)" + ) + opts_help=("(: -)--help[Print usage]") + + case "$words[1]" in + (attach) + _arguments $(__docker_arguments) \ + $opts_help \ + $opts_attach_exec_run_start \ + "($help)--no-stdin[Do not attach stdin]" \ + "($help)--sig-proxy[Proxy all received signals to the process (non-TTY mode only)]" \ + "($help -):containers:__docker_complete_running_containers" && ret=0 + ;; + (commit) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -a --author)"{-a=,--author=}"[Author]:author: " \ + "($help)*"{-c=,--change=}"[Apply Dockerfile instruction to the created image]:Dockerfile:_files" \ + "($help -m --message)"{-m=,--message=}"[Commit message]:message: " \ + "($help -p --pause)"{-p,--pause}"[Pause container during commit]" \ + "($help -):container:__docker_complete_containers" \ + "($help -): :__docker_complete_repositories_with_tags" && ret=0 + ;; + (cp) + local state + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -L --follow-link)"{-L,--follow-link}"[Always follow symbol link]" \ + "($help -)1:container:->container" \ + "($help -)2:hostpath:_files" && ret=0 + case $state in + (container) + if compset -P "*:"; then + _files && ret=0 + else + __docker_complete_containers -qS ":" && ret=0 + fi + ;; + esac + ;; + (create) + local state + _arguments $(__docker_arguments) \ + $opts_help \ + $opts_create_run \ + $opts_create_run_update \ + "($help -): :__docker_complete_images" \ + "($help -):command: _command_names -e" \ + "($help -)*::arguments: _normal" && ret=0 + case $state in + (link) + if compset -P "*:"; then + _wanted alias expl "Alias" compadd -E "" && ret=0 + else + __docker_complete_running_containers -qS ":" && ret=0 + fi + ;; + esac + ;; + (diff) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -)*:containers:__docker_complete_containers" && ret=0 + ;; + (exec) + local state + _arguments $(__docker_arguments) \ + $opts_help \ + $opts_attach_exec_run_start \ + "($help -d --detach)"{-d,--detach}"[Detached mode: leave the container running in the background]" \ + "($help)*"{-e=,--env=}"[Set environment variables]:environment variable: " \ + "($help -i --interactive)"{-i,--interactive}"[Keep stdin open even if not attached]" \ + "($help)--privileged[Give extended Linux capabilities to the command]" \ + "($help -t --tty)"{-t,--tty}"[Allocate a pseudo-tty]" \ + "($help -u --user)"{-u=,--user=}"[Username or UID]:user:_users" \ + "($help -):containers:__docker_complete_running_containers" \ + "($help -)*::command:->anycommand" && ret=0 + case $state in + (anycommand) + shift 1 words + (( CURRENT-- )) + _normal && ret=0 + ;; + esac + ;; + (export) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -o --output)"{-o=,--output=}"[Write to a file, instead of stdout]:output file:_files" \ + "($help -)*:containers:__docker_complete_containers" && ret=0 + ;; + (inspect) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -f --format)"{-f=,--format=}"[Format the output using the given go template]:template: " \ + "($help -s --size)"{-s,--size}"[Display total file sizes]" \ + "($help -)*:containers:__docker_complete_containers" && ret=0 + ;; + (kill) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -s --signal)"{-s=,--signal=}"[Signal to send]:signal:_signals" \ + "($help -)*:containers:__docker_complete_running_containers" && ret=0 + ;; + (logs) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help)--details[Show extra details provided to logs]" \ + "($help -f --follow)"{-f,--follow}"[Follow log output]" \ + "($help -s --since)"{-s=,--since=}"[Show logs since this timestamp]:timestamp: " \ + "($help -t --timestamps)"{-t,--timestamps}"[Show timestamps]" \ + "($help)--tail=[Output the last K lines]:lines:(1 10 20 50 all)" \ + "($help -)*:containers:__docker_complete_containers" && ret=0 + ;; + (ls|list) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -a --all)"{-a,--all}"[Show all containers]" \ + "($help)--before=[Show only container created before...]:containers:__docker_complete_containers" \ + "($help)*"{-f=,--filter=}"[Filter values]:filter:__docker_complete_ps_filters" \ + "($help)--format=[Pretty-print containers using a Go template]:template: " \ + "($help -l --latest)"{-l,--latest}"[Show only the latest created container]" \ + "($help -n --last)"{-n=,--last=}"[Show n last created containers (includes all states)]:n:(1 5 10 25 50)" \ + "($help)--no-trunc[Do not truncate output]" \ + "($help -q --quiet)"{-q,--quiet}"[Only show numeric IDs]" \ + "($help -s --size)"{-s,--size}"[Display total file sizes]" \ + "($help)--since=[Show only containers created since...]:containers:__docker_complete_containers" && ret=0 + ;; + (pause|unpause) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -)*:containers:__docker_complete_running_containers" && ret=0 + ;; + (port) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -)1:containers:__docker_complete_running_containers" \ + "($help -)2:port:_ports" && ret=0 + ;; + (prune) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -f --force)"{-f,--force}"[Do not prompt for confirmation]" && ret=0 + ;; + (rename) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -):old name:__docker_complete_containers" \ + "($help -):new name: " && ret=0 + ;; + (restart) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -t --time)"{-t=,--time=}"[Number of seconds to try to stop for before killing the container]:seconds to before killing:(1 5 10 30 60)" \ + "($help -)*:containers:__docker_complete_containers_ids" && ret=0 + ;; + (rm) + local state + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -f --force)"{-f,--force}"[Force removal]" \ + "($help -l --link)"{-l,--link}"[Remove the specified link and not the underlying container]" \ + "($help -v --volumes)"{-v,--volumes}"[Remove the volumes associated to the container]" \ + "($help -)*:containers:->values" && ret=0 + case $state in + (values) + if [[ ${words[(r)-f]} == -f || ${words[(r)--force]} == --force ]]; then + __docker_complete_containers && ret=0 + else + __docker_complete_stopped_containers && ret=0 + fi + ;; + esac + ;; + (run) + local state + _arguments $(__docker_arguments) \ + $opts_help \ + $opts_create_run \ + $opts_create_run_update \ + $opts_attach_exec_run_start \ + "($help -d --detach)"{-d,--detach}"[Detached mode: leave the container running in the background]" \ + "($help)--health-cmd=[Command to run to check health]:command: " \ + "($help)--health-interval=[Time between running the check]:time: " \ + "($help)--health-retries=[Consecutive failures needed to report unhealthy]:retries:(1 2 3 4 5)" \ + "($help)--health-timeout=[Maximum time to allow one check to run]:time: " \ + "($help)--no-healthcheck[Disable any container-specified HEALTHCHECK]" \ + "($help)--rm[Remove intermediate containers when it exits]" \ + "($help)--runtime=[Name of the runtime to be used for that container]:runtime:__docker_complete_runtimes" \ + "($help)--sig-proxy[Proxy all received signals to the process (non-TTY mode only)]" \ + "($help)--stop-signal=[Signal to kill a container]:signal:_signals" \ + "($help)--storage-opt=[Storage driver options for the container]:storage options:->storage-opt" \ + "($help -): :__docker_complete_images" \ + "($help -):command: _command_names -e" \ + "($help -)*::arguments: _normal" && ret=0 + case $state in + (link) + if compset -P "*:"; then + _wanted alias expl "Alias" compadd -E "" && ret=0 + else + __docker_complete_running_containers -qS ":" && ret=0 + fi + ;; + (storage-opt) + if compset -P "*="; then + _message "value" && ret=0 + else + opts=('size') + _describe -t filter-opts "storage options" opts -qS "=" && ret=0 + fi + ;; + esac + ;; + (start) + _arguments $(__docker_arguments) \ + $opts_help \ + $opts_attach_exec_run_start \ + "($help -a --attach)"{-a,--attach}"[Attach container's stdout/stderr and forward all signals]" \ + "($help -i --interactive)"{-i,--interactive}"[Attach container's stding]" \ + "($help -)*:containers:__docker_complete_stopped_containers" && ret=0 + ;; + (stats) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -a --all)"{-a,--all}"[Show all containers (default shows just running)]" \ + "($help)--format=[Pretty-print images using a Go template]:template: " \ + "($help)--no-stream[Disable streaming stats and only pull the first result]" \ + "($help -)*:containers:__docker_complete_running_containers" && ret=0 + ;; + (stop) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -t --time)"{-t=,--time=}"[Number of seconds to try to stop for before killing the container]:seconds to before killing:(1 5 10 30 60)" \ + "($help -)*:containers:__docker_complete_running_containers" && ret=0 + ;; + (top) + local state + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -)1:containers:__docker_complete_running_containers" \ + "($help -)*:: :->ps-arguments" && ret=0 + case $state in + (ps-arguments) + _ps && ret=0 + ;; + esac + ;; + (update) + local state + _arguments $(__docker_arguments) \ + $opts_help \ + opts_create_run_update \ + "($help -)*: :->values" && ret=0 + case $state in + (values) + if [[ ${words[(r)--kernel-memory*]} = (--kernel-memory*) ]]; then + __docker_complete_stopped_containers && ret=0 + else + __docker_complete_containers && ret=0 + fi + ;; + esac + ;; + (wait) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -)*:containers:__docker_complete_running_containers" && ret=0 + ;; + (help) + _arguments $(__docker_arguments) ":subcommand:__docker_container_commands" && ret=0 + ;; + esac + + return ret +} + +# EO container + +# BO image + +__docker_image_commands() { + local -a _docker_image_subcommands + _docker_image_subcommands=( + "build:Build an image from a Dockerfile" + "history:Show the history of an image" + "import:Import the contents from a tarball to create a filesystem image" + "inspect:Display detailed information on one or more images" + "load:Load an image from a tar archive or STDIN" + "ls:List images" + "prune:Remove unused images" + "pull:Pull an image or a repository from a registry" + "push:Push an image or a repository to a registry" + "rm:Remove one or more images" + "save:Save one or more images to a tar archive (streamed to STDOUT by default)" + "tag:Tag an image into a repository" + ) + _describe -t docker-image-commands "docker image command" _docker_image_subcommands +} + +__docker_image_subcommand() { + local -a _command_args opts_help + local expl help="--help" + integer ret=1 + + opts_help=("(: -)--help[Print usage]") + + case "$words[1]" in + (build) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help)*--build-arg=[Build-time variables]:=: " \ + "($help)*--cache-from=[Images to consider as cache sources]: :__docker_complete_repositories_with_tags" \ + "($help -c --cpu-shares)"{-c=,--cpu-shares=}"[CPU shares (relative weight)]:CPU shares:(0 10 100 200 500 800 1000)" \ + "($help)--cgroup-parent=[Parent cgroup for the container]:cgroup: " \ + "($help)--compress[Compress the build context using gzip]" \ + "($help)--cpu-period=[Limit the CPU CFS (Completely Fair Scheduler) period]:CPU period: " \ + "($help)--cpu-quota=[Limit the CPU CFS (Completely Fair Scheduler) quota]:CPU quota: " \ + "($help)--cpu-rt-period=[Limit the CPU real-time period]:CPU real-time period in microseconds: " \ + "($help)--cpu-rt-runtime=[Limit the CPU real-time runtime]:CPU real-time runtime in microseconds: " \ + "($help)--cpuset-cpus=[CPUs in which to allow execution]:CPUs: " \ + "($help)--cpuset-mems=[MEMs in which to allow execution]:MEMs: " \ + "($help)--disable-content-trust[Skip image verification]" \ + "($help -f --file)"{-f=,--file=}"[Name of the Dockerfile]:Dockerfile:_files" \ + "($help)--force-rm[Always remove intermediate containers]" \ + "($help)--isolation=[Container isolation technology]:isolation:(default hyperv process)" \ + "($help)*--label=[Set metadata for an image]:label=value: " \ + "($help -m --memory)"{-m=,--memory=}"[Memory limit]:Memory limit: " \ + "($help)--memory-swap=[Total memory limit with swap]:Memory limit: " \ + "($help)--network=[Connect a container to a network]:network mode:(bridge none container host)" + "($help)--no-cache[Do not use cache when building the image]" \ + "($help)--pull[Attempt to pull a newer version of the image]" \ + "($help -q --quiet)"{-q,--quiet}"[Suppress verbose build output]" \ + "($help)--rm[Remove intermediate containers after a successful build]" \ + "($help)*--shm-size=[Size of '/dev/shm' (format is '')]:shm size: " \ + "($help -t --tag)*"{-t=,--tag=}"[Repository, name and tag for the image]: :__docker_complete_repositories_with_tags" \ + "($help)*--ulimit=[ulimit options]:ulimit: " \ + "($help)--userns=[Container user namespace]:user namespace:(host)" \ + "($help -):path or URL:_directories" && ret=0 + ;; + (history) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -H --human)"{-H,--human}"[Print sizes and dates in human readable format]" \ + "($help)--no-trunc[Do not truncate output]" \ + "($help -q --quiet)"{-q,--quiet}"[Only show numeric IDs]" \ + "($help -)*: :__docker_complete_images" && ret=0 + ;; + (import) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help)*"{-c=,--change=}"[Apply Dockerfile instruction to the created image]:Dockerfile:_files" \ + "($help -m --message)"{-m=,--message=}"[Commit message for imported image]:message: " \ + "($help -):URL:(- http:// file://)" \ + "($help -): :__docker_complete_repositories_with_tags" && ret=0 + ;; + (inspect) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -f --format)"{-f=,--format=}"[Format the output using the given go template]:template: " \ + "($help -)*:images:__docker_complete_images" && ret=0 + ;; + (load) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -i --input)"{-i=,--input=}"[Read from tar archive file]:archive file:_files -g \"*.((tar|TAR)(.gz|.GZ|.Z|.bz2|.lzma|.xz|)|(tbz|tgz|txz))(-.)\"" \ + "($help -q --quiet)"{-q,--quiet}"[Suppress the load output]" && ret=0 + ;; + (ls|list) + local state + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -a --all)"{-a,--all}"[Show all images]" \ + "($help)--digests[Show digests]" \ + "($help)*"{-f=,--filter=}"[Filter values]:filter:->filter-options" \ + "($help)--format=[Pretty-print images using a Go template]:template: " \ + "($help)--no-trunc[Do not truncate output]" \ + "($help -q --quiet)"{-q,--quiet}"[Only show numeric IDs]" \ + "($help -): :__docker_complete_repositories" && ret=0 + case $state in + (filter-options) + __docker_complete_images_filters && ret=0 + ;; + esac + ;; + (prune) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -a --all)"{-a,--all}"[Remove all unused images, not just dangling ones]" \ + "($help -f --force)"{-f,--force}"[Do not prompt for confirmation]" && ret=0 + ;; + (pull) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -a --all-tags)"{-a,--all-tags}"[Download all tagged images]" \ + "($help)--disable-content-trust[Skip image verification]" \ + "($help -):name:__docker_search" && ret=0 + ;; + (push) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help)--disable-content-trust[Skip image signing]" \ + "($help -): :__docker_complete_images" && ret=0 + ;; + (rm) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -f --force)"{-f,--force}"[Force removal]" \ + "($help)--no-prune[Do not delete untagged parents]" \ + "($help -)*: :__docker_complete_images" && ret=0 + ;; + (save) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -o --output)"{-o=,--output=}"[Write to file]:file:_files" \ + "($help -)*: :__docker_complete_images" && ret=0 + ;; + (tag) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -):source:__docker_complete_images"\ + "($help -):destination:__docker_complete_repositories_with_tags" && ret=0 + ;; + (help) + _arguments $(__docker_arguments) ":subcommand:__docker_container_commands" && ret=0 + ;; + esac + + return ret +} + +# EO image + # BO network __docker_network_complete_ls_filters() { @@ -480,10 +1033,10 @@ __docker_network_complete_ls_filters() { __docker_complete_info_plugins Network && ret=0 ;; (id) - __docker_networks_ids && ret=0 + __docker_complete_networks_ids && ret=0 ;; (name) - __docker_networks_names && ret=0 + __docker_complete_networks_names && ret=0 ;; (type) type_opts=('builtin' 'custom') @@ -529,6 +1082,7 @@ __docker_get_networks() { for line in $lines; do s="${line[${begin[NETWORK ID]},${end[NETWORK ID]}]%% ##}" s="$s:${(l:7:: :::)${${line[${begin[DRIVER]},${end[DRIVER]}]}%% ##}}" + s="$s, ${${line[${begin[SCOPE]},${end[SCOPE]}]}%% ##}" networks=($networks $s) done fi @@ -538,6 +1092,7 @@ __docker_get_networks() { for line in $lines; do s="${line[${begin[NAME]},${end[NAME]}]%% ##}" s="$s:${(l:7:: :::)${${line[${begin[DRIVER]},${end[DRIVER]}]}%% ##}}" + s="$s, ${${line[${begin[SCOPE]},${end[SCOPE]}]}%% ##}" networks=($networks $s) done fi @@ -546,17 +1101,17 @@ __docker_get_networks() { return ret } -__docker_networks() { +__docker_complete_networks() { [[ $PREFIX = -* ]] && return 1 __docker_get_networks all "$@" } -__docker_networks_ids() { +__docker_complete_networks_ids() { [[ $PREFIX = -* ]] && return 1 __docker_get_networks ids "$@" } -__docker_networks_names() { +__docker_complete_networks_names() { [[ $PREFIX = -* ]] && return 1 __docker_get_networks names "$@" } @@ -569,6 +1124,7 @@ __docker_network_commands() { "disconnect:Disconnects a container from a network" "inspect:Displays detailed information on a network" "ls:Lists all the networks created by the user" + "prune:Remove all unused networks" "rm:Deletes one or more networks" ) _describe -t docker-network-commands "docker network command" _docker_network_subcommands @@ -590,15 +1146,15 @@ __docker_network_subcommand() { "($help)--ip6=[Container IPv6 address]:IPv6: " \ "($help)*--link=[Add a link to another container]:link:->link" \ "($help)*--link-local-ip=[Add a link-local address for the container]:IPv4/IPv6: " \ - "($help -)1:network:__docker_networks" \ - "($help -)2:containers:__docker_containers" && ret=0 + "($help -)1:network:__docker_complete_networks" \ + "($help -)2:containers:__docker_complete_containers" && ret=0 case $state in (link) if compset -P "*:"; then _wanted alias expl "Alias" compadd -E "" && ret=0 else - __docker_runningcontainers -qS ":" && ret=0 + __docker_complete_running_containers -qS ":" && ret=0 fi ;; esac @@ -606,6 +1162,7 @@ __docker_network_subcommand() { (create) _arguments $(__docker_arguments) -A '-*' \ $opts_help \ + "($help)--attachable[Enable manual container attachment]" \ "($help)*--aux-address[Auxiliary IPv4 or IPv6 addresses used by network driver]:key=IP: " \ "($help -d --driver)"{-d=,--driver=}"[Driver to manage the Network]:driver:(null host bridge overlay)" \ "($help)*--gateway=[IPv4 or IPv6 Gateway for the master subnet]:IP: " \ @@ -622,14 +1179,14 @@ __docker_network_subcommand() { (disconnect) _arguments $(__docker_arguments) \ $opts_help \ - "($help -)1:network:__docker_networks" \ - "($help -)2:containers:__docker_containers" && ret=0 + "($help -)1:network:__docker_complete_networks" \ + "($help -)2:containers:__docker_complete_containers" && ret=0 ;; (inspect) _arguments $(__docker_arguments) \ $opts_help \ "($help -f --format)"{-f=,--format=}"[Format the output using the given go template]:template: " \ - "($help -)*:network:__docker_networks" && ret=0 + "($help -)*:network:__docker_complete_networks" && ret=0 ;; (ls) _arguments $(__docker_arguments) \ @@ -644,10 +1201,15 @@ __docker_network_subcommand() { ;; esac ;; + (prune) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -f --force)"{-f,--force}"[Do not prompt for confirmation]" && ret=0 + ;; (rm) _arguments $(__docker_arguments) \ $opts_help \ - "($help -)*:network:__docker_networks" && ret=0 + "($help -)*:network:__docker_complete_networks" && ret=0 ;; (help) _arguments $(__docker_arguments) ":subcommand:__docker_network_commands" && ret=0 @@ -814,7 +1376,7 @@ __docker_node_subcommand() { (rm|remove) _arguments $(__docker_arguments) \ $opts_help \ - "($help)--force[Force remove an active node]" \ + "($help -f --force)"{-f,--force}"[Force remove a node from the swarm]" \ "($help -)*:node:__docker_complete_pending_nodes" && ret=0 ;; (demote) @@ -956,6 +1518,107 @@ __docker_plugin_subcommand() { # EO plugin +# BO secret + +__docker_secrets() { + [[ $PREFIX = -* ]] && return 1 + integer ret=1 + local line s + declare -a lines secrets + + type=$1; shift + + lines=(${(f)${:-"$(_call_program commands docker $docker_options secret ls)"$'\n'}}) + + # Parse header line to find columns + local i=1 j=1 k header=${lines[1]} + declare -A begin end + while (( j < ${#header} - 1 )); do + i=$(( j + ${${header[$j,-1]}[(i)[^ ]]} - 1 )) + j=$(( i + ${${header[$i,-1]}[(i) ]} - 1 )) + k=$(( j + ${${header[$j,-1]}[(i)[^ ]]} - 2 )) + begin[${header[$i,$((j-1))]}]=$i + end[${header[$i,$((j-1))]}]=$k + done + end[${header[$i,$((j-1))]}]=-1 + lines=(${lines[2,-1]}) + + # ID + if [[ $type = (ids|all) ]]; then + for line in $lines; do + s="${line[${begin[ID]},${end[ID]}]%% ##}" + secrets=($secrets $s) + done + fi + + # Names + if [[ $type = (names|all) ]]; then + for line in $lines; do + s="${line[${begin[NAME]},${end[NAME]}]%% ##}" + secrets=($secrets $s) + done + fi + + _describe -t secrets-list "secrets" secrets "$@" && ret=0 + return ret +} + +__docker_complete_secrets() { + [[ $PREFIX = -* ]] && return 1 + __docker_secrets all "$@" +} + +__docker_secret_commands() { + local -a _docker_secret_subcommands + _docker_secret_subcommands=( + "create:Create a secret using stdin as content" + "inspect:Display detailed information on one or more secrets" + "ls:List secrets" + "rm:Remove one or more secrets" + ) + _describe -t docker-secret-commands "docker secret command" _docker_secret_subcommands +} + +__docker_secret_subcommand() { + local -a _command_args opts_help + local expl help="--help" + integer ret=1 + + opts_help=("(: -)--help[Print usage]") + + case "$words[1]" in + (create) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help)*"{-l=,--label=}"[Secret labels]:label: " \ + "($help -):secret: " && ret=0 + ;; + (inspect) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -f --format)"{-f=,--format=}"[Format the output using the given Go template]:template: " \ + "($help -)*:secret:__docker_complete_secrets" && ret=0 + ;; + (ls|list) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -q --quiet)"{-q,--quiet}"[Only display IDs]" && ret=0 + ;; + (rm|remove) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -)*:secret:__docker_complete_secrets" && ret=0 + ;; + (help) + _arguments $(__docker_arguments) ":subcommand:__docker_secret_commands" && ret=0 + ;; + esac + + return ret +} + +# EO secret + # BO service __docker_service_complete_ls_filters() { @@ -1071,7 +1734,7 @@ __docker_service_commands() { "inspect:Display detailed information on one or more services" "ls:List services" "rm:Remove one or more services" - "scale:Scale one or multiple services" + "scale:Scale one or multiple replicated services" "ps:List the tasks of a service" "update:Update a service" ) @@ -1088,15 +1751,19 @@ __docker_service_subcommand() { "($help)*--constraint=[Placement constraints]:constraint: " "($help)--endpoint-mode=[Placement constraints]:mode:(dnsrr vip)" "($help)*"{-e=,--env=}"[Set environment variables]:env: " - "($help)*--group-add=[Add additional user groups to the container]:group:_groups" + "($help)--health-cmd=[Command to run to check health]:command: " + "($help)--health-interval=[Time between running the check]:time: " + "($help)--health-retries=[Consecutive failures needed to report unhealthy]:retries:(1 2 3 4 5)" + "($help)--health-timeout=[Maximum time to allow one check to run]:time: " + "($help)--hostname=[Service container hostname]:hostname: " \ "($help)*--label=[Service labels]:label: " "($help)--limit-cpu=[Limit CPUs]:value: " "($help)--limit-memory=[Limit Memory]:value: " - "($help)--log-driver=[Logging driver for service]:logging driver:__docker_log_drivers" - "($help)*--log-opt=[Logging driver options]:log driver options:__docker_log_options" - "($help)*--mount=[Attach a mount to the service]:mount: " - "($help)--name=[Service name]:name: " + "($help)--log-driver=[Logging driver for service]:logging driver:__docker_complete_log_drivers" + "($help)*--log-opt=[Logging driver options]:log driver options:__docker_complete_log_options" + "($help)*--mount=[Attach a filesystem mount to the service]:mount: " "($help)*--network=[Network attachments]:network: " + "($help)--no-healthcheck[Disable any container-specified HEALTHCHECK]" "($help)*"{-p=,--publish=}"[Publish a port as a node port]:port: " "($help)--replicas=[Number of tasks]:replicas: " "($help)--reserve-cpu=[Reserve CPUs]:value: " @@ -1105,7 +1772,9 @@ __docker_service_subcommand() { "($help)--restart-delay=[Delay between restart attempts]:delay: " "($help)--restart-max-attempts=[Maximum number of restarts before giving up]:max-attempts: " "($help)--restart-window=[Window used to evaluate the restart policy]:window: " + "($help)*--secret=[Specify secrets to expose to the service]:secret:__docker_complete_secrets" "($help)--stop-grace-period=[Time to wait before force killing a container]:grace period: " + "($help -t --tty)"{-t,--tty}"[Allocate a pseudo-TTY]" "($help)--update-delay=[Delay between updates]:delay: " "($help)--update-failure-action=[Action on update failure]:mode:(pause continue)" "($help)--update-max-failure-ratio=[Failure rate to tolerate during an update]:fraction: " @@ -1122,8 +1791,14 @@ __docker_service_subcommand() { $opts_help \ $opts_create_update \ "($help)*--container-label=[Container labels]:label: " \ + "($help)*--dns=[Set custom DNS servers]:DNS: " \ + "($help)*--dns-option=[Set DNS options]:DNS option: " \ + "($help)*--dns-search=[Set custom DNS search domains]:DNS search: " \ + "($help)*--env-file=[Read environment variables from a file]:environment file:_files" \ "($help)--mode=[Service Mode]:mode:(global replicated)" \ - "($help -): :__docker_images" \ + "($help)--name=[Service name]:name: " \ + "($help)*--publish=[Publish a port]:port: " \ + "($help -): :__docker_complete_images" \ "($help -):command: _command_names -e" \ "($help -)*::arguments: _normal" && ret=0 ;; @@ -1167,10 +1842,10 @@ __docker_service_subcommand() { (ps) _arguments $(__docker_arguments) \ $opts_help \ - "($help -a --all)"{-a,--all}"[Display all tasks]" \ "($help)*"{-f=,--filter=}"[Provide filter values]:filter:->filter-options" \ "($help)--no-resolve[Do not map IDs to Names]" \ "($help)--no-trunc[Do not truncate output]" \ + "($help -q --quiet)"{-q,--quiet}"[Only display task IDs]" \ "($help -)1:service:__docker_complete_services" && ret=0 case $state in (filter-options) @@ -1185,9 +1860,18 @@ __docker_service_subcommand() { "($help)--arg=[Service command args]:arguments: _normal" \ "($help)*--container-label-add=[Add or update container labels]:label: " \ "($help)*--container-label-rm=[Remove a container label by its key]:label: " \ + "($help)*--dns-add=[Add or update custom DNS servers]:DNS: " \ + "($help)*--dns-rm=[Remove custom DNS servers]:DNS: " \ + "($help)*--dns-option-add=[Add or update DNS options]:DNS option: " \ + "($help)*--dns-option-rm=[Remove DNS options]:DNS option: " \ + "($help)*--dns-search-add=[Add or update custom DNS search domains]:DNS search: " \ + "($help)*--dns-search-rm=[Remove DNS search domains]:DNS search: " \ "($help)--force[Force update]" \ - "($help)*--group-rm=[Remove previously added user groups from the container]:group:_groups" \ - "($help)--image=[Service image tag]:image:__docker_repositories" \ + "($help)*--group-add=[Add additional supplementary user groups to the container]:group:_groups" \ + "($help)*--group-rm=[Remove previously added supplementary user groups from the container]:group:_groups" \ + "($help)--image=[Service image tag]:image:__docker_complete_repositories" \ + "($help)*--publish-add=[Add or update a port]:port: " \ + "($help)*--publish-rm=[Remove a port(target-port mandatory)]:port: " \ "($help)--rollback[Rollback to previous specification]" \ "($help -)1:service:__docker_complete_services" && ret=0 ;; @@ -1201,6 +1885,147 @@ __docker_service_subcommand() { # EO service +# BO stack + +__docker_stack_complete_ps_filters() { + [[ $PREFIX = -* ]] && return 1 + integer ret=1 + + if compset -P '*='; then + case "${${words[-1]%=*}#*=}" in + (desired-state) + state_opts=('accepted' 'running') + _describe -t state-opts "desired state options" state_opts && ret=0 + ;; + *) + _message 'value' && ret=0 + ;; + esac + else + opts=('desired-state' 'id' 'name') + _describe -t filter-opts "filter options" opts -qS "=" && ret=0 + fi + + return ret +} + +__docker_stack_complete_services_filters() { + [[ $PREFIX = -* ]] && return 1 + integer ret=1 + + if compset -P '*='; then + case "${${words[-1]%=*}#*=}" in + *) + _message 'value' && ret=0 + ;; + esac + else + opts=('id' 'label' 'name') + _describe -t filter-opts "filter options" opts -qS "=" && ret=0 + fi + + return ret +} + +__docker_stacks() { + [[ $PREFIX = -* ]] && return 1 + integer ret=1 + local line s + declare -a lines stacks + + lines=(${(f)${:-"$(_call_program commands docker $docker_options stack ls)"$'\n'}}) + + # Parse header line to find columns + local i=1 j=1 k header=${lines[1]} + declare -A begin end + while (( j < ${#header} - 1 )); do + i=$(( j + ${${header[$j,-1]}[(i)[^ ]]} - 1 )) + j=$(( i + ${${header[$i,-1]}[(i) ]} - 1 )) + k=$(( j + ${${header[$j,-1]}[(i)[^ ]]} - 2 )) + begin[${header[$i,$((j-1))]}]=$i + end[${header[$i,$((j-1))]}]=$k + done + end[${header[$i,$((j-1))]}]=-1 + lines=(${lines[2,-1]}) + + # Service ID + for line in $lines; do + s="${line[${begin[ID]},${end[ID]}]%% ##}" + stacks=($stacks $s) + done + + _describe -t stacks-list "stacks" stacks "$@" && ret=0 + return ret +} + +__docker_complete_stacks() { + [[ $PREFIX = -* ]] && return 1 + __docker_stacks "$@" +} + +__docker_stack_commands() { + local -a _docker_stack_subcommands + _docker_stack_subcommands=( + "deploy:Deploy a new stack or update an existing stack" + "ls:List stacks" + "ps:List the tasks in the stack" + "rm:Remove the stack" + "services:List the services in the stack" + ) + _describe -t docker-stack-commands "docker stack command" _docker_stack_subcommands +} + +__docker_stack_subcommand() { + local -a _command_args opts_help + local expl help="--help" + integer ret=1 + + opts_help=("(: -)--help[Print usage]") + + case "$words[1]" in + (deploy|up) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help)--bundle-file=[Path to a Distributed Application Bundle file]:dab:_files -g \"*.dab\"" \ + "($help -c --compose-file)"{-c=,--compose-file=}"[Path to a Compose file]:compose file:_files -g \"*.(yml|yaml)\"" \ + "($help)--with-registry-auth[Send registry authentication details to Swarm agents]" \ + "($help -):stack:__docker_complete_stacks" && ret=0 + ;; + (ls|list) + _arguments $(__docker_arguments) \ + $opts_help && ret=0 + ;; + (ps) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -a --all)"{-a,--all}"[Display all tasks]" \ + "($help)*"{-f=,--filter=}"[Filter output based on conditions provided]:filter:__docker_stack_complete_ps_filters" \ + "($help)--no-resolve[Do not map IDs to Names]" \ + "($help)--no-trunc[Do not truncate output]" \ + "($help -):stack:__docker_complete_stacks" && ret=0 + ;; + (rm|remove|down) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -):stack:__docker_complete_stacks" && ret=0 + ;; + (services) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help)*"{-f=,--filter=}"[Filter output based on conditions provided]:filter:__docker_stack_complete_services_filters" \ + "($help -q --quiet)"{-q,--quiet}"[Only display IDs]" \ + "($help -):stack:__docker_complete_stacks" && ret=0 + ;; + (help) + _arguments $(__docker_arguments) ":subcommand:__docker_stack_commands" && ret=0 + ;; + esac + + return ret +} + +# EO stack + # BO swarm __docker_swarm_commands() { @@ -1229,7 +2054,10 @@ __docker_swarm_subcommand() { "($help)--advertise-addr[Advertised address]:ip\:port: " \ "($help)*--external-ca=[Specifications of one or more certificate signing endpoints]:endpoint: " \ "($help)--force-new-cluster[Force create a new cluster from current state]" \ - "($help)--listen-addr=[Listen address]:ip\:port: " && ret=0 + "($help)--listen-addr=[Listen address]:ip\:port: " \ + "($help)--max-snapshots[Number of additional Raft snapshots to retain]" \ + "($help)--snapshot-interval[Number of log entries between Raft snapshots]" \ + "($help)--task-history-limit=[Task history retention limit]:limit: " && ret=0 ;; (join) _arguments $(__docker_arguments) \ @@ -1248,13 +2076,17 @@ __docker_swarm_subcommand() { ;; (leave) _arguments $(__docker_arguments) \ - $opts_help && ret=0 + $opts_help \ + "($help -f --force)"{-f,--force}"[Force this node to leave the swarm, ignoring warnings]" && ret=0 ;; (update) _arguments $(__docker_arguments) \ $opts_help \ "($help)--cert-expiry=[Validity period for node certificates]:duration: " \ + "($help)*--external-ca=[Specifications of one or more certificate signing endpoints]:endpoint: " \ "($help)--dispatcher-heartbeat=[Dispatcher heartbeat period]:duration: " \ + "($help)--max-snapshots[Number of additional Raft snapshots to retain]" \ + "($help)--snapshot-interval[Number of log entries between Raft snapshots]" \ "($help)--task-history-limit=[Task history retention limit]:limit: " && ret=0 ;; (help) @@ -1267,6 +2099,61 @@ __docker_swarm_subcommand() { # EO swarm +# BO system + +__docker_system_commands() { + local -a _docker_system_subcommands + _docker_system_subcommands=( + "df:Show docker filesystem usage" + "events:Get real time events from the server" + "info:Display system-wide information" + "prune:Remove unused data" + ) + _describe -t docker-system-commands "docker system command" _docker_system_subcommands +} + +__docker_system_subcommand() { + local -a _command_args opts_help + local expl help="--help" + integer ret=1 + + opts_help=("(: -)--help[Print usage]") + + case "$words[1]" in + (df) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -v --verbose)"{-v,--verbose}"[Show detailed information on space usage]" && ret=0 + ;; + (events) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help)*"{-f=,--filter=}"[Filter values]:filter:__docker_complete_events_filter" \ + "($help)--since=[Events created since this timestamp]:timestamp: " \ + "($help)--until=[Events created until this timestamp]:timestamp: " \ + "($help)--format=[Format the output using the given go template]:template: " && ret=0 + ;; + (info) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -f --format)"{-f=,--format=}"[Format the output using the given go template]:template: " && ret=0 + ;; + (prune) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -a --all)"{-a,--all}"[Remove all unused data, not just dangling ones]" \ + "($help -f --force)"{-f,--force}"[Do not prompt for confirmation]" && ret=0 + ;; + (help) + _arguments $(__docker_arguments) ":subcommand:__docker_volume_commands" && ret=0 + ;; + esac + + return ret +} + +# EO system + # BO volume __docker_volume_complete_ls_filters() { @@ -1283,7 +2170,7 @@ __docker_volume_complete_ls_filters() { __docker_complete_info_plugins Volume && ret=0 ;; (name) - __docker_volumes && ret=0 + __docker_complete_volumes && ret=0 ;; *) _message 'value' && ret=0 @@ -1297,7 +2184,7 @@ __docker_volume_complete_ls_filters() { return ret } -__docker_volumes() { +__docker_complete_volumes() { [[ $PREFIX = -* ]] && return 1 integer ret=1 declare -a lines volumes @@ -1335,6 +2222,7 @@ __docker_volume_commands() { "create:Create a volume" "inspect:Display detailed information on one or more volumes" "ls:List volumes" + "prune:Remove all unused volumes" "rm:Remove one or more volumes" ) _describe -t docker-volume-commands "docker volume command" _docker_volume_subcommands @@ -1360,7 +2248,7 @@ __docker_volume_subcommand() { _arguments $(__docker_arguments) \ $opts_help \ "($help -f --format)"{-f=,--format=}"[Format the output using the given go template]:template: " \ - "($help -)1:volume:__docker_volumes" && ret=0 + "($help -)1:volume:__docker_complete_volumes" && ret=0 ;; (ls) _arguments $(__docker_arguments) \ @@ -1374,11 +2262,16 @@ __docker_volume_subcommand() { ;; esac ;; + (prune) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -f --force)"{-f,--force}"[Do not prompt for confirmation]" && ret=0 + ;; (rm) _arguments $(__docker_arguments) \ $opts_help \ "($help -f --force)"{-f,--force}"[Force the removal of one or more volumes]" \ - "($help -):volume:__docker_volumes" && ret=0 + "($help -):volume:__docker_complete_volumes" && ret=0 ;; (help) _arguments $(__docker_arguments) ":subcommand:__docker_volume_commands" && ret=0 @@ -1408,7 +2301,7 @@ __docker_commands() { then local -a lines lines=(${(f)"$(_call_program commands docker 2>&1)"}) - _docker_subcommands=(${${${lines[$((${lines[(i)Commands:]} + 1)),${lines[(I) *]}]}## #}/ ##/:}) + _docker_subcommands=(${${${(M)${lines[$((${lines[(i)*Commands:]} + 1)),-1]}:# *}## #}/ ##/:}) _docker_subcommands=($_docker_subcommands 'daemon:Enable daemon mode' 'help:Show help for a command') (( $#_docker_subcommands > 2 )) && _store_cache docker_subcommands _docker_subcommands fi @@ -1416,188 +2309,61 @@ __docker_commands() { } __docker_subcommand() { - local -a _command_args opts_help opts_build_create_run opts_build_create_run_update opts_create_run opts_create_run_update + local -a _command_args opts_help local expl help="--help" integer ret=1 opts_help=("(: -)--help[Print usage]") - opts_build_create_run=( - "($help)--cgroup-parent=[Parent cgroup for the container]:cgroup: " - "($help)--isolation=[Container isolation technology]:isolation:(default hyperv process)" - "($help)--disable-content-trust[Skip image verification]" - "($help)*--shm-size=[Size of '/dev/shm' (format is '')]:shm size: " - "($help)*--ulimit=[ulimit options]:ulimit: " - "($help)--userns=[Container user namespace]:user namespace:(host)" - ) - opts_build_create_run_update=( - "($help -c --cpu-shares)"{-c=,--cpu-shares=}"[CPU shares (relative weight)]:CPU shares:(0 10 100 200 500 800 1000)" - "($help)--cpu-period=[Limit the CPU CFS (Completely Fair Scheduler) period]:CPU period: " - "($help)--cpu-quota=[Limit the CPU CFS (Completely Fair Scheduler) quota]:CPU quota: " - "($help)--cpuset-cpus=[CPUs in which to allow execution]:CPUs: " - "($help)--cpuset-mems=[MEMs in which to allow execution]:MEMs: " - "($help -m --memory)"{-m=,--memory=}"[Memory limit]:Memory limit: " - "($help)--memory-swap=[Total memory limit with swap]:Memory limit: " - ) - opts_create_run=( - "($help -a --attach)"{-a=,--attach=}"[Attach to stdin, stdout or stderr]:device:(STDIN STDOUT STDERR)" - "($help)*--add-host=[Add a custom host-to-IP mapping]:host\:ip mapping: " - "($help)*--blkio-weight-device=[Block IO (relative device weight)]:device:Block IO weight: " - "($help)*--cap-add=[Add Linux capabilities]:capability: " - "($help)*--cap-drop=[Drop Linux capabilities]:capability: " - "($help)--cidfile=[Write the container ID to the file]:CID file:_files" - "($help)*--device=[Add a host device to the container]:device:_files" - "($help)*--device-read-bps=[Limit the read rate (bytes per second) from a device]:device:IO rate: " - "($help)*--device-read-iops=[Limit the read rate (IO per second) from a device]:device:IO rate: " - "($help)*--device-write-bps=[Limit the write rate (bytes per second) to a device]:device:IO rate: " - "($help)*--device-write-iops=[Limit the write rate (IO per second) to a device]:device:IO rate: " - "($help)*--dns=[Custom DNS servers]:DNS server: " - "($help)*--dns-opt=[Custom DNS options]:DNS option: " - "($help)*--dns-search=[Custom DNS search domains]:DNS domains: " - "($help)*"{-e=,--env=}"[Environment variables]:environment variable: " - "($help)--entrypoint=[Overwrite the default entrypoint of the image]:entry point: " - "($help)*--env-file=[Read environment variables from a file]:environment file:_files" - "($help)*--expose=[Expose a port from the container without publishing it]: " - "($help)*--group-add=[Add additional groups to run as]:group:_groups" - "($help -h --hostname)"{-h=,--hostname=}"[Container host name]:hostname:_hosts" - "($help -i --interactive)"{-i,--interactive}"[Keep stdin open even if not attached]" - "($help)--ip=[Container IPv4 address]:IPv4: " - "($help)--ip6=[Container IPv6 address]:IPv6: " - "($help)--ipc=[IPC namespace to use]:IPC namespace: " - "($help)*--link=[Add link to another container]:link:->link" - "($help)*--link-local-ip=[Add a link-local address for the container]:IPv4/IPv6: " - "($help)*"{-l=,--label=}"[Container metadata]:label: " - "($help)--log-driver=[Default driver for container logs]:logging driver:__docker_log_drivers" - "($help)*--log-opt=[Log driver specific options]:log driver options:__docker_log_options" - "($help)--mac-address=[Container MAC address]:MAC address: " - "($help)--name=[Container name]:name: " - "($help)--network=[Connect a container to a network]:network mode:(bridge none container host)" - "($help)*--network-alias=[Add network-scoped alias for the container]:alias: " - "($help)--oom-kill-disable[Disable OOM Killer]" - "($help)--oom-score-adj[Tune the host's OOM preferences for containers (accepts -1000 to 1000)]" - "($help)--pids-limit[Tune container pids limit (set -1 for unlimited)]" - "($help -P --publish-all)"{-P,--publish-all}"[Publish all exposed ports]" - "($help)*"{-p=,--publish=}"[Expose a container's port to the host]:port:_ports" - "($help)--pid=[PID namespace to use]:PID namespace:__docker_complete_pid" - "($help)--privileged[Give extended privileges to this container]" - "($help)--read-only[Mount the container's root filesystem as read only]" - "($help)*--security-opt=[Security options]:security option: " - "($help)*--sysctl=-[sysctl options]:sysctl: " - "($help -t --tty)"{-t,--tty}"[Allocate a pseudo-tty]" - "($help -u --user)"{-u=,--user=}"[Username or UID]:user:_users" - "($help)--tmpfs[mount tmpfs]" - "($help)*-v[Bind mount a volume]:volume: " - "($help)--volume-driver=[Optional volume driver for the container]:volume driver:(local)" - "($help)*--volumes-from=[Mount volumes from the specified container]:volume: " - "($help -w --workdir)"{-w=,--workdir=}"[Working directory inside the container]:directory:_directories" - ) - opts_create_run_update=( - "($help)--blkio-weight=[Block IO (relative weight), between 10 and 1000]:Block IO weight:(10 100 500 1000)" - "($help)--kernel-memory=[Kernel memory limit in bytes]:Memory limit: " - "($help)--memory-reservation=[Memory soft limit]:Memory limit: " - "($help)--restart=[Restart policy]:restart policy:(no on-failure always unless-stopped)" - ) - opts_attach_exec_run_start=( - "($help)--detach-keys=[Escape key sequence used to detach a container]:sequence:__docker_complete_detach_keys" - ) case "$words[1]" in - (attach) - _arguments $(__docker_arguments) \ - $opts_help \ - $opts_attach_exec_run_start \ - "($help)--no-stdin[Do not attach stdin]" \ - "($help)--sig-proxy[Proxy all received signals to the process (non-TTY mode only)]" \ - "($help -):containers:__docker_runningcontainers" && ret=0 + (attach|commit|cp|create|diff|exec|export|kill|logs|pause|unpause|port|rename|restart|rm|run|start|stats|stop|top|update|wait) + __docker_container_subcommand && ret=0 ;; - (build) - _arguments $(__docker_arguments) \ - $opts_help \ - $opts_build_create_run \ - $opts_build_create_run_update \ - "($help)*--build-arg[Build-time variables]:=: " \ - "($help)--compress[Compress the build context using gzip]" \ - "($help -f --file)"{-f=,--file=}"[Name of the Dockerfile]:Dockerfile:_files" \ - "($help)--force-rm[Always remove intermediate containers]" \ - "($help)*--label=[Set metadata for an image]:label=value: " \ - "($help)--no-cache[Do not use cache when building the image]" \ - "($help)--pull[Attempt to pull a newer version of the image]" \ - "($help -q --quiet)"{-q,--quiet}"[Suppress verbose build output]" \ - "($help)--rm[Remove intermediate containers after a successful build]" \ - "($help -t --tag)*"{-t=,--tag=}"[Repository, name and tag for the image]: :__docker_repositories_with_tags" \ - "($help -):path or URL:_directories" && ret=0 + (build|history|import|load|pull|push|save|tag) + __docker_image_subcommand && ret=0 ;; - (commit) + (container) + local curcontext="$curcontext" state _arguments $(__docker_arguments) \ $opts_help \ - "($help -a --author)"{-a=,--author=}"[Author]:author: " \ - "($help)*"{-c=,--change=}"[Apply Dockerfile instruction to the created image]:Dockerfile:_files" \ - "($help -m --message)"{-m=,--message=}"[Commit message]:message: " \ - "($help -p --pause)"{-p,--pause}"[Pause container during commit]" \ - "($help -):container:__docker_containers" \ - "($help -): :__docker_repositories_with_tags" && ret=0 - ;; - (cp) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help -L --follow-link)"{-L,--follow-link}"[Always follow symbol link]" \ - "($help -)1:container:->container" \ - "($help -)2:hostpath:_files" && ret=0 - case $state in - (container) - if compset -P "*:"; then - _files && ret=0 - else - __docker_containers -qS ":" && ret=0 - fi - ;; - esac - ;; - (create) - _arguments $(__docker_arguments) \ - $opts_help \ - $opts_build_create_run \ - $opts_build_create_run_update \ - $opts_create_run \ - $opts_create_run_update \ - "($help -): :__docker_images" \ - "($help -):command: _command_names -e" \ - "($help -)*::arguments: _normal" && ret=0 + "($help -): :->command" \ + "($help -)*:: :->option-or-argument" && ret=0 case $state in - (link) - if compset -P "*:"; then - _wanted alias expl "Alias" compadd -E "" && ret=0 - else - __docker_runningcontainers -qS ":" && ret=0 - fi + (command) + __docker_container_commands && ret=0 + ;; + (option-or-argument) + curcontext=${curcontext%:*:*}:docker-${words[-1]}: + __docker_container_subcommand && ret=0 ;; esac - ;; (daemon) _arguments $(__docker_arguments) \ $opts_help \ "($help)*--add-runtime=[Register an additional OCI compatible runtime]:runtime:__docker_complete_runtimes" \ - "($help)--api-cors-header=[CORS headers in the remote API]:CORS headers: " \ + "($help)--api-cors-header=[CORS headers in the Engine API]:CORS headers: " \ "($help)*--authorization-plugin=[Authorization plugins to load]" \ "($help -b --bridge)"{-b=,--bridge=}"[Attach containers to a network bridge]:bridge:_net_interfaces" \ "($help)--bip=[Network bridge IP]:IP address: " \ "($help)--cgroup-parent=[Parent cgroup for all containers]:cgroup: " \ + "($help)--cluster-advertise=[Address or interface name to advertise]:Instance to advertise (host\:port): " \ + "($help)--cluster-store=[URL of the distributed storage backend]:Cluster Store:->cluster-store" \ + "($help)*--cluster-store-opt=[Cluster store options]:Cluster options:->cluster-store-options" \ "($help)--config-file=[Path to daemon configuration file]:Config File:_files" \ "($help)--containerd=[Path to containerd socket]:socket:_files -g \"*.sock\"" \ "($help -D --debug)"{-D,--debug}"[Enable debug mode]" \ "($help)--default-gateway[Container default gateway IPv4 address]:IPv4 address: " \ "($help)--default-gateway-v6[Container default gateway IPv6 address]:IPv6 address: " \ - "($help)--cluster-store=[URL of the distributed storage backend]:Cluster Store:->cluster-store" \ - "($help)--cluster-advertise=[Address or interface name to advertise]:Instance to advertise (host\:port): " \ - "($help)*--cluster-store-opt=[Cluster store options]:Cluster options:->cluster-store-options" \ - "($help)*--dns=[DNS server to use]:DNS: " \ - "($help)*--dns-search=[DNS search domains to use]:DNS search: " \ - "($help)*--dns-opt=[DNS options to use]:DNS option: " \ "($help)*--default-ulimit=[Default ulimits for containers]:ulimit: " \ "($help)--disable-legacy-registry[Disable contacting legacy registries]" \ + "($help)*--dns=[DNS server to use]:DNS: " \ + "($help)*--dns-opt=[DNS options to use]:DNS option: " \ + "($help)*--dns-search=[DNS search domains to use]:DNS search: " \ "($help)*--exec-opt=[Runtime execution options]:runtime execution options: " \ "($help)--exec-root=[Root directory for execution state files]:path:_directories" \ + "($help)--experimental[Enable experimental features]" \ "($help)--fixed-cidr=[IPv4 subnet for fixed IPs]:IPv4 subnet: " \ "($help)--fixed-cidr-v6=[IPv6 subnet for fixed IPs]:IPv6 subnet: " \ "($help -G --group)"{-G=,--group=}"[Group for the unix socket]:group:_groups" \ @@ -1614,8 +2380,8 @@ __docker_subcommand() { "($help -l --log-level)"{-l=,--log-level=}"[Logging level]:level:(debug info warn error fatal)" \ "($help)*--label=[Key=value labels]:label: " \ "($help)--live-restore[Enable live restore of docker when containers are still running]" \ - "($help)--log-driver=[Default driver for container logs]:logging driver:__docker_log_drivers" \ - "($help)*--log-opt=[Default log driver options for containers]:log driver options:__docker_log_options" \ + "($help)--log-driver=[Default driver for container logs]:logging driver:__docker_complete_log_drivers" \ + "($help)*--log-opt=[Default log driver options for containers]:log driver options:__docker_complete_log_options" \ "($help)--max-concurrent-downloads[Set the max concurrent downloads for each pull]" \ "($help)--max-concurrent-uploads[Set the max concurrent uploads for each push]" \ "($help)--mtu=[Network MTU]:mtu:(0 576 1420 1500 9000)" \ @@ -1623,8 +2389,10 @@ __docker_subcommand() { "($help -p --pidfile)"{-p=,--pidfile=}"[Path to use for daemon PID file]:PID file:_files" \ "($help)--raw-logs[Full timestamps without ANSI coloring]" \ "($help)*--registry-mirror=[Preferred Docker registry mirror]:registry mirror: " \ + "($help)--seccomp-profile=[Path to seccomp profile]:path:_files -g \"*.json\"" \ "($help -s --storage-driver)"{-s=,--storage-driver=}"[Storage driver to use]:driver:(aufs btrfs devicemapper overlay overlay2 vfs zfs)" \ "($help)--selinux-enabled[Enable selinux support]" \ + "($help)--shutdown-timeout=[Set the shutdown timeout value in seconds]:time: " \ "($help)*--storage-opt=[Storage driver options]:storage driver options: " \ "($help)--tls[Use TLS]" \ "($help)--tlscacert=[Trust certs signed only by this CA]:PEM file:_files -g \"*.(pem|crt)\"" \ @@ -1632,7 +2400,8 @@ __docker_subcommand() { "($help)--tlskey=[Path to TLS key file]:Key file:_files -g \"*.(pem|key)\"" \ "($help)--tlsverify[Use TLS and verify the remote]" \ "($help)--userns-remap=[User/Group setting for user namespaces]:user\:group:->users-groups" \ - "($help)--userland-proxy[Use userland proxy for loopback traffic]" && ret=0 + "($help)--userland-proxy[Use userland proxy for loopback traffic]" \ + "($help)--userland-proxy-path=[Path to the userland proxy binary]:binary:_files" && ret=0 case $state in (cluster-store) @@ -1661,84 +2430,29 @@ __docker_subcommand() { ;; esac ;; - (diff) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help -)*:containers:__docker_containers" && ret=0 + (events|info) + __docker_system_subcommand && ret=0 ;; - (events) + (image) + local curcontext="$curcontext" state _arguments $(__docker_arguments) \ $opts_help \ - "($help)*"{-f=,--filter=}"[Filter values]:filter:__docker_complete_events_filter" \ - "($help)--since=[Events created since this timestamp]:timestamp: " \ - "($help)--until=[Events created until this timestamp]:timestamp: " \ - "($help)--format=[Format the output using the given go template]:template: " && ret=0 - ;; - (exec) - local state - _arguments $(__docker_arguments) \ - $opts_help \ - $opts_attach_exec_run_start \ - "($help -d --detach)"{-d,--detach}"[Detached mode: leave the container running in the background]" \ - "($help -e --env)"{-e,--env}"[Set environment variables]" \ - "($help -i --interactive)"{-i,--interactive}"[Keep stdin open even if not attached]" \ - "($help)--privileged[Give extended Linux capabilities to the command]" \ - "($help -t --tty)"{-t,--tty}"[Allocate a pseudo-tty]" \ - "($help -u --user)"{-u=,--user=}"[Username or UID]:user:_users" \ - "($help -):containers:__docker_runningcontainers" \ - "($help -)*::command:->anycommand" && ret=0 + "($help -): :->command" \ + "($help -)*:: :->option-or-argument" && ret=0 case $state in - (anycommand) - shift 1 words - (( CURRENT-- )) - _normal && ret=0 + (command) + __docker_image_commands && ret=0 + ;; + (option-or-argument) + curcontext=${curcontext%:*:*}:docker-${words[-1]}: + __docker_image_subcommand && ret=0 ;; esac ;; - (export) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help -o --output)"{-o=,--output=}"[Write to a file, instead of stdout]:output file:_files" \ - "($help -)*:containers:__docker_containers" && ret=0 - ;; - (history) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help -H --human)"{-H,--human}"[Print sizes and dates in human readable format]" \ - "($help)--no-trunc[Do not truncate output]" \ - "($help -q --quiet)"{-q,--quiet}"[Only show numeric IDs]" \ - "($help -)*: :__docker_images" && ret=0 - ;; (images) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help -a --all)"{-a,--all}"[Show all images]" \ - "($help)--digests[Show digests]" \ - "($help)*"{-f=,--filter=}"[Filter values]:filter:->filter-options" \ - "($help)--format=[Pretty-print images using a Go template]:template: " \ - "($help)--no-trunc[Do not truncate output]" \ - "($help -q --quiet)"{-q,--quiet}"[Only show numeric IDs]" \ - "($help -): :__docker_repositories" && ret=0 - - case $state in - (filter-options) - __docker_complete_images_filters && ret=0 - ;; - esac - ;; - (import) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help)*"{-c=,--change=}"[Apply Dockerfile instruction to the created image]:Dockerfile:_files" \ - "($help -m --message)"{-m=,--message=}"[Commit message for imported image]:message: " \ - "($help -):URL:(- http:// file://)" \ - "($help -): :__docker_repositories_with_tags" && ret=0 - ;; - (info|version) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help -f --format)"{-f=,--format=}"[Format the output using the given go template]:template: " && ret=0 + words[1]='ls' + __docker_image_subcommand && ret=0 ;; (inspect) local state @@ -1746,33 +2460,37 @@ __docker_subcommand() { $opts_help \ "($help -f --format)"{-f=,--format=}"[Format the output using the given go template]:template: " \ "($help -s --size)"{-s,--size}"[Display total file sizes if the type is container]" \ - "($help)--type=[Return JSON for specified type]:type:(image container)" \ + "($help)--type=[Return JSON for specified type]:type:(container image network node plugin service volume)" \ "($help -)*: :->values" && ret=0 case $state in (values) if [[ ${words[(r)--type=container]} == --type=container ]]; then - __docker_containers && ret=0 + __docker_complete_containers && ret=0 elif [[ ${words[(r)--type=image]} == --type=image ]]; then - __docker_images && ret=0 + __docker_complete_images && ret=0 + elif [[ ${words[(r)--type=network]} == --type=network ]]; then + __docker_complete_networks && ret=0 + elif [[ ${words[(r)--type=node]} == --type=node ]]; then + __docker_complete_nodes && ret=0 + elif [[ ${words[(r)--type=plugin]} == --type=plugin ]]; then + __docker_complete_plugins && ret=0 + elif [[ ${words[(r)--type=service]} == --type=service ]]; then + __docker_complete_services && ret=0 + elif [[ ${words[(r)--type=volume]} == --type=volume ]]; then + __docker_complete_volumes && ret=0 else - __docker_images && __docker_containers && ret=0 + __docker_complete_containers + __docker_complete_images + __docker_complete_networks + __docker_complete_nodes + __docker_complete_plugins + __docker_complete_services + __docker_complete_volumes && ret=0 fi ;; esac ;; - (kill) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help -s --signal)"{-s=,--signal=}"[Signal to send]:signal:_signals" \ - "($help -)*:containers:__docker_runningcontainers" && ret=0 - ;; - (load) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help -i --input)"{-i=,--input=}"[Read from tar archive file]:archive file:_files -g \"*.((tar|TAR)(.gz|.GZ|.Z|.bz2|.lzma|.xz|)|(tbz|tgz|txz))(-.)\"" \ - "($help -q --quiet)"{-q,--quiet}"[Suppress the load output]" && ret=0 - ;; (login) _arguments $(__docker_arguments) \ $opts_help \ @@ -1785,16 +2503,6 @@ __docker_subcommand() { $opts_help \ "($help -)1:server: " && ret=0 ;; - (logs) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help)--details[Show extra details provided to logs]" \ - "($help -f --follow)"{-f,--follow}"[Follow log output]" \ - "($help -s --since)"{-s=,--since=}"[Show logs since this timestamp]:timestamp: " \ - "($help -t --timestamps)"{-t,--timestamps}"[Show timestamps]" \ - "($help)--tail=[Output the last K lines]:lines:(1 10 20 50 all)" \ - "($help -)*:containers:__docker_containers" && ret=0 - ;; (network) local curcontext="$curcontext" state _arguments $(__docker_arguments) \ @@ -1829,11 +2537,6 @@ __docker_subcommand() { ;; esac ;; - (pause|unpause) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help -)*:containers:__docker_runningcontainers" && ret=0 - ;; (plugin) local curcontext="$curcontext" state _arguments $(__docker_arguments) \ @@ -1851,128 +2554,13 @@ __docker_subcommand() { ;; esac ;; - (port) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help -)1:containers:__docker_runningcontainers" \ - "($help -)2:port:_ports" && ret=0 - ;; (ps) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help -a --all)"{-a,--all}"[Show all containers]" \ - "($help)--before=[Show only container created before...]:containers:__docker_containers" \ - "($help)*"{-f=,--filter=}"[Filter values]:filter:__docker_complete_ps_filters" \ - "($help)--format=[Pretty-print containers using a Go template]:template: " \ - "($help -l --latest)"{-l,--latest}"[Show only the latest created container]" \ - "($help -n --last)"{-n=,--last=}"[Show n last created containers (includes all states)]:n:(1 5 10 25 50)" \ - "($help)--no-trunc[Do not truncate output]" \ - "($help -q --quiet)"{-q,--quiet}"[Only show numeric IDs]" \ - "($help -s --size)"{-s,--size}"[Display total file sizes]" \ - "($help)--since=[Show only containers created since...]:containers:__docker_containers" && ret=0 - ;; - (pull) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help -a --all-tags)"{-a,--all-tags}"[Download all tagged images]" \ - "($help)--disable-content-trust[Skip image verification]" \ - "($help -):name:__docker_search" && ret=0 - ;; - (push) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help)--disable-content-trust[Skip image signing]" \ - "($help -): :__docker_images" && ret=0 - ;; - (rename) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help -):old name:__docker_containers" \ - "($help -):new name: " && ret=0 - ;; - (stop) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help -t --time)"{-t=,--time=}"[Number of seconds to try to stop for before killing the container]:seconds to before killing:(1 5 10 30 60)" \ - "($help -)*:containers:__docker_runningcontainers" && ret=0 - ;; - (restart) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help -t --time)"{-t=,--time=}"[Number of seconds to try to stop for before killing the container]:seconds to before killing:(1 5 10 30 60)" \ - "($help -)*:containers:__docker_containers_ids" && ret=0 - ;; - (rm) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help -f --force)"{-f,--force}"[Force removal]" \ - "($help -l --link)"{-l,--link}"[Remove the specified link and not the underlying container]" \ - "($help -v --volumes)"{-v,--volumes}"[Remove the volumes associated to the container]" \ - "($help -)*:containers:->values" && ret=0 - case $state in - (values) - if [[ ${words[(r)-f]} == -f || ${words[(r)--force]} == --force ]]; then - __docker_containers && ret=0 - else - __docker_stoppedcontainers && ret=0 - fi - ;; - esac + words[1]='ls' + __docker_container_subcommand && ret=0 ;; (rmi) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help -f --force)"{-f,--force}"[Force removal]" \ - "($help)--no-prune[Do not delete untagged parents]" \ - "($help -)*: :__docker_images" && ret=0 - ;; - (run) - _arguments $(__docker_arguments) \ - $opts_help \ - $opts_build_create_run \ - $opts_build_create_run_update \ - $opts_create_run \ - $opts_create_run_update \ - $opts_attach_exec_run_start \ - "($help -d --detach)"{-d,--detach}"[Detached mode: leave the container running in the background]" \ - "($help)--health-cmd=[Command to run to check health]:command: " \ - "($help)--health-interval=[Time between running the check]:time: " \ - "($help)--health-retries=[Consecutive failures needed to report unhealthy]:retries:(1 2 3 4 5)" \ - "($help)--health-timeout=[Maximum time to allow one check to run]:time: " \ - "($help)--no-healthcheck[Disable any container-specified HEALTHCHECK]" \ - "($help)--rm[Remove intermediate containers when it exits]" \ - "($help)--runtime=[Name of the runtime to be used for that container]:runtime:__docker_complete_runtimes" \ - "($help)--sig-proxy[Proxy all received signals to the process (non-TTY mode only)]" \ - "($help)--stop-signal=[Signal to kill a container]:signal:_signals" \ - "($help)--storage-opt=[Storage driver options for the container]:storage options:->storage-opt" \ - "($help -): :__docker_images" \ - "($help -):command: _command_names -e" \ - "($help -)*::arguments: _normal" && ret=0 - - case $state in - (link) - if compset -P "*:"; then - _wanted alias expl "Alias" compadd -E "" && ret=0 - else - __docker_runningcontainers -qS ":" && ret=0 - fi - ;; - (storage-opt) - if compset -P "*="; then - _message "value" && ret=0 - else - opts=('size') - _describe -t filter-opts "storage options" opts -qS "=" && ret=0 - fi - ;; - esac - - ;; - (save) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help -o --output)"{-o=,--output=}"[Write to file]:file:_files" \ - "($help -)*: :__docker_images" && ret=0 + words[1]='rm' + __docker_image_subcommand && ret=0 ;; (search) _arguments $(__docker_arguments) \ @@ -1988,6 +2576,23 @@ __docker_subcommand() { ;; esac ;; + (secret) + local curcontext="$curcontext" state + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -): :->command" \ + "($help -)*:: :->option-or-argument" && ret=0 + + case $state in + (command) + __docker_secret_commands && ret=0 + ;; + (option-or-argument) + curcontext=${curcontext%:*:*}:docker-${words[-1]}: + __docker_secret_subcommand && ret=0 + ;; + esac + ;; (service) local curcontext="$curcontext" state _arguments $(__docker_arguments) \ @@ -2005,21 +2610,22 @@ __docker_subcommand() { ;; esac ;; - (start) + (stack) + local curcontext="$curcontext" state _arguments $(__docker_arguments) \ $opts_help \ - $opts_attach_exec_run_start \ - "($help -a --attach)"{-a,--attach}"[Attach container's stdout/stderr and forward all signals]" \ - "($help -i --interactive)"{-i,--interactive}"[Attach container's stding]" \ - "($help -)*:containers:__docker_stoppedcontainers" && ret=0 - ;; - (stats) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help -a --all)"{-a,--all}"[Show all containers (default shows just running)]" \ - "($help)--format=[Pretty-print images using a Go template]:template: " \ - "($help)--no-stream[Disable streaming stats and only pull the first result]" \ - "($help -)*:containers:__docker_runningcontainers" && ret=0 + "($help -): :->command" \ + "($help -)*:: :->option-or-argument" && ret=0 + + case $state in + (command) + __docker_stack_commands && ret=0 + ;; + (option-or-argument) + curcontext=${curcontext%:*:*}:docker-${words[-1]}: + __docker_stack_subcommand && ret=0 + ;; + esac ;; (swarm) local curcontext="$curcontext" state @@ -2038,41 +2644,28 @@ __docker_subcommand() { ;; esac ;; - (tag) + (system) + local curcontext="$curcontext" state _arguments $(__docker_arguments) \ $opts_help \ - "($help -):source:__docker_images"\ - "($help -):destination:__docker_repositories_with_tags" && ret=0 - ;; - (top) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help -)1:containers:__docker_runningcontainers" \ - "($help -)*:: :->ps-arguments" && ret=0 - case $state in - (ps-arguments) - _ps && ret=0 - ;; - esac - - ;; - (update) - _arguments $(__docker_arguments) \ - $opts_help \ - $opts_create_run_update \ - $opts_build_create_run_update \ - "($help -)*: :->values" && ret=0 + "($help -): :->command" \ + "($help -)*:: :->option-or-argument" && ret=0 case $state in - (values) - if [[ ${words[(r)--kernel-memory*]} = (--kernel-memory*) ]]; then - __docker_stoppedcontainers && ret=0 - else - __docker_containers && ret=0 - fi + (command) + __docker_system_commands && ret=0 + ;; + (option-or-argument) + curcontext=${curcontext%:*:*}:docker-${words[-1]}: + __docker_system_subcommand && ret=0 ;; esac ;; + (version) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -f --format)"{-f=,--format=}"[Format the output using the given go template]:template: " && ret=0 + ;; (volume) local curcontext="$curcontext" state _arguments $(__docker_arguments) \ @@ -2090,11 +2683,6 @@ __docker_subcommand() { ;; esac ;; - (wait) - _arguments $(__docker_arguments) \ - $opts_help \ - "($help -)*:containers:__docker_runningcontainers" && ret=0 - ;; (help) _arguments $(__docker_arguments) ":subcommand:__docker_commands" && ret=0 ;; From 6fe2028a1264a79330f16b1dbd6da8f59dc6854f Mon Sep 17 00:00:00 2001 From: Dariusz Luksza Date: Sun, 25 Jan 2015 13:29:42 +0100 Subject: [PATCH 0126/1083] Fix emacs client terminal Fixes #3305 Signed-off-by: Dariusz Luksza --- plugins/emacs/emacs.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/emacs/emacs.plugin.zsh b/plugins/emacs/emacs.plugin.zsh index c102a5a1e..929aa0616 100644 --- a/plugins/emacs/emacs.plugin.zsh +++ b/plugins/emacs/emacs.plugin.zsh @@ -16,7 +16,7 @@ if "$ZSH/tools/require_tool.sh" emacs 24 2>/dev/null ; then # set EDITOR if not already defined. export EDITOR="${EDITOR:-${EMACS_PLUGIN_LAUNCHER}}" - alias emacs="$EMACS_PLUGIN_LAUNCHER --no-wait" + alias emacs="$EMACS_PLUGIN_LAUNCHER -t" alias e=emacs # open terminal emacsclient alias te="$EMACS_PLUGIN_LAUNCHER -nw" From 456341fd69c3e514e401f1c3c1726b77d733c86b Mon Sep 17 00:00:00 2001 From: Felipe Guilherme Date: Sat, 17 Dec 2016 15:01:13 -0200 Subject: [PATCH 0127/1083] Add git alias for staging tracked files (#5178) Although `gaa` (git add --all) is cool, it stages every file, tracked or not, if it is not on .gitignore. Sometimes we want to just stage everything we are working on, that is already tracked. For that reason, 'gau' can save us some time. --- 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 9d8e4174a..34942d387 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -43,6 +43,7 @@ alias g='git' alias ga='git add' alias gaa='git add --all' alias gapa='git add --patch' +alias gau='git add --update' alias gb='git branch' alias gba='git branch -a' From 1ca2fe63deb0db4870b867c7da7dddc36b15963b Mon Sep 17 00:00:00 2001 From: Geoff Lane Date: Sat, 17 Dec 2016 16:32:53 -0500 Subject: [PATCH 0128/1083] Add file completion to `mix run` (#5673) --- plugins/mix/_mix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/mix/_mix b/plugins/mix/_mix index 57fdf808a..cfeb4705e 100644 --- a/plugins/mix/_mix +++ b/plugins/mix/_mix @@ -86,6 +86,9 @@ case $state in (test) _files ;; + (run) + _files + ;; esac ;; esac From c6de77ca992648ea2be7beef5f35f5ce9f0151a9 Mon Sep 17 00:00:00 2001 From: Mauro Porras P Date: Sat, 17 Dec 2016 16:52:01 -0500 Subject: [PATCH 0129/1083] Add a React Native alias, and one to start the web server (#5711) * Add a React Native alias, and one to start the web server * Reorganise aliases in react-native plugin * Update README for react-native plugin: Fix format and add a brief description Add missing aliases in react-native plugin README --- plugins/react-native/README.md | 32 ++++++++++++++------ plugins/react-native/react-native.plugin.zsh | 8 +++-- 2 files changed, 27 insertions(+), 13 deletions(-) diff --git a/plugins/react-native/README.md b/plugins/react-native/README.md index 78bfb6844..c6fe396b8 100644 --- a/plugins/react-native/README.md +++ b/plugins/react-native/README.md @@ -1,14 +1,26 @@ -# React Native +# React Native plugin -**Maintainer:** [BilalBudhani](https://github.com/BilalBudhani) +This plugin adds completion for [`react-native`](https://facebook.github.io/react-native/). +It also defines a few [aliases](#aliases) for the commands more frequently used. -### List of Aliases +To enable, add `react-native` to your `plugins` array in your zshrc file: -Alias | React Native command -------|--------------------- -**rnand** | *react-native run-android* -**rnios** | *react-native run-ios* -**rnios4s** | *react-native run-ios --simulator "iPhone 4s"* -**rnios5** | *react-native run-ios --simulator "iPhone 5"* -**rnios5s** | *react-native run-ios --simulator "iPhone 5s"* +```zsh +plugins=(... react-native) +``` +## Aliases + +| Alias | React Native command | +|:------------|:-----------------------------------------------| +| **rn** | `react-native` | +| **rns** | `react-native start` | +| **rnlink** | `react-native link` | +| _App testing_ | +| **rnand** | `react-native run-android` | +| **rnios** | `react-native run-ios` | +| **rnios4s** | `react-native run-ios --simulator "iPhone 4s"` | +| **rnios5** | `react-native run-ios --simulator "iPhone 5"` | +| **rnios5s** | `react-native run-ios --simulator "iPhone 5s"` | +| **rnios6** | `react-native run-ios --simulator "iPhone 6"` | +| **rnios6s** | `react-native run-ios --simulator "iPhone 6s"` | diff --git a/plugins/react-native/react-native.plugin.zsh b/plugins/react-native/react-native.plugin.zsh index f19cba820..892a31fbe 100644 --- a/plugins/react-native/react-native.plugin.zsh +++ b/plugins/react-native/react-native.plugin.zsh @@ -1,9 +1,11 @@ +alias rn='react-native' +alias rns='react-native start' +alias rnlink='react-native link' + alias rnand='react-native run-android' +alias rnios='react-native run-ios' alias rnios4s='react-native run-ios --simulator "iPhone 4s"' alias rnios5='react-native run-ios --simulator "iPhone 5"' alias rnios5s='react-native run-ios --simulator "iPhone 5s"' alias rnios6='react-native run-ios --simulator "iPhone 6"' alias rnios6s='react-native run-ios --simulator "iPhone 6s"' -alias rnios='react-native run-ios' -alias rnlink='react-native link' - From e66bf038c7a9297afbccc264b802d50d43f2515a Mon Sep 17 00:00:00 2001 From: Jaehyun Shin Date: Sun, 18 Dec 2016 07:03:02 +0900 Subject: [PATCH 0130/1083] Add heroku `features` command to completion (#5667) --- plugins/heroku/_heroku | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/plugins/heroku/_heroku b/plugins/heroku/_heroku index fd72e530e..878d3ce1b 100644 --- a/plugins/heroku/_heroku +++ b/plugins/heroku/_heroku @@ -31,6 +31,10 @@ _1st_arguments=( "domains\:add":"add a custom domain to an app" "domains\:remove":"remove a custom domain from an app" "domains\:clear":"remove all custom domains from an app" + "features":"list available app features" + "features\:disable":"disables a feature" + "features\:enable":"enables an feature" + "features\:info":"displays additional information about feature" "help":"list available commands or display help for a specific command" "keys":"display keys for the current user" "keys\:add":"add a key for the current user" @@ -144,5 +148,4 @@ _arguments \ '(--app)--app[the app name]' \ '(--remote)--remote[the remote name]' \ '(--help)--help[help about the current command]' \ - && return 0 - + && return 0 From dfd296a9367ed577435d6f298747c4e5e750fc9c Mon Sep 17 00:00:00 2001 From: Nathan Bolender Date: Sat, 17 Dec 2016 21:27:08 -0500 Subject: [PATCH 0131/1083] Update react-native autocomplete arguments (#5646) --- plugins/react-native/_react-native | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/plugins/react-native/_react-native b/plugins/react-native/_react-native index 47ee8c370..893ac040a 100644 --- a/plugins/react-native/_react-native +++ b/plugins/react-native/_react-native @@ -3,12 +3,21 @@ local -a _1st_arguments _1st_arguments=( + 'init: generates a new project and installs its dependencies' + 'android:creates an empty android project' 'start:starts the webserver' - 'bundle:builds the javascript bundle for offline use' - 'new-library:generates a native library bridge' - 'android:generates an Android project for your app' + 'run-ios:builds your app and starts it on iOS simulator' 'run-android:builds your app and starts it on a connected Android emulator or device' - 'upgrade:upgrade your apps template files to the latest version; run this after updating the react-native version in your package.json and running npm install' + 'new-library:generates a native library bridge' + 'bundle:builds the javascript bundle for offline use' + 'unbundle:builds javascript as "unbundle" for offline use' + 'link:[options] links all native dependencies' + 'unlink:[options] unlink native dependency' + 'install:[options] install and link native dependencies' + 'uninstall:[options] uninstall and unlink native dependencies' + "upgrade:upgrade your app's template files to the latest version; run this after updating the react-native version in your package.json and running npm install" + 'log-android:starts adb logcat' + 'log-ios:starts iOS device syslog tail' ) From 5fa674456a7d21b489a5cb3dea2ff01e1378b2f6 Mon Sep 17 00:00:00 2001 From: Dennis Rippinger Date: Sun, 18 Dec 2016 03:34:16 +0100 Subject: [PATCH 0132/1083] Add mvn asciidoctor commands (#5645) * Add mvn asciidoctor commands * Fix formatting in mvn plugin --- plugins/mvn/mvn.plugin.zsh | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/plugins/mvn/mvn.plugin.zsh b/plugins/mvn/mvn.plugin.zsh index 04bd186af..c5a7faa0f 100644 --- a/plugins/mvn/mvn.plugin.zsh +++ b/plugins/mvn/mvn.plugin.zsh @@ -20,10 +20,9 @@ BACKGROUND_CYAN=`tput setab 6` BACKGROUND_WHITE=`tput setab 7` RESET_FORMATTING=`tput sgr0` - + # Wrapper function for Maven's mvn command. -mvn-color() -{ +mvn-color() { ( # Filter mvn output using sed. Before filtering set the locale to C, so invalid characters won't break some sed implementations unset LANG @@ -37,7 +36,7 @@ mvn-color() echo -ne ${RESET_FORMATTING} ) } - + # Override the mvn command with the colorized one. #alias mvn="mvn-color" @@ -65,13 +64,13 @@ alias mvnsrc='mvn dependency:sources' alias mvndocs='mvn dependency:resolve -Dclassifier=javadoc' function listMavenCompletions { - reply=( + reply=( # common lifecycle clean process-resources compile process-test-resources test-compile test integration-test package verify install deploy site - + # common plugins deploy failsafe install site surefire checkstyle javadoc jxr pmd ant antrun archetype assembly dependency enforcer gpg help release repository source eclipse idea jetty cargo jboss tomcat tomcat6 tomcat7 exec versions war ear ejb android scm buildnumber nexus repository sonar license hibernate3 liquibase flyway gwt - + # deploy deploy:deploy-file # failsafe @@ -82,7 +81,7 @@ function listMavenCompletions { site:site site:deploy site:run site:stage site:stage-deploy # surefire surefire:test - + # checkstyle checkstyle:checkstyle checkstyle:check # javadoc @@ -110,18 +109,18 @@ function listMavenCompletions { help:active-profiles help:all-profiles help:describe help:effective-pom help:effective-settings help:evaluate help:expressions help:system # release release:clean release:prepare release:rollback release:perform release:stage release:branch release:update-versions - # jgitflow - jgitflow:feature-start jgitflow:feature-finish jgitflow:release-start jgitflow:release-finish jgitflow:hotfix-start jgitflow:hotfix-finish jgitflow:build-number + # jgitflow + jgitflow:feature-start jgitflow:feature-finish jgitflow:release-start jgitflow:release-finish jgitflow:hotfix-start jgitflow:hotfix-finish jgitflow:build-number # repository repository:bundle-create repository:bundle-pack # source source:aggregate source:jar source:jar-no-fork - + # eclipse eclipse:clean eclipse:eclipse # idea idea:clean idea:idea - + # jetty jetty:run jetty:run-exploded # cargo @@ -134,7 +133,7 @@ function listMavenCompletions { tomcat6:run tomcat6:run-war tomcat6:run-war-only tomcat6:stop tomcat6:deploy tomcat6:undeploy # tomcat7 tomcat7:run tomcat7:run-war tomcat7:run-war-only tomcat7:deploy - # tomee + # tomee tomee:run tomee:run-war tomee:run-war-only tomee:stop tomee:deploy tomee:undeploy # spring-boot spring-boot:run spring-boot:repackage @@ -172,7 +171,8 @@ function listMavenCompletions { flyway:clean flyway:history flyway:init flyway:migrate flyway:status flyway:validate # gwt gwt:browser gwt:clean gwt:compile gwt:compile-report gwt:css gwt:debug gwt:eclipse gwt:eclipseTest gwt:generateAsync gwt:help gwt:i18n gwt:mergewebxml gwt:resources gwt:run gwt:sdkInstall gwt:source-jar gwt:soyc gwt:test - + # asciidoctor + asciidoctor:process-asciidoc asciidoctor:auto-refresh asciidoctor:http asciidoctor:zip # options -Dmaven.test.skip=true -DskipTests -DskipITs -Dmaven.surefire.debug -DenableCiProfile -Dpmd.skip=true -Dcheckstyle.skip=true -Dtycho.mode=maven -Dmaven.test.failure.ignore=true -DgroupId= -DartifactId= -Dversion= -Dpackaging=jar -Dfile= From 97c03841691021f916c46b2fd2d089d7970400aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Sun, 18 Dec 2016 05:02:08 +0100 Subject: [PATCH 0133/1083] Add more information to cask plugin README --- plugins/cask/README.md | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/plugins/cask/README.md b/plugins/cask/README.md index 6457fd858..e1335c1b8 100644 --- a/plugins/cask/README.md +++ b/plugins/cask/README.md @@ -1,11 +1,15 @@ -# cask plugin +# Cask plugin -Loads `cask` completion from non-standard locations, such as if installed +[Cask](https://github.com/cask/cask) is a project management tool for Emacs that helps +automate the package development cycle; development, dependencies, testing, building, +packaging and more. + +This plugin loads `cask` completion from non-standard locations, such as if installed via Homebrew or others. To enable it, add `cask` to your plugins array: ```zsh plugins=(... cask) ``` -Make sure you have the `cask` directory in your `$PATH` before loading -Oh My Zsh, otherwise you'll get the "command not found" error. +Make sure you have the `cask` directory in your `$PATH` before loading Oh My Zsh, +otherwise you'll get a "command not found" error. From cedc4fce88fa6ca1f2f1e69b7aea0f983ded60c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20Jos=C3=A9=20Pereira?= Date: Fri, 30 Dec 2016 10:34:16 -0200 Subject: [PATCH 0134/1083] 'lib/completion.zsh: Solve typos' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Patrick José Pereira --- lib/completion.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/completion.zsh b/lib/completion.zsh index bbd021656..a1e934315 100644 --- a/lib/completion.zsh +++ b/lib/completion.zsh @@ -5,7 +5,7 @@ WORDCHARS='' unsetopt menu_complete # do not autoselect the first completion entry unsetopt flowcontrol -setopt auto_menu # show completion menu on succesive tab press +setopt auto_menu # show completion menu on successive tab press setopt complete_in_word setopt always_to_end From 2a6c40f66fe53f0a7d295f110511064b70456d38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20Jos=C3=A9=20Pereira?= Date: Fri, 30 Dec 2016 10:34:16 -0200 Subject: [PATCH 0135/1083] 'lib/functions.zsh: Solve typos' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Patrick José Pereira --- lib/functions.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/functions.zsh b/lib/functions.zsh index 9f11318d2..f30653784 100644 --- a/lib/functions.zsh +++ b/lib/functions.zsh @@ -86,7 +86,7 @@ function default() { } # -# Set enviroment variable "$1" to default value "$2" if "$1" is not yet defined. +# Set environment variable "$1" to default value "$2" if "$1" is not yet defined. # # Arguments: # 1. name - The env variable to set From eac098b55c9d3b32827aa1c1432188aefad06934 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20Jos=C3=A9=20Pereira?= Date: Fri, 30 Dec 2016 10:34:16 -0200 Subject: [PATCH 0136/1083] 'plugins/droplr/README.md: Solve typos' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Patrick José Pereira --- plugins/droplr/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/droplr/README.md b/plugins/droplr/README.md index cfbec25ed..25cf61db7 100644 --- a/plugins/droplr/README.md +++ b/plugins/droplr/README.md @@ -1,6 +1,6 @@ # droplr -Use [Droplr](https://droplr.com/) from the comand line to upload files and shorten +Use [Droplr](https://droplr.com/) from the command line to upload files and shorten links. It needs to have [Droplr.app](https://droplr.com/apps) installed and logged in. MacOS only. From 7079e67c11a468c8d1f07d069d666c50baa65e7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20Jos=C3=A9=20Pereira?= Date: Fri, 30 Dec 2016 10:34:16 -0200 Subject: [PATCH 0137/1083] 'plugins/gnu-utils/gnu-utils.plugin.zsh: Solve typos' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Patrick José Pereira --- plugins/gnu-utils/gnu-utils.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/gnu-utils/gnu-utils.plugin.zsh b/plugins/gnu-utils/gnu-utils.plugin.zsh index de95f7e6c..b66e25d7f 100644 --- a/plugins/gnu-utils/gnu-utils.plugin.zsh +++ b/plugins/gnu-utils/gnu-utils.plugin.zsh @@ -52,7 +52,7 @@ if [[ -x "${commands[gwhoami]}" ]]; then # # This method is inflexible since the aliases are at risk of being - # overriden resulting in the BSD coreutils being called. + # overridden resulting in the BSD coreutils being called. # # (( ${+commands[$gcmd]} )) && \ # alias "$gcmd[2,-1]"="${prefix}/${gcmd//"["/"\\["}" From 1bebbbf50ad3608e96474302238c489dc612cff0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20Jos=C3=A9=20Pereira?= Date: Fri, 30 Dec 2016 10:34:16 -0200 Subject: [PATCH 0138/1083] 'plugins/history-substring-search/history-substring-search.zsh: Solve typos' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Patrick José Pereira --- plugins/history-substring-search/history-substring-search.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/history-substring-search/history-substring-search.zsh b/plugins/history-substring-search/history-substring-search.zsh index ad316acc8..3b8afd317 100644 --- a/plugins/history-substring-search/history-substring-search.zsh +++ b/plugins/history-substring-search/history-substring-search.zsh @@ -244,7 +244,7 @@ _history-substring-search-end() { _history_substring_search_result=$BUFFER - # the search was succesful so display the result properly by clearing away + # the search was successful so display the result properly by clearing away # existing highlights and moving the cursor to the end of the result buffer if [[ $_history_substring_search_refresh_display -eq 1 ]]; then region_highlight=() From 093c2cd6b6f50587cb779147eb9b14759d4c94aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20Jos=C3=A9=20Pereira?= Date: Fri, 30 Dec 2016 10:34:16 -0200 Subject: [PATCH 0139/1083] 'plugins/scala/_scala: Solve typos' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Patrick José Pereira --- plugins/scala/_scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/scala/_scala b/plugins/scala/_scala index c4ccb37d3..80434680c 100644 --- a/plugins/scala/_scala +++ b/plugins/scala/_scala @@ -152,10 +152,10 @@ Y_opts=( "-Ydump-classes+[Dump the generated bytecode to .class files (useful for reflective compilation that utilizes in-memory classloaders)]:output directory:_files -/" "-Yeta-expand-keeps-star[Eta-expand varargs methods to T* rather than Seq[T]. This is a temporary option to ease transition.]" "-Ygen-javap+[Generate a parallel output directory of .javap files]:output directory:_files -/" - "-Yinfer-argument-types[Infer types for arguments of overriden methods]" + "-Yinfer-argument-types[Infer types for arguments of overridden methods]" "-Yinline[Perform inlining when possible]" "-Yinline-handlers[Perform exception handler inlining when possible]" - "-Yinline-warnings[Emit inlining warnings (normally surpressed due to high volume)]" + "-Yinline-warnings[Emit inlining warnings (normally suppressed due to high volume)]" "-Yinvalidate+[Invalidate classpath entry before run]:classpath entry" "-Ylinearizer\:-[Linearizer to use (default\: rpo)]:linearizer:(normal dfs rpo dump)" "-Ylog-classpath[Output information about what classpath is being applied]" From 75663be294e2328dd4928596345a9e2e4785e8a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20Jos=C3=A9=20Pereira?= Date: Fri, 30 Dec 2016 10:34:16 -0200 Subject: [PATCH 0140/1083] 'plugins/suse/suse.plugin.zsh: Solve typos' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Patrick José Pereira --- plugins/suse/suse.plugin.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/suse/suse.plugin.zsh b/plugins/suse/suse.plugin.zsh index afd8ecabd..f7215528b 100644 --- a/plugins/suse/suse.plugin.zsh +++ b/plugins/suse/suse.plugin.zsh @@ -1,4 +1,4 @@ -#Alias for Zypper according to the offical Zypper's alias +#Alias for Zypper according to the official Zypper's alias #Main commands alias z='sudo zypper' #call zypper @@ -51,7 +51,7 @@ alias zrr='sudo zypper rr' #remove repositories alias zas='sudo zypper as' #adds a service specified by URI to the system alias zms='sudo zypper ms' #modify properties of specified services alias zrefs='sudo zypper refs' #refreshing a service mean executing the service's special task -alias zrs='sudo zypper rs' #remove specified repository index service from the sytem +alias zrs='sudo zypper rs' #remove specified repository index service from the system alias zls='sudo zypper ls' #list services defined on the system #Package Locks Management commands From 87bc218d2da0da540383633462ca5fdbeda927fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20Jos=C3=A9=20Pereira?= Date: Fri, 30 Dec 2016 10:34:16 -0200 Subject: [PATCH 0141/1083] 'plugins/terraform/_terraform: Solve typos' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Patrick José Pereira --- plugins/terraform/_terraform | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/terraform/_terraform b/plugins/terraform/_terraform index 11740dc48..97c42a559 100644 --- a/plugins/terraform/_terraform +++ b/plugins/terraform/_terraform @@ -98,7 +98,7 @@ __push() { '-token=[(token) Atlas API token to use to authorize the upload. If blank or unspecified, the ATLAS_TOKEN environmental variable will be used.]' \ '-var=[("foo=bar") Set the value of a variable for the Terraform configuration.]' \ '-var-file=[(foo) Set the value of variables using a variable file.]' \ - '-vcs=[(true) If true (default), then Terraform will detect if a VCS is in use, such as Git, and will only upload files that are comitted to version control. If no version control system is detected, Terraform will upload all files in path (parameter to the command).]' + '-vcs=[(true) If true (default), then Terraform will detect if a VCS is in use, such as Git, and will only upload files that are committed to version control. If no version control system is detected, Terraform will upload all files in path (parameter to the command).]' } __refresh() { From 8c6ac51f3f40e2af1f35bd5ac3765159e5a4a0cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20Jos=C3=A9=20Pereira?= Date: Fri, 30 Dec 2016 10:34:16 -0200 Subject: [PATCH 0142/1083] 'plugins/ubuntu/readme.md: Solve typos' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Patrick José Pereira --- plugins/ubuntu/readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/ubuntu/readme.md b/plugins/ubuntu/readme.md index c9ef61f4e..5ad4bbcd2 100644 --- a/plugins/ubuntu/readme.md +++ b/plugins/ubuntu/readme.md @@ -10,7 +10,7 @@ By now you already can guess almost all aliases There are two exeptions since ... agu = sudo Apt-Get Update - we have ... -agug = sudo Apt-Get UpGrade - as the exeptional 4 letter alias for a single command. +agug = sudo Apt-Get UpGrade - as the exceptional 4 letter alias for a single command. afs = Apt-File Search --regexp - this has the regexp switch on without being represented in the alias, I guess this makes sense since the debian plugin has it, I never used that command. From 223872c4530de5e756581d205c614ba3e1de79ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20Jos=C3=A9=20Pereira?= Date: Fri, 30 Dec 2016 10:34:16 -0200 Subject: [PATCH 0143/1083] 'plugins/ubuntu/ubuntu.plugin.zsh: Solve typos' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Patrick José Pereira --- plugins/ubuntu/ubuntu.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/ubuntu/ubuntu.plugin.zsh b/plugins/ubuntu/ubuntu.plugin.zsh index 030af0693..60ff0457f 100644 --- a/plugins/ubuntu/ubuntu.plugin.zsh +++ b/plugins/ubuntu/ubuntu.plugin.zsh @@ -69,7 +69,7 @@ alias mydeb='time dpkg-buildpackage -rfakeroot -us -uc' # apt-add-repository with automatic install/upgrade of the desired package # Usage: aar ppa:xxxxxx/xxxxxx [packagename] # If packagename is not given as 2nd argument the function will ask for it and guess the default by taking -# the part after the / from the ppa name wich is sometimes the right name for the package you want to install +# the part after the / from the ppa name which is sometimes the right name for the package you want to install aar() { if [ -n "$2" ]; then PACKAGE=$2 From 13e327eb7c552ded26836247a5f8575dc52e0f6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20Jos=C3=A9=20Pereira?= Date: Fri, 30 Dec 2016 10:34:16 -0200 Subject: [PATCH 0144/1083] 'plugins/z/README: Solve typos' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Patrick José Pereira --- plugins/z/README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/z/README b/plugins/z/README index 7de82a4c7..56261cff4 100644 --- a/plugins/z/README +++ b/plugins/z/README @@ -125,7 +125,7 @@ ENVIRONMENT Directories must be full paths without trailing slashes. The environment variable $_Z_OWNER can be set to your username, to - allow usage of z when your sudo enviroment keeps $HOME set. + allow usage of z when your sudo environment keeps $HOME set. FILES Data is stored in $HOME/.z. This can be overridden by setting the From c362da8813d8541a24e4f166400ea8e3fe7078dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20Jos=C3=A9=20Pereira?= Date: Fri, 30 Dec 2016 10:34:16 -0200 Subject: [PATCH 0145/1083] 'plugins/z/z.1: Solve typos' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Patrick José Pereira --- plugins/z/z.1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/z/z.1 b/plugins/z/z.1 index cc99910bf..bbc1bf5df 100644 --- a/plugins/z/z.1 +++ b/plugins/z/z.1 @@ -151,7 +151,7 @@ directory trees to exclude from tracking. \fB$HOME\fR is always excluded. Directories must be full paths without trailing slashes. .P The environment variable \fB$_Z_OWNER\fR can be set to your username, to -allow usage of \fBz\fR when your sudo enviroment keeps \fB$HOME\fR set. +allow usage of \fBz\fR when your sudo environment keeps \fB$HOME\fR set. .SH FILES Data is stored in \fB$HOME/.z\fR. This can be overridden by setting the From a414bb3eb41c7bd2e50df3dd249dddb96d6f34d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20Jos=C3=A9=20Pereira?= Date: Fri, 30 Dec 2016 10:34:16 -0200 Subject: [PATCH 0146/1083] 'themes/half-life.zsh-theme: Solve typos' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Patrick José Pereira --- themes/half-life.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/half-life.zsh-theme b/themes/half-life.zsh-theme index a3c505706..5f987099d 100644 --- a/themes/half-life.zsh-theme +++ b/themes/half-life.zsh-theme @@ -17,7 +17,7 @@ setopt prompt_subst autoload -U add-zsh-hook autoload -Uz vcs_info -#use extended color pallete if available +#use extended color palette if available if [[ $TERM = *256color* || $TERM = *rxvt* ]]; then turquoise="%F{81}" orange="%F{166}" From 747b6ec5f76371ff7742402bc18fb75902f19a78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20Jos=C3=A9=20Pereira?= Date: Fri, 30 Dec 2016 10:34:16 -0200 Subject: [PATCH 0147/1083] 'themes/pure.zsh-theme: Solve typos' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Patrick José Pereira --- themes/pure.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/pure.zsh-theme b/themes/pure.zsh-theme index 1473194a5..0e5681cc7 100644 --- a/themes/pure.zsh-theme +++ b/themes/pure.zsh-theme @@ -61,7 +61,7 @@ cmd_exec_time() { [ $elapsed -gt 5 ] && echo ${elapsed}s } -# Get the intial timestamp for cmd_exec_time +# Get the initial timestamp for cmd_exec_time # preexec() { cmd_timestamp=`date +%s` From 0c7bb4de0dd4a13f4d53bc60c38061087ecea6ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20Jos=C3=A9=20Pereira?= Date: Fri, 30 Dec 2016 10:34:16 -0200 Subject: [PATCH 0148/1083] 'themes/steeef.zsh-theme: Solve typos' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Patrick José Pereira --- themes/steeef.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/steeef.zsh-theme b/themes/steeef.zsh-theme index 13dc3ad2f..b72a41c92 100644 --- a/themes/steeef.zsh-theme +++ b/themes/steeef.zsh-theme @@ -19,7 +19,7 @@ setopt prompt_subst autoload -U add-zsh-hook autoload -Uz vcs_info -#use extended color pallete if available +#use extended color palette if available if [[ $terminfo[colors] -ge 256 ]]; then turquoise="%F{81}" orange="%F{166}" From 0f498e8d458f941556dac8929b7dedfe99e4fe3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20Jos=C3=A9=20Pereira?= Date: Fri, 30 Dec 2016 10:34:16 -0200 Subject: [PATCH 0149/1083] 'themes/trapd00r.zsh-theme: Solve typos' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Patrick José Pereira --- themes/trapd00r.zsh-theme | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/themes/trapd00r.zsh-theme b/themes/trapd00r.zsh-theme index ca1676fb5..3fa5d57ab 100644 --- a/themes/trapd00r.zsh-theme +++ b/themes/trapd00r.zsh-theme @@ -36,7 +36,7 @@ local c12=$(printf "\e[38;5;142m\e[1m") local c13=$(printf "\e[38;5;196m\e[1m") -# We dont want to use the extended colorset in the TTY / VC. +# We don't want to use the extended colorset in the TTY / VC. if [ "$TERM" = "linux" ]; then c1=$( printf "\e[34;1m") c2=$( printf "\e[35m") @@ -71,7 +71,7 @@ prompt_jnrowe_precmd () { PROMPT='%{$fg_bold[green]%}%p%{$reset_color%}${vcs_info_msg_0_}${dir_status} ${ret_status}%{$reset_color%} > ' -# modified, to be commited +# modified, to be committed elif [[ $(git diff --cached --name-status 2>/dev/null ) != "" ]]; then dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$(zsh_path)%} %{$c0%}(%{$c5%}%?%{$c0%})" PROMPT='${vcs_info_msg_0_}%{$30%} %{$bg_bold[red]%}%{$fg_bold[cyan]%}C%{$fg_bold[black]%}OMMIT%{$reset_color%} From ff5629e60b815b3c21ef216d5ba5943932589758 Mon Sep 17 00:00:00 2001 From: Ryan Brushett Date: Fri, 30 Dec 2016 14:29:17 -0330 Subject: [PATCH 0150/1083] Improve UX for Spotify quit command in osx plugin (#5726) * Improve UX for Spotify commands in osx plugin Spotify command UX is a bit weak for people who live and work almost entirely in shells. - `spotify quit` should not open Spotify if it is not already running. Should confirm that Spotify is indeed not running. - `spotify quit` should not blow away the user's shell once Spotify is quit. This can be a disruption to work flow. This PR looks to add a few little checks which will help improve this experience. This PR also adds a space to line 477 between `break` and `;;` for consistency. Doesn't seem like a big enough change to put in its own PR. * Rearranging output as per peer feedback * osx plugin's spotify: change quitting w/ closing Closing is more idiomatic English. --- plugins/osx/osx.plugin.zsh | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/plugins/osx/osx.plugin.zsh b/plugins/osx/osx.plugin.zsh index d7baa1191..95ef3e1aa 100644 --- a/plugins/osx/osx.plugin.zsh +++ b/plugins/osx/osx.plugin.zsh @@ -323,7 +323,7 @@ function spotify() { if [ $# = 0 ]; then showHelp; else - if [ "$(osascript -e 'application "Spotify" is running')" = "false" ]; then + if [ "$1" != "quit" ] && [ "$(osascript -e 'application "Spotify" is running')" = "false" ]; then osascript -e 'tell application "Spotify" to activate' sleep 2 fi @@ -413,9 +413,13 @@ function spotify() { break ;; "quit" ) - cecho "Quitting Spotify."; - osascript -e 'tell application "Spotify" to quit'; - exit 1 ;; + if [ "$(osascript -e 'application "Spotify" is running')" = "false" ]; then + cecho "Spotify was not running." + else + cecho "Closing Spotify."; + osascript -e 'tell application "Spotify" to quit'; + fi + break ;; "next" ) cecho "Going to next track." ; @@ -470,7 +474,7 @@ function spotify() { "pos" ) cecho "Adjusting Spotify play position." osascript -e "tell application \"Spotify\" to set player position to $2"; - break;; + break ;; "status" ) showStatus; From 9f8b2b42bdfee31bb06a93aa0e8b04411727ce58 Mon Sep 17 00:00:00 2001 From: Nuno Arruda Date: Mon, 2 Jan 2017 06:29:48 -0100 Subject: [PATCH 0151/1083] chore: update license years (#5737) --- LICENSE.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE.txt b/LICENSE.txt index 42f607f5d..ed0ae75fc 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2009-2016 Robby Russell and contributors +Copyright (c) 2009-2017 Robby Russell and contributors See the full list at https://github.com/robbyrussell/oh-my-zsh/contributors Permission is hereby granted, free of charge, to any person obtaining a copy From 4608231b2576fbe27913a6ce3d350ab03b9b5932 Mon Sep 17 00:00:00 2001 From: Eric Wendelin Date: Wed, 4 Jan 2017 04:26:23 -0700 Subject: [PATCH 0152/1083] Improved gradle options (arguments) completion (#5743) * Sort gradle options for autocompletion This will allow us to more easily keep the options list up-to-date * Add missing gradle options to gradle plugin Reflect documentation at https://docs.gradle.org/3.2.1/userguide/gradle_command_line.html --- plugins/gradle/gradle.plugin.zsh | 73 +++++++++++++++++++++++--------- 1 file changed, 52 insertions(+), 21 deletions(-) diff --git a/plugins/gradle/gradle.plugin.zsh b/plugins/gradle/gradle.plugin.zsh index 65b9d4685..0adc04a13 100644 --- a/plugins/gradle/gradle.plugin.zsh +++ b/plugins/gradle/gradle.plugin.zsh @@ -24,29 +24,60 @@ function _gradle_core_commands() { function _gradle_arguments() { _arguments -C \ '-a[Do not rebuild project dependencies]' \ - '-h[Help]' \ - '-D[System property]' \ + '-b[Specifies the build file]' \ + '-c[Specifies the settings file]' \ '-d[Log at the debug level]' \ - '--gui[Launches the Gradle GUI app]' \ - '--stop[Stop the Gradle daemon]' \ - '--daemon[Use the Gradle daemon]' \ - '--no-daemon[Do not use the Gradle daemon]' \ - '--rerun-task [Specifies that any task optimization is ignored.]' \ - '-i[Log at the info level]' \ - '-m[Dry run]' \ - '-P[Set a project property]' \ - '-p[Specifies the start directory]' \ - '--profile[Profile the build time]' \ - '-q[Log at the quiet level (only show errors)]' \ - '-v[Print the Gradle version info]' \ + '-g[Specifies the Gradle user home directory]' \ + '-h[Shows a help message]' \ + '-i[Set log level to INFO]' \ + '-m[Runs the build with all task actions disabled]' \ + '-p[Specifies the start directory for Gradle]' \ + '-q[Log errors only]' \ + '-s[Print out the stacktrace also for user exceptions]' \ + '-t[Continuous mode. Automatically re-run build after changes]' \ + '-u[Don''t search in parent directories for a settings.gradle file]' \ + '-v[Prints Gradle version info]' \ '-x[Specify a task to be excluded]' \ - '-b[Specifies the build file.]' \ - '-c[Specifies the settings file.]' \ - '--continue[Continues task execution after a task failure.]' \ - '-g[Specifies the Gradle user home directory.]' \ - '-I[Specifies an initialization script.]' \ - '--refresh-dependencies[Refresh the state of dependencies.]' \ - '-u[Don''t search in parent directories for a settings.gradle file.]' \ + '-D[Set a system property]' \ + '-I[Specifies an initialization script]' \ + '-P[Sets a project property of the root project]' \ + '-S[Print out the full (very verbose) stacktrace]' \ + '--build-file[Specifies the build file]' \ + '--configure-on-demand[Only relevant projects are configured]' \ + '--console[Type of console output to generate (plain, auto, or rich)]' \ + '--continue[Continues task execution after a task failure]' \ + '--continuous[Continuous mode. Automatically re-run build after changes]' \ + '--daemon[Use the Gradle Daemon]' \ + '--debug[Log at the debug level]' \ + '--dry-run[Runs the build with all task actions disabled]' \ + '--exclude-task[Specify a task to be excluded]' \ + '--full-stacktrace[Print out the full (very verbose) stacktrace]' \ + '--gradle-user-home[Specifies the Gradle user home directory]' \ + '--gui[Launches the Gradle GUI app (Deprecated)]' \ + '--help[Shows a help message]' \ + '--include-build[Run the build as a composite, including the specified build]' \ + '--info[Set log level to INFO]' \ + '--init-script[Specifies an initialization script]' \ + '--max-workers[Set the maximum number of workers that Gradle may use]' \ + '--no-daemon[Do not use the Gradle Daemon]' \ + '--no-rebuild[Do not rebuild project dependencies]' \ + '--no-search-upwards[Don''t search in parent directories for a settings.gradle file]' \ + '--offline[Build without accessing network resources]' \ + '--parallel[Build projects in parallel]' \ + '--profile[Profile build time and create report]' \ + '--project-cache-dir[Specifies the project-specific cache directory]' \ + '--project-dir[Specifies the start directory for Gradle]' \ + '--project-prop[Sets a project property of the root project]' \ + '--quiet[Log errors only]' \ + '--recompile-scripts[Forces scripts to be recompiled, bypassing caching]' \ + '--refresh-dependencies[Refresh the state of dependencies]' \ + '--rerun-task[Specifies that any task optimization is ignored]' \ + '--settings-file[Specifies the settings file]' \ + '--stacktrace[Print out the stacktrace also for user exceptions]' \ + '--status[Print Gradle Daemon status]' \ + '--stop[Stop all Gradle Daemons]' \ + '--system-prop[Set a system property]' \ + '--version[Prints Gradle version info]' \ '*::command:->command' \ && return 0 } From cae540f899b1e302e514e190f7d51331a5a689e0 Mon Sep 17 00:00:00 2001 From: Italo Maia Date: Thu, 5 Jan 2017 07:41:53 -0300 Subject: [PATCH 0153/1083] Adding new path to look for activate.sh (#5654) If autoenv was installed with pip and modifier --user, activate.sh will be at .local/bin --- plugins/autoenv/autoenv.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/autoenv/autoenv.plugin.zsh b/plugins/autoenv/autoenv.plugin.zsh index af58ee77b..3c1b0fafc 100644 --- a/plugins/autoenv/autoenv.plugin.zsh +++ b/plugins/autoenv/autoenv.plugin.zsh @@ -1,7 +1,7 @@ # Activates autoenv or reports its failure () { if ! type autoenv_init >/dev/null; then - for d (~/.autoenv /usr/local/opt/autoenv /usr/local/bin); do + for d (~/.autoenv ~/.local/bin /usr/local/opt/autoenv /usr/local/bin); do if [[ -e $d/activate.sh ]]; then autoenv_dir=$d break From 0b4bba4ca2d6115dabfdb0852ce516e30765d2e6 Mon Sep 17 00:00:00 2001 From: haandol Date: Mon, 9 Jan 2017 16:06:17 +0900 Subject: [PATCH 0154/1083] Change af-magic theme's branch color (#5730) --- themes/af-magic.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/af-magic.zsh-theme b/themes/af-magic.zsh-theme index 97d142a0f..1c6d1732c 100644 --- a/themes/af-magic.zsh-theme +++ b/themes/af-magic.zsh-theme @@ -27,7 +27,7 @@ else fi # git settings -ZSH_THEME_GIT_PROMPT_PREFIX="$FG[075](branch:" +ZSH_THEME_GIT_PROMPT_PREFIX="$FG[075]($FG[078]" ZSH_THEME_GIT_PROMPT_CLEAN="" ZSH_THEME_GIT_PROMPT_DIRTY="$my_orange*%{$reset_color%}" ZSH_THEME_GIT_PROMPT_SUFFIX="$FG[075])%{$reset_color%}" From d2725d44fce59ea7060b4d712c5739512a56882d Mon Sep 17 00:00:00 2001 From: Ruslan Voronkov Date: Sun, 15 Jan 2017 21:21:36 +0200 Subject: [PATCH 0155/1083] Add goodreads search provider (#5778) --- plugins/web-search/web-search.plugin.zsh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/web-search/web-search.plugin.zsh b/plugins/web-search/web-search.plugin.zsh index 3b5478ca2..cc970e5fd 100644 --- a/plugins/web-search/web-search.plugin.zsh +++ b/plugins/web-search/web-search.plugin.zsh @@ -15,6 +15,7 @@ function web_search() { github "https://github.com/search?q=" baidu "https://www.baidu.com/s?wd=" ecosia "https://www.ecosia.org/search?q=" + goodreads "https://www.goodreads.com/search?q=" ) # check whether the search engine is supported @@ -47,6 +48,7 @@ alias yandex='web_search yandex' alias github='web_search github' alias baidu='web_search baidu' alias ecosia='web_search ecosia' +alias goodreads='web_search goodreads' #add your own !bang searches here alias wiki='web_search duckduckgo \!w' From 76c102944c8c164f2cf8908712b6c6a1d9fe5d70 Mon Sep 17 00:00:00 2001 From: Ilyes Kechidi Date: Wed, 23 Nov 2016 02:21:18 +0100 Subject: [PATCH 0156/1083] added a transfer.sh plugin created a function to easily upload files to transfer.sh file sharing site Usage : transfer file.txt --- plugins/transfer/transfer.plugin.zsh | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 plugins/transfer/transfer.plugin.zsh diff --git a/plugins/transfer/transfer.plugin.zsh b/plugins/transfer/transfer.plugin.zsh new file mode 100644 index 000000000..7d0d84bea --- /dev/null +++ b/plugins/transfer/transfer.plugin.zsh @@ -0,0 +1,7 @@ +# transfer.sh Easy file sharing from the command line +# transfer Plugin +# Usage Example : +# > transfer file.txt + +transfer() { if [ $# -eq 0 ]; then echo "No arguments specified. Usage:\necho transfer /tmp/test.md\ncat /tmp/test.md | transfer test.md"; return 1; fi +tmpfile=$( mktemp -t transferXXX ); if tty -s; then basefile=$(basename "$1" | sed -e 's/[^a-zA-Z0-9._-]/-/g'); curl --progress-bar --upload-file "$1" "https://transfer.sh/$basefile" >> $tmpfile; else curl --progress-bar --upload-file "-" "https://transfer.sh/$1" >> $tmpfile ; fi; cat $tmpfile; rm -f $tmpfile; } \ No newline at end of file From 8013d3d8a933b6bae3ed9ceb37bebb42cf28ea56 Mon Sep 17 00:00:00 2001 From: Ilyes Kechidi Date: Tue, 7 Feb 2017 14:40:21 +0100 Subject: [PATCH 0157/1083] added README for transfer.sh plugin --- plugins/transfer/README.md | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 plugins/transfer/README.md diff --git a/plugins/transfer/README.md b/plugins/transfer/README.md new file mode 100644 index 000000000..e14b94aa9 --- /dev/null +++ b/plugins/transfer/README.md @@ -0,0 +1,7 @@ +# `transfer.sh` plugin +transfer.sh is an easy file sharing service from the command line + +## Usage +Example +> transfer file.txt + From d2dfa69419845daebcfd20fed3253ae06faa2876 Mon Sep 17 00:00:00 2001 From: slavaGanzin Date: Tue, 7 Feb 2017 15:44:12 +0200 Subject: [PATCH 0158/1083] change name of overriden zle-line-init --- plugins/git-auto-fetch/git-auto-fetch.plugin.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/git-auto-fetch/git-auto-fetch.plugin.zsh b/plugins/git-auto-fetch/git-auto-fetch.plugin.zsh index 03fa911e7..1d20bc04b 100644 --- a/plugins/git-auto-fetch/git-auto-fetch.plugin.zsh +++ b/plugins/git-auto-fetch/git-auto-fetch.plugin.zsh @@ -18,10 +18,10 @@ function git-auto-fetch { echo "${fg_bold[red]}disabled${reset_color}") } -eval "original-$(declare -f zle-line-init)" +eval "override-git-auto-fetch-$(declare -f zle-line-init)" function zle-line-init () { git-fetch-all - original-zle-line-init + override-git-auto-fetch-zle-line-init } zle -N zle-line-init From 845fdfaae0a913143d1ff03220a1bf1596871225 Mon Sep 17 00:00:00 2001 From: Ilyes Kechidi Date: Thu, 9 Feb 2017 02:28:33 +0100 Subject: [PATCH 0159/1083] replaced transfer function with @nl5887 version --- plugins/transfer/transfer.plugin.zsh | 62 +++++++++++++++++++++++++++- 1 file changed, 60 insertions(+), 2 deletions(-) diff --git a/plugins/transfer/transfer.plugin.zsh b/plugins/transfer/transfer.plugin.zsh index 7d0d84bea..796faa9a2 100644 --- a/plugins/transfer/transfer.plugin.zsh +++ b/plugins/transfer/transfer.plugin.zsh @@ -2,6 +2,64 @@ # transfer Plugin # Usage Example : # > transfer file.txt +# > transfer directory/ -transfer() { if [ $# -eq 0 ]; then echo "No arguments specified. Usage:\necho transfer /tmp/test.md\ncat /tmp/test.md | transfer test.md"; return 1; fi -tmpfile=$( mktemp -t transferXXX ); if tty -s; then basefile=$(basename "$1" | sed -e 's/[^a-zA-Z0-9._-]/-/g'); curl --progress-bar --upload-file "$1" "https://transfer.sh/$basefile" >> $tmpfile; else curl --progress-bar --upload-file "-" "https://transfer.sh/$1" >> $tmpfile ; fi; cat $tmpfile; rm -f $tmpfile; } \ No newline at end of file + + +# Author: +# Remco Verhoef +# https://gist.github.com/nl5887/a511f172d3fb3cd0e42d +# + +curl --version 2>&1 > /dev/null +if [ $? -ne 0 ]; then + echo "Could not find curl." + return 1 +fi + +transfer() { + # check arguments + if [ $# -eq 0 ]; + then + echo "No arguments specified. Usage:\necho transfer /tmp/test.md\ncat /tmp/test.md | transfer test.md" + return 1 + fi + + # get temporarily filename, output is written to this file show progress can be showed + tmpfile=$( mktemp -t transferXXX ) + + # upload stdin or file + file=$1 + + if tty -s; + then + basefile=$(basename "$file" | sed -e 's/[^a-zA-Z0-9._-]/-/g') + + if [ ! -e $file ]; + then + echo "File $file doesn't exists." + return 1 + fi + + if [ -d $file ]; + then + # zip directory and transfer + zipfile=$( mktemp -t transferXXX.zip ) + cd $(dirname $file) && zip -r -q - $(basename $file) >> $zipfile + curl --progress-bar --upload-file "$zipfile" "https://transfer.sh/$basefile.zip" >> $tmpfile + rm -f $zipfile + else + # transfer file + curl --progress-bar --upload-file "$file" "https://transfer.sh/$basefile" >> $tmpfile + fi + else + # transfer pipe + curl --progress-bar --upload-file "-" "https://transfer.sh/$file" >> $tmpfile + fi + + # cat output link + cat $tmpfile + + # cleanup + rm -f $tmpfile +} \ No newline at end of file From 6cefe70ffc8f5d827a9b4341129114a843ceb248 Mon Sep 17 00:00:00 2001 From: Ilyes Kechidi Date: Thu, 9 Feb 2017 02:29:24 +0100 Subject: [PATCH 0160/1083] updated transfer README.md --- plugins/transfer/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/transfer/README.md b/plugins/transfer/README.md index e14b94aa9..9bf488d4e 100644 --- a/plugins/transfer/README.md +++ b/plugins/transfer/README.md @@ -4,4 +4,5 @@ transfer.sh is an easy file sharing service from the command line ## Usage Example > transfer file.txt +> transfer directory/ From c36474b7dfbe19c0628f6f21d8da40b535eeb5fb Mon Sep 17 00:00:00 2001 From: Ilyes Kechidi Date: Thu, 9 Feb 2017 19:41:09 +0100 Subject: [PATCH 0161/1083] modified the script to use tar command instead of zip --- plugins/transfer/transfer.plugin.zsh | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/plugins/transfer/transfer.plugin.zsh b/plugins/transfer/transfer.plugin.zsh index 796faa9a2..7a7cd85ec 100644 --- a/plugins/transfer/transfer.plugin.zsh +++ b/plugins/transfer/transfer.plugin.zsh @@ -9,6 +9,7 @@ # Author: # Remco Verhoef # https://gist.github.com/nl5887/a511f172d3fb3cd0e42d +# Modified to use tar command instead of zip # curl --version 2>&1 > /dev/null @@ -43,11 +44,12 @@ transfer() { if [ -d $file ]; then - # zip directory and transfer - zipfile=$( mktemp -t transferXXX.zip ) - cd $(dirname $file) && zip -r -q - $(basename $file) >> $zipfile - curl --progress-bar --upload-file "$zipfile" "https://transfer.sh/$basefile.zip" >> $tmpfile - rm -f $zipfile + echo $file + # tar directory and transfer + tarfile=$( mktemp -t transferXXX.tar.gz ) + cd $(dirname $file) && tar -czf $tarfile $(basename $file) + curl --progress-bar --upload-file "$tarfile" "https://transfer.sh/$basefile.tar.gz" >> $tmpfile + rm -f $tarfile else # transfer file curl --progress-bar --upload-file "$file" "https://transfer.sh/$basefile" >> $tmpfile From fbc878cb66cbe0067998034c2d2e383b2742c0de Mon Sep 17 00:00:00 2001 From: Rob Freiburger Date: Sat, 18 Feb 2017 04:31:36 -0600 Subject: [PATCH 0162/1083] Adds option to disable auto update prompt I noticed this option was missing from the template. When I followed the directions in README to enable it, I put it below line 59 without noticing it wouldn't have any effect by then. Prevent others from making a rookie mistake like mine. --- templates/zshrc.zsh-template | 3 +++ 1 file changed, 3 insertions(+) diff --git a/templates/zshrc.zsh-template b/templates/zshrc.zsh-template index af42e5b9f..93bbf36aa 100644 --- a/templates/zshrc.zsh-template +++ b/templates/zshrc.zsh-template @@ -19,6 +19,9 @@ ZSH_THEME="robbyrussell" # Uncomment the following line to disable bi-weekly auto-update checks. # DISABLE_AUTO_UPDATE="true" +# Uncomment the following line to automatically update without prompting. +# DISABLE_UPDATE_PROMPT="true" + # Uncomment the following line to change how often to auto-update (in days). # export UPDATE_ZSH_DAYS=13 From 9bbcceda97c769071862c2862c9c1f525d091deb Mon Sep 17 00:00:00 2001 From: grh2g46 Date: Mon, 20 Feb 2017 18:20:53 +0000 Subject: [PATCH 0163/1083] add missing new line escape (#5896) missing \ was causing command not found errors when tab completing docker build -t --- plugins/docker/_docker | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/docker/_docker b/plugins/docker/_docker index 8d00b13e6..1aec353c5 100644 --- a/plugins/docker/_docker +++ b/plugins/docker/_docker @@ -917,7 +917,7 @@ __docker_image_subcommand() { "($help)*--label=[Set metadata for an image]:label=value: " \ "($help -m --memory)"{-m=,--memory=}"[Memory limit]:Memory limit: " \ "($help)--memory-swap=[Total memory limit with swap]:Memory limit: " \ - "($help)--network=[Connect a container to a network]:network mode:(bridge none container host)" + "($help)--network=[Connect a container to a network]:network mode:(bridge none container host)" \ "($help)--no-cache[Do not use cache when building the image]" \ "($help)--pull[Attempt to pull a newer version of the image]" \ "($help -q --quiet)"{-q,--quiet}"[Suppress verbose build output]" \ From 98d8d3429f8b9fc2c4c109fb199a31c8d1735699 Mon Sep 17 00:00:00 2001 From: travoltron Date: Mon, 20 Feb 2017 13:21:36 -0500 Subject: [PATCH 0164/1083] Update composer.plugin.zsh (#5889) Adds remove/global remove and optimize-autoloader commands. --- plugins/composer/composer.plugin.zsh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/composer/composer.plugin.zsh b/plugins/composer/composer.plugin.zsh index 07eb1de88..ac272060b 100644 --- a/plugins/composer/composer.plugin.zsh +++ b/plugins/composer/composer.plugin.zsh @@ -39,11 +39,14 @@ alias c='composer' alias csu='composer self-update' alias cu='composer update' alias cr='composer require' +alias crm='composer remove' alias ci='composer install' alias ccp='composer create-project' alias cdu='composer dump-autoload' +alias cdo='composer dump-autoload --optimize-autoloader' alias cgu='composer global update' alias cgr='composer global require' +alias cgrm='composer global remove' # install composer in the current directory alias cget='curl -s https://getcomposer.org/installer | php' From 8611aa8049f5f13cabe012f17a19e0d42669ef3f Mon Sep 17 00:00:00 2001 From: guyzmo Date: Thu, 23 Feb 2017 08:50:49 +0100 Subject: [PATCH 0165/1083] Fixing battery prompt formatting issue (cf #5894) (#5895) Signed-off-by: Guyzmo --- plugins/battery/battery.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/battery/battery.plugin.zsh b/plugins/battery/battery.plugin.zsh index da229cf35..8f398cfb3 100644 --- a/plugins/battery/battery.plugin.zsh +++ b/plugins/battery/battery.plugin.zsh @@ -100,7 +100,7 @@ elif [[ "$OSTYPE" = linux* ]] ; then else color='red' fi - echo "%{$fg[$color]%}[$(battery_pct_remaining)%%]%{$reset_color%}" + echo "%{$fg[$color]%}$(battery_pct_remaining)%%%{$reset_color%}" else echo "∞" fi From 4fba92e04fa9b62b2259abc45eb92ca6a74f1639 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20P=C3=A9rez?= Date: Thu, 23 Feb 2017 08:52:23 +0100 Subject: [PATCH 0166/1083] Use proper config bin directory (#5886) Add the proper config bin directory to `PATH` instead of the previously (incorrect) fixed `~/.composer/vendor/bin`. Nowadays the right config dir is `~/.config/composer/vendor/bin`. --- plugins/composer/composer.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/composer/composer.plugin.zsh b/plugins/composer/composer.plugin.zsh index ac272060b..8cf50d502 100644 --- a/plugins/composer/composer.plugin.zsh +++ b/plugins/composer/composer.plugin.zsh @@ -52,4 +52,4 @@ alias cgrm='composer global remove' alias cget='curl -s https://getcomposer.org/installer | php' # Add Composer's global binaries to PATH -export PATH=$PATH:~/.composer/vendor/bin +export PATH=$PATH:$(composer global config bin-dir --absolute) 2>/dev/null From ef9f3d97f0920a0b151d2ada7ae7235d148639dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Franz=20K=C3=B6nig?= Date: Thu, 23 Feb 2017 08:52:56 +0100 Subject: [PATCH 0167/1083] Added pacman file aliases (#5869) --- plugins/archlinux/README.md | 2 ++ plugins/archlinux/archlinux.plugin.zsh | 2 ++ 2 files changed, 4 insertions(+) diff --git a/plugins/archlinux/README.md b/plugins/archlinux/README.md index 16f099415..e408db13d 100644 --- a/plugins/archlinux/README.md +++ b/plugins/archlinux/README.md @@ -73,6 +73,8 @@ | pacupd | sudo pacman -Sy | Update and refresh the local package database | | pacupg | sudo pacman -Syu | Sync with repositories before upgrading packages | | upgrade | sudo pacman -Syu | Sync with repositories before upgrading packages | +| pacfileupg | sudo pacman -Fy | Download fresh package databases from the server | +| pacfiles | pacman -Fs | Search package file names for matching strings. | | Function | Description | |----------------|------------------------------------------------------| diff --git a/plugins/archlinux/archlinux.plugin.zsh b/plugins/archlinux/archlinux.plugin.zsh index 3156e949a..105bd2d5f 100644 --- a/plugins/archlinux/archlinux.plugin.zsh +++ b/plugins/archlinux/archlinux.plugin.zsh @@ -82,6 +82,8 @@ alias pacinsd='sudo pacman -S --asdeps' alias pacmir='sudo pacman -Syy' alias paclsorphans='sudo pacman -Qdt' alias pacrmorphans='sudo pacman -Rs $(pacman -Qtdq)' +alias pacfileupg='sudo pacman -Fy' +alias pacfiles='pacman tFs' if (( $+commands[abs] && $+commands[aur] )); then From d874c73f19d8430f4dc32756fff0bf2f6a804d87 Mon Sep 17 00:00:00 2001 From: Avi Israeli Date: Thu, 23 Feb 2017 09:53:27 +0200 Subject: [PATCH 0168/1083] itunes playlist first commit (#5860) Added playlist feature for the itunes command: if a variable is passed and is valid - will play the playlist if a variable is passed and is invalid(no such playlist) - will stop all playing if no variable is passed will print all playlists available on the host --- plugins/osx/osx.plugin.zsh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/plugins/osx/osx.plugin.zsh b/plugins/osx/osx.plugin.zsh index 95ef3e1aa..e8488ebc9 100644 --- a/plugins/osx/osx.plugin.zsh +++ b/plugins/osx/osx.plugin.zsh @@ -184,6 +184,7 @@ function vncviewer() { # iTunes control function function itunes() { local opt=$1 + local playlist=$2 shift case "$opt" in launch|play|pause|stop|rewind|resume|quit) @@ -200,6 +201,19 @@ function itunes() { vol) opt="set sound volume to $1" #$1 Due to the shift ;; + playlist) + # Inspired by: https://gist.github.com/nakajijapan/ac8b45371064ae98ea7f +if [[ ! -z "$playlist" ]]; then + osascript -e 'tell application "iTunes"' -e "set new_playlist to \"$playlist\" as string" -e "play playlist new_playlist" -e "end tell" 2>/dev/null; + if [[ $? -eq 0 ]]; then + opt="play" + else + opt="stop" + fi + else + opt="set allPlaylists to (get name of every playlist)" + fi + ;; playing|status) local state=`osascript -e 'tell application "iTunes" to player state as string'` if [[ "$state" = "playing" ]]; then @@ -250,6 +264,7 @@ EOF echo "\tshuf|shuffle [on|off|toggle]\tSet shuffled playback. Default: toggle. Note: toggle doesn't support the MiniPlayer." echo "\tvol\tSet the volume, takes an argument from 0 to 100" echo "\tplaying|status\tShow what song is currently playing in iTunes." + echo "\tplaylist [playlist name]\t Play specific playlist" echo "\thelp\tshow this message and exit" return 0 ;; From e609fd5a9f7f7c9a16945ca9c0748b6de99f6635 Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Sat, 25 Feb 2017 19:59:11 -0800 Subject: [PATCH 0169/1083] Updating README intro --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d56534977..54107b1cb 100644 --- a/README.md +++ b/README.md @@ -4,9 +4,9 @@ Oh My Zsh is an open source, community-driven framework for managing your [zsh](http://www.zsh.org/) configuration. -That sounds boring. Let's try this again. +Sounds boring. Let's try again. -__Oh My Zsh is a way of life!__ +__Oh My Zsh will not make you a 10x developer...but you might feel like one.__ Once installed, your terminal shell will become the talk of the town _or your money back!_ With each keystroke in your command prompt, you'll take advantage of the hundreds of powerful plugins and beautiful themes. Strangers will come up to you in cafés and ask you, _"that is amazing! are you some sort of genius?"_ From 1628adebf395ab67c8009703cd2f8721fc650285 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Thu, 17 Jul 2014 13:46:06 +0200 Subject: [PATCH 0170/1083] Add CONTRIBUTING.md file general structure --- CONTRIBUTING.md | 60 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 000000000..5d257e25d --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,60 @@ +# CONTRIBUTING GUIDELINES + +1. [Use the search Luke](#use-the-search-luke) +2. [You have a problem](#you-have-a-problem) +3. [You have a solution](#you-have-a-solution) + +**BONUS:** [You have spare time to volunteer](#you-have-spare-time-to-volunteer) + + +## USE THE SEARCH LUKE + +> May the Force (of past experiences) be with you. + +Trust me, that works 90% of the time. + +You can also take a look at the [FAQ](https://github.com/robbyrussell/oh-my-zsh/wiki/FAQ) +to be sure it hasn't already come up. + +If all fails, your thing hasn't probably been reported yet, so you can go ahead +and read on to the next section. + + +## YOU HAVE A PROBLEM + +See [point 1](#use-the-search-luke). + +If the problem is already reported, comment on the issue so we can know there's +more people with the problem. + +If not, look at the [Troubleshooting](https://github.com/robbyrussell/oh-my-zsh/wiki/Troubleshooting) +page for instructions on how to gather data to better debug your problem. + +Then, you can go ahead and submit an issue with as much detail as you can provide. +We'll do our very best to help you. + +*TODO: fill later* + + +## YOU HAVE A SOLUTION + +See [point 1](#use-the-search-luke). + +If the solution is already reported, try it out and +1 the pull request if the +solution works ok. On the other hand, if you think your solution is better, post +it so we can have both solutions to compare. + +If not, then go ahead and submit a PR. +**Unless your solution is yet another [theme](https://github.com/robbyrussell/oh-my-zsh/wiki/Themes#dont-send-us-your-theme-for-now).** + +*TODO: fill later* + + +---- + +### YOU HAVE SPARE TIME TO VOLUNTEER + +Very nice!! :) + +Please have a look at the [Volunteer](https://github.com/robbyrussell/oh-my-zsh/wiki/Volunteers) +page for instructions on where to start and more. From 001610904fbf0e3c96195187dc34c209e94a83f2 Mon Sep 17 00:00:00 2001 From: ncanceill Date: Tue, 5 May 2015 15:39:02 +0200 Subject: [PATCH 0171/1083] rewrite of contribution guidelines --- CONTRIBUTING.md | 115 ++++++++++++++++++++++++++++++++++++------------ 1 file changed, 88 insertions(+), 27 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5d257e25d..d7318709a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,58 +1,119 @@ # CONTRIBUTING GUIDELINES -1. [Use the search Luke](#use-the-search-luke) -2. [You have a problem](#you-have-a-problem) -3. [You have a solution](#you-have-a-solution) +Oh-My-Zsh is a community-driven project. Contribution is welcome, encouraged and appreciated. +It is also essential for the development of the project. -**BONUS:** [You have spare time to volunteer](#you-have-spare-time-to-volunteer) +These guidelines are an attempt at better addressing the brobdingnagian amount of pending +issues and pull requests. Please read them closely. +Foremost, be so kind as to [search](#use-the-search-luke), thus ensuring any contribution +you would make is not already covered. -## USE THE SEARCH LUKE +* [Issues](#reporting-issues) + * [You have a problem](#you-have-a-problem) + * [You have a suggestion](#you-have-a-suggestion) +* [Pull Requests](#submitting-pull-requests) + * [Getting started](#getting-started) + * [You have a solution](#you-have-a-solution) + * [You have an addition](#you-have-an-addition) +* [Information sources (_aka_ search)](#use-the-search-luke) -> May the Force (of past experiences) be with you. +**BONUS:** [Volunteering](#you-have-spare-time-to-volunteer) -Trust me, that works 90% of the time. +## Reporting Issues -You can also take a look at the [FAQ](https://github.com/robbyrussell/oh-my-zsh/wiki/FAQ) -to be sure it hasn't already come up. +### You have a problem -If all fails, your thing hasn't probably been reported yet, so you can go ahead -and read on to the next section. +Please be so kind as to [search](#use-the-search-luke) for any open issue already covering +your problem. - -## YOU HAVE A PROBLEM - -See [point 1](#use-the-search-luke). - -If the problem is already reported, comment on the issue so we can know there's -more people with the problem. +If you find one, comment on it so we can know there are more people experiencing it. If not, look at the [Troubleshooting](https://github.com/robbyrussell/oh-my-zsh/wiki/Troubleshooting) page for instructions on how to gather data to better debug your problem. -Then, you can go ahead and submit an issue with as much detail as you can provide. -We'll do our very best to help you. +Then, you can go ahead and create an issue with as much detail as you can provide. +It should include the data gathered as indicated above, along with: -*TODO: fill later* +1. How to reproduce the problem +2. What the correct behavior should be +3. What the actual behavior is +Please copy to anyone relevant (_eg_ plugin maintainers) by mentioning their GitHub handle +(starting with `@`) in your message. -## YOU HAVE A SOLUTION +We will do our very best to help you. -See [point 1](#use-the-search-luke). +### You have a suggestion + +Please be so kind as to [search](#use-the-search-luke) for any open issue already covering +your suggestion. + +If you find one, comment on it so we can know there are more people supporting it. + +If not, you can go ahead and create an issue. Please copy to anyone relevant (_eg_ plugin +maintainers) by mentioning their GitHub handle (starting with `@`) in your message. + +## Submitting Pull Requests + +### Getting started + +You should be familiar with the basics of +[contributing on GitHub](https://help.github.com/articles/using-pull-requests) and have a fork +[properly set up](https://github.com/robbyrussell/oh-my-zsh/wiki/Contribution-Technical-Practices). + +You MUST always create PRs with _a dedicated branch_ based on the latest upstream tree. + +If you create your own PR, please make sure you do it right. Also be so kind as to reference +any issue that would be solved in the PR description body, +[for instance](https://help.github.com/articles/closing-issues-via-commit-messages/) +_"Fixes #XXXX"_ for issue number XXXX. + +### You have a solution + +Please be so kind as to [search](#use-the-search-luke) for any open issue already covering +your [problem](#you-have-a-problem), and any pending PR covering your solution. If the solution is already reported, try it out and +1 the pull request if the solution works ok. On the other hand, if you think your solution is better, post it so we can have both solutions to compare. -If not, then go ahead and submit a PR. -**Unless your solution is yet another [theme](https://github.com/robbyrussell/oh-my-zsh/wiki/Themes#dont-send-us-your-theme-for-now).** +If not, then go ahead and submit a PR. Please copy to anyone relevant (_eg_ plugin +maintainers) by mentioning their GitHub handle (starting with `@`) in your message. -*TODO: fill later* +### You have an addition +Please [do not](https://github.com/robbyrussell/oh-my-zsh/wiki/Themes#dont-send-us-your-theme-for-now) +send themes for now. + +Please be so kind as to [search](#use-the-search-luke) for any pending PR covering or +related to what you want to add. + +If you find one, try it out and work with the author on a common solution. + +If not, then go ahead and submit a PR. Please copy to anyone relevant (_eg_ plugin +maintainers) by mentioning their GitHub handle (starting with `@`) in your message. ---- -### YOU HAVE SPARE TIME TO VOLUNTEER +## Use the Search, Luke + +> May the Force (of past experiences) be with you + +GitHub offers [many search features](https://help.github.com/articles/searching-github/) +to help you check whether a similar contribution to yours already exists. Please search +before making any contribution, it avoids duplicates and eases maintenance. Trust me, +that works 90% of the time. + +You can also take a look at the [FAQ](https://github.com/robbyrussell/oh-my-zsh/wiki/FAQ) +to be sure your contribution has not already come up. + +If all fails, your thing has probably not been reported yet, so you can go ahead +and [create an issue](#reporting-issues) or [submit a PR](#submitting-pull-requests). + +---- + +### You have spare time to volunteer Very nice!! :) From c7ee8086370bcd6ed6863c090c98011ed4380d85 Mon Sep 17 00:00:00 2001 From: Nicolas Canceill Date: Fri, 8 May 2015 11:17:24 +0200 Subject: [PATCH 0172/1083] Contributing: simple english, formatting --- CONTRIBUTING.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d7318709a..827037f4f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -3,10 +3,10 @@ Oh-My-Zsh is a community-driven project. Contribution is welcome, encouraged and appreciated. It is also essential for the development of the project. -These guidelines are an attempt at better addressing the brobdingnagian amount of pending +These guidelines are an attempt at better addressing the huge amount of pending issues and pull requests. Please read them closely. -Foremost, be so kind as to [search](#use-the-search-luke), thus ensuring any contribution +Foremost, be so kind as to [search](#use-the-search-luke). This ensures any contribution you would make is not already covered. * [Issues](#reporting-issues) @@ -98,7 +98,7 @@ maintainers) by mentioning their GitHub handle (starting with `@`) in your messa ## Use the Search, Luke -> May the Force (of past experiences) be with you +_May the Force (of past experiences) be with you_ GitHub offers [many search features](https://help.github.com/articles/searching-github/) to help you check whether a similar contribution to yours already exists. Please search From c51b132a7b5334737177a19dd1fe59c7ff7a7767 Mon Sep 17 00:00:00 2001 From: ncanceill Date: Fri, 8 May 2015 11:33:02 +0200 Subject: [PATCH 0173/1083] contributing: mention testing --- CONTRIBUTING.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 827037f4f..cbcd75907 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -94,6 +94,8 @@ If you find one, try it out and work with the author on a common solution. If not, then go ahead and submit a PR. Please copy to anyone relevant (_eg_ plugin maintainers) by mentioning their GitHub handle (starting with `@`) in your message. +For any extensive change, _eg_ a new plugin, you will have to find testers to +1 your PR. + ---- ## Use the Search, Luke From 8653f5da6df69a8af59cdbff00765af4129d83e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Wed, 23 Nov 2016 21:21:49 +0100 Subject: [PATCH 0174/1083] Rename pure theme to 'refined' --- themes/{pure.zsh-theme => refined.zsh-theme} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename themes/{pure.zsh-theme => refined.zsh-theme} (100%) diff --git a/themes/pure.zsh-theme b/themes/refined.zsh-theme similarity index 100% rename from themes/pure.zsh-theme rename to themes/refined.zsh-theme From 72469f06e8cbb81599c0bb7f2c1dc89dc6346197 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Thu, 17 Jul 2014 13:46:06 +0200 Subject: [PATCH 0175/1083] Add CONTRIBUTING.md file general structure --- CONTRIBUTING.md | 60 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 000000000..5d257e25d --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,60 @@ +# CONTRIBUTING GUIDELINES + +1. [Use the search Luke](#use-the-search-luke) +2. [You have a problem](#you-have-a-problem) +3. [You have a solution](#you-have-a-solution) + +**BONUS:** [You have spare time to volunteer](#you-have-spare-time-to-volunteer) + + +## USE THE SEARCH LUKE + +> May the Force (of past experiences) be with you. + +Trust me, that works 90% of the time. + +You can also take a look at the [FAQ](https://github.com/robbyrussell/oh-my-zsh/wiki/FAQ) +to be sure it hasn't already come up. + +If all fails, your thing hasn't probably been reported yet, so you can go ahead +and read on to the next section. + + +## YOU HAVE A PROBLEM + +See [point 1](#use-the-search-luke). + +If the problem is already reported, comment on the issue so we can know there's +more people with the problem. + +If not, look at the [Troubleshooting](https://github.com/robbyrussell/oh-my-zsh/wiki/Troubleshooting) +page for instructions on how to gather data to better debug your problem. + +Then, you can go ahead and submit an issue with as much detail as you can provide. +We'll do our very best to help you. + +*TODO: fill later* + + +## YOU HAVE A SOLUTION + +See [point 1](#use-the-search-luke). + +If the solution is already reported, try it out and +1 the pull request if the +solution works ok. On the other hand, if you think your solution is better, post +it so we can have both solutions to compare. + +If not, then go ahead and submit a PR. +**Unless your solution is yet another [theme](https://github.com/robbyrussell/oh-my-zsh/wiki/Themes#dont-send-us-your-theme-for-now).** + +*TODO: fill later* + + +---- + +### YOU HAVE SPARE TIME TO VOLUNTEER + +Very nice!! :) + +Please have a look at the [Volunteer](https://github.com/robbyrussell/oh-my-zsh/wiki/Volunteers) +page for instructions on where to start and more. From 9e839ab9c018394f686c62f778bf2a19d3c31b92 Mon Sep 17 00:00:00 2001 From: ncanceill Date: Tue, 5 May 2015 15:39:02 +0200 Subject: [PATCH 0176/1083] rewrite of contribution guidelines --- CONTRIBUTING.md | 115 ++++++++++++++++++++++++++++++++++++------------ 1 file changed, 88 insertions(+), 27 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5d257e25d..d7318709a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,58 +1,119 @@ # CONTRIBUTING GUIDELINES -1. [Use the search Luke](#use-the-search-luke) -2. [You have a problem](#you-have-a-problem) -3. [You have a solution](#you-have-a-solution) +Oh-My-Zsh is a community-driven project. Contribution is welcome, encouraged and appreciated. +It is also essential for the development of the project. -**BONUS:** [You have spare time to volunteer](#you-have-spare-time-to-volunteer) +These guidelines are an attempt at better addressing the brobdingnagian amount of pending +issues and pull requests. Please read them closely. +Foremost, be so kind as to [search](#use-the-search-luke), thus ensuring any contribution +you would make is not already covered. -## USE THE SEARCH LUKE +* [Issues](#reporting-issues) + * [You have a problem](#you-have-a-problem) + * [You have a suggestion](#you-have-a-suggestion) +* [Pull Requests](#submitting-pull-requests) + * [Getting started](#getting-started) + * [You have a solution](#you-have-a-solution) + * [You have an addition](#you-have-an-addition) +* [Information sources (_aka_ search)](#use-the-search-luke) -> May the Force (of past experiences) be with you. +**BONUS:** [Volunteering](#you-have-spare-time-to-volunteer) -Trust me, that works 90% of the time. +## Reporting Issues -You can also take a look at the [FAQ](https://github.com/robbyrussell/oh-my-zsh/wiki/FAQ) -to be sure it hasn't already come up. +### You have a problem -If all fails, your thing hasn't probably been reported yet, so you can go ahead -and read on to the next section. +Please be so kind as to [search](#use-the-search-luke) for any open issue already covering +your problem. - -## YOU HAVE A PROBLEM - -See [point 1](#use-the-search-luke). - -If the problem is already reported, comment on the issue so we can know there's -more people with the problem. +If you find one, comment on it so we can know there are more people experiencing it. If not, look at the [Troubleshooting](https://github.com/robbyrussell/oh-my-zsh/wiki/Troubleshooting) page for instructions on how to gather data to better debug your problem. -Then, you can go ahead and submit an issue with as much detail as you can provide. -We'll do our very best to help you. +Then, you can go ahead and create an issue with as much detail as you can provide. +It should include the data gathered as indicated above, along with: -*TODO: fill later* +1. How to reproduce the problem +2. What the correct behavior should be +3. What the actual behavior is +Please copy to anyone relevant (_eg_ plugin maintainers) by mentioning their GitHub handle +(starting with `@`) in your message. -## YOU HAVE A SOLUTION +We will do our very best to help you. -See [point 1](#use-the-search-luke). +### You have a suggestion + +Please be so kind as to [search](#use-the-search-luke) for any open issue already covering +your suggestion. + +If you find one, comment on it so we can know there are more people supporting it. + +If not, you can go ahead and create an issue. Please copy to anyone relevant (_eg_ plugin +maintainers) by mentioning their GitHub handle (starting with `@`) in your message. + +## Submitting Pull Requests + +### Getting started + +You should be familiar with the basics of +[contributing on GitHub](https://help.github.com/articles/using-pull-requests) and have a fork +[properly set up](https://github.com/robbyrussell/oh-my-zsh/wiki/Contribution-Technical-Practices). + +You MUST always create PRs with _a dedicated branch_ based on the latest upstream tree. + +If you create your own PR, please make sure you do it right. Also be so kind as to reference +any issue that would be solved in the PR description body, +[for instance](https://help.github.com/articles/closing-issues-via-commit-messages/) +_"Fixes #XXXX"_ for issue number XXXX. + +### You have a solution + +Please be so kind as to [search](#use-the-search-luke) for any open issue already covering +your [problem](#you-have-a-problem), and any pending PR covering your solution. If the solution is already reported, try it out and +1 the pull request if the solution works ok. On the other hand, if you think your solution is better, post it so we can have both solutions to compare. -If not, then go ahead and submit a PR. -**Unless your solution is yet another [theme](https://github.com/robbyrussell/oh-my-zsh/wiki/Themes#dont-send-us-your-theme-for-now).** +If not, then go ahead and submit a PR. Please copy to anyone relevant (_eg_ plugin +maintainers) by mentioning their GitHub handle (starting with `@`) in your message. -*TODO: fill later* +### You have an addition +Please [do not](https://github.com/robbyrussell/oh-my-zsh/wiki/Themes#dont-send-us-your-theme-for-now) +send themes for now. + +Please be so kind as to [search](#use-the-search-luke) for any pending PR covering or +related to what you want to add. + +If you find one, try it out and work with the author on a common solution. + +If not, then go ahead and submit a PR. Please copy to anyone relevant (_eg_ plugin +maintainers) by mentioning their GitHub handle (starting with `@`) in your message. ---- -### YOU HAVE SPARE TIME TO VOLUNTEER +## Use the Search, Luke + +> May the Force (of past experiences) be with you + +GitHub offers [many search features](https://help.github.com/articles/searching-github/) +to help you check whether a similar contribution to yours already exists. Please search +before making any contribution, it avoids duplicates and eases maintenance. Trust me, +that works 90% of the time. + +You can also take a look at the [FAQ](https://github.com/robbyrussell/oh-my-zsh/wiki/FAQ) +to be sure your contribution has not already come up. + +If all fails, your thing has probably not been reported yet, so you can go ahead +and [create an issue](#reporting-issues) or [submit a PR](#submitting-pull-requests). + +---- + +### You have spare time to volunteer Very nice!! :) From eb5229d962509cc23296bed08b52a46159da29fd Mon Sep 17 00:00:00 2001 From: Nicolas Canceill Date: Fri, 8 May 2015 11:17:24 +0200 Subject: [PATCH 0177/1083] Contributing: simple english, formatting --- CONTRIBUTING.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d7318709a..827037f4f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -3,10 +3,10 @@ Oh-My-Zsh is a community-driven project. Contribution is welcome, encouraged and appreciated. It is also essential for the development of the project. -These guidelines are an attempt at better addressing the brobdingnagian amount of pending +These guidelines are an attempt at better addressing the huge amount of pending issues and pull requests. Please read them closely. -Foremost, be so kind as to [search](#use-the-search-luke), thus ensuring any contribution +Foremost, be so kind as to [search](#use-the-search-luke). This ensures any contribution you would make is not already covered. * [Issues](#reporting-issues) @@ -98,7 +98,7 @@ maintainers) by mentioning their GitHub handle (starting with `@`) in your messa ## Use the Search, Luke -> May the Force (of past experiences) be with you +_May the Force (of past experiences) be with you_ GitHub offers [many search features](https://help.github.com/articles/searching-github/) to help you check whether a similar contribution to yours already exists. Please search From ae31e8e1f84d4358439db1720c4a0d98484282b4 Mon Sep 17 00:00:00 2001 From: ncanceill Date: Fri, 8 May 2015 11:33:02 +0200 Subject: [PATCH 0178/1083] contributing: mention testing --- CONTRIBUTING.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 827037f4f..cbcd75907 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -94,6 +94,8 @@ If you find one, try it out and work with the author on a common solution. If not, then go ahead and submit a PR. Please copy to anyone relevant (_eg_ plugin maintainers) by mentioning their GitHub handle (starting with `@`) in your message. +For any extensive change, _eg_ a new plugin, you will have to find testers to +1 your PR. + ---- ## Use the Search, Luke From 5a031ce3e67a0e99b6d043aab6034b0532cec26a Mon Sep 17 00:00:00 2001 From: ncanceill Date: Fri, 16 Oct 2015 23:18:34 +0200 Subject: [PATCH 0179/1083] contributing: "correct" -> "expected" behavior see https://github.com/robbyrussell/oh-my-zsh/pull/3770#issuecomment-120546525 --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index cbcd75907..cd0d625fa 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -36,7 +36,7 @@ Then, you can go ahead and create an issue with as much detail as you can provid It should include the data gathered as indicated above, along with: 1. How to reproduce the problem -2. What the correct behavior should be +2. What the expected behavior should be 3. What the actual behavior is Please copy to anyone relevant (_eg_ plugin maintainers) by mentioning their GitHub handle From bc2ccdd812cb90d889f14731896c06c3715876a9 Mon Sep 17 00:00:00 2001 From: ncanceill Date: Fri, 16 Oct 2015 23:23:38 +0200 Subject: [PATCH 0180/1083] contributing: improve PR section --- CONTRIBUTING.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index cd0d625fa..f86acd66e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -72,11 +72,11 @@ _"Fixes #XXXX"_ for issue number XXXX. ### You have a solution Please be so kind as to [search](#use-the-search-luke) for any open issue already covering -your [problem](#you-have-a-problem), and any pending PR covering your solution. +your [problem](#you-have-a-problem), and any pending/merged/rejected PR covering your solution. If the solution is already reported, try it out and +1 the pull request if the solution works ok. On the other hand, if you think your solution is better, post -it so we can have both solutions to compare. +it with a reference to the other one so we can have both solutions to compare. If not, then go ahead and submit a PR. Please copy to anyone relevant (_eg_ plugin maintainers) by mentioning their GitHub handle (starting with `@`) in your message. @@ -86,7 +86,7 @@ maintainers) by mentioning their GitHub handle (starting with `@`) in your messa Please [do not](https://github.com/robbyrussell/oh-my-zsh/wiki/Themes#dont-send-us-your-theme-for-now) send themes for now. -Please be so kind as to [search](#use-the-search-luke) for any pending PR covering or +Please be so kind as to [search](#use-the-search-luke) for any pending/merged/rejected PR covering or related to what you want to add. If you find one, try it out and work with the author on a common solution. From 573df1a8ffa8167e29a8e403a0a0caedac84c972 Mon Sep 17 00:00:00 2001 From: ncanceill Date: Fri, 16 Oct 2015 23:34:34 +0200 Subject: [PATCH 0181/1083] contributing: "eg" -> "e.g." because oxford see http://www.oxforddictionaries.com/definition/english/e.g. --- CONTRIBUTING.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f86acd66e..c17787041 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -39,7 +39,7 @@ It should include the data gathered as indicated above, along with: 2. What the expected behavior should be 3. What the actual behavior is -Please copy to anyone relevant (_eg_ plugin maintainers) by mentioning their GitHub handle +Please copy to anyone relevant (e.g. plugin maintainers) by mentioning their GitHub handle (starting with `@`) in your message. We will do our very best to help you. @@ -51,7 +51,7 @@ your suggestion. If you find one, comment on it so we can know there are more people supporting it. -If not, you can go ahead and create an issue. Please copy to anyone relevant (_eg_ plugin +If not, you can go ahead and create an issue. Please copy to anyone relevant (e.g. plugin maintainers) by mentioning their GitHub handle (starting with `@`) in your message. ## Submitting Pull Requests @@ -78,7 +78,7 @@ If the solution is already reported, try it out and +1 the pull request if the solution works ok. On the other hand, if you think your solution is better, post it with a reference to the other one so we can have both solutions to compare. -If not, then go ahead and submit a PR. Please copy to anyone relevant (_eg_ plugin +If not, then go ahead and submit a PR. Please copy to anyone relevant (e.g. plugin maintainers) by mentioning their GitHub handle (starting with `@`) in your message. ### You have an addition @@ -91,10 +91,10 @@ related to what you want to add. If you find one, try it out and work with the author on a common solution. -If not, then go ahead and submit a PR. Please copy to anyone relevant (_eg_ plugin +If not, then go ahead and submit a PR. Please copy to anyone relevant (e.g. plugin maintainers) by mentioning their GitHub handle (starting with `@`) in your message. -For any extensive change, _eg_ a new plugin, you will have to find testers to +1 your PR. +For any extensive change, e.g. a new plugin, you will have to find testers to +1 your PR. ---- From b4b55fa502af7b545d04045474d1550d57274c42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elias=20Fr=C3=B6hner?= Date: Thu, 30 Mar 2017 20:46:25 +0200 Subject: [PATCH 0182/1083] Remove wrong whitespace in bira theme (#5985) The whitespace in line 13 creates a double whitespace when combined with line 24. Therefore 2 whitespaces appear between ${user_host} and ${current_dir}. --- themes/bira.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/bira.zsh-theme b/themes/bira.zsh-theme index 4b2853c32..29bda0be8 100644 --- a/themes/bira.zsh-theme +++ b/themes/bira.zsh-theme @@ -10,7 +10,7 @@ else local user_symbol='$' fi -local current_dir='%{$terminfo[bold]$fg[blue]%} %~%{$reset_color%}' +local current_dir='%{$terminfo[bold]$fg[blue]%}%~%{$reset_color%}' local rvm_ruby='' if which rvm-prompt &> /dev/null; then rvm_ruby='%{$fg[red]%}‹$(rvm-prompt i v g)›%{$reset_color%}' From aaf7fa007fa05c3c2b0b5fdc983494b7442a6196 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Wed, 23 Nov 2016 22:06:30 +0100 Subject: [PATCH 0183/1083] Add deprecation notice to pure theme --- themes/pure.zsh-theme | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 themes/pure.zsh-theme diff --git a/themes/pure.zsh-theme b/themes/pure.zsh-theme new file mode 100644 index 000000000..98c1312af --- /dev/null +++ b/themes/pure.zsh-theme @@ -0,0 +1,10 @@ +print -P '%F{yellow}'Oh My Zsh pure theme: +cat <<-EOF + + The pure theme has been renamed as 'refined' as per the original author's + request. Change your ZSH_THEME to 'refined' to avoid seeing this warning. + +EOF +print -P '%f' + +source ${0:h:A}/refined.zsh-theme From 5667161d49b9ddc4ea8de7a379d50fc2cb7ffb50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Fri, 21 Apr 2017 20:18:16 +0200 Subject: [PATCH 0184/1083] Fix host display in nebirhos theme Fixes #6028 --- themes/nebirhos.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/nebirhos.zsh-theme b/themes/nebirhos.zsh-theme index a5a226b69..e2424465a 100644 --- a/themes/nebirhos.zsh-theme +++ b/themes/nebirhos.zsh-theme @@ -11,7 +11,7 @@ else fi # Get the host name (first 4 chars) -HOST_PROMPT_="%{$fg_bold[red]%}@$HOST[0,4] ➜ %{$fg_bold[cyan]%}%c " +HOST_PROMPT_="%{$fg_bold[red]%}@$HOST ➜ %{$fg_bold[cyan]%}%c " GIT_PROMPT="%{$fg_bold[blue]%}\$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}" PROMPT="$HOST_PROMPT_$RUBY_PROMPT_$GIT_PROMPT" From 291e96dcd034750fbe7473482508c08833b168e3 Mon Sep 17 00:00:00 2001 From: Vihang Mehta Date: Wed, 3 May 2017 03:06:07 -0700 Subject: [PATCH 0185/1083] Fix RKJ theme coloring and make it slightly more readable (#5582) --- themes/rkj-repos.zsh-theme | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/themes/rkj-repos.zsh-theme b/themes/rkj-repos.zsh-theme index a3f1f3dfa..ba2a0dba6 100644 --- a/themes/rkj-repos.zsh-theme +++ b/themes/rkj-repos.zsh-theme @@ -23,14 +23,14 @@ function mygit() { if [[ "$(git config --get oh-my-zsh.hide-status)" != "1" ]]; then ref=$(command git symbolic-ref HEAD 2> /dev/null) || \ ref=$(command git rev-parse --short HEAD 2> /dev/null) || return - echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$(git_prompt_short_sha)$( git_prompt_status )%{$reset_color%}$ZSH_THEME_GIT_PROMPT_SUFFIX " + echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$(git_prompt_short_sha)$(git_prompt_status)%{$fg_bold[blue]%}$ZSH_THEME_GIT_PROMPT_SUFFIX " fi } function retcode() {} # alternate prompt with git & hg -PROMPT=$'%{\e[0;34m%}%B┌─[%b%{\e[0m%}%{\e[1;32m%}%n%{\e[1;30m%}@%{\e[0m%}%{\e[0;36m%}%m%{\e[0;34m%}%B]%b%{\e[0m%} - %b%{\e[0;34m%}%B[%b%{\e[1;37m%}%~%{\e[0;34m%}%B]%b%{\e[0m%} - %{\e[0;34m%}%B[%b%{\e[0;33m%}'%D{"%Y-%m-%d %I:%M:%S"}%b$'%{\e[0;34m%}%B]%b%{\e[0m%} -%{\e[0;34m%}%B└─%B[%{\e[1;35m%}%?$(retcode)%{\e[0;34m%}%B] <$(mygit)$(hg_prompt_info)>%{\e[0m%}%b ' +PROMPT=$'%{$fg_bold[blue]%}┌─[%{$fg_bold[green]%}%n%b%{$fg[black]%}@%{$fg[cyan]%}%m%{$fg_bold[blue]%}]%{$reset_color%} - %{$fg_bold[blue]%}[%{$fg_bold[white]%}%~%{$fg_bold[blue]%}]%{$reset_color%} - %{$fg_bold[blue]%}[%b%{$fg[yellow]%}'%D{"%Y-%m-%d %I:%M:%S"}%b$'%{$fg_bold[blue]%}] +%{$fg_bold[blue]%}└─[%{$fg_bold[magenta]%}%?$(retcode)%{$fg_bold[blue]%}] <$(mygit)$(hg_prompt_info)>%{$reset_color%} ' PS2=$' \e[0;34m%}%B>%{\e[0m%}%b ' From 1c958e02a5613a4312534b1afe9f9f8c4a0793c2 Mon Sep 17 00:00:00 2001 From: Tobias Preuss Date: Wed, 7 Jun 2017 23:47:47 +0200 Subject: [PATCH 0186/1083] Extend list of adb commands. (#5584) --- plugins/adb/_adb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/plugins/adb/_adb b/plugins/adb/_adb index f30f3247f..5f37bedac 100644 --- a/plugins/adb/_adb +++ b/plugins/adb/_adb @@ -13,9 +13,13 @@ _1st_arguments=( 'disconnect:disconnect from a TCP/IP device. Port 5555 is default.' 'emu:run emulator console command' 'forward:forward socket connections' +'get-devpath:print the device path' +'get-serialno:print the serial number of the device' +'get-state:print the current state of the device: offline | bootloader | device' 'help:show the help message' 'install:push this package file to the device and install it' 'jdwp:list PIDs of processes hosting a JDWP transport' +'keygen:generate adb public/private key' 'kill-server:kill the server if it is running' 'logcat:view device log' 'pull:copy file/dir from device' @@ -30,6 +34,7 @@ _1st_arguments=( 'start-server:ensure that there is a server running' 'tcpip:restart host adb in tcpip mode' 'uninstall:remove this app package from the device' +'usb:restart the adbd daemon listing on USB' 'version:show version num' 'wait-for-device:block until device is online' ) From d848c94804918138375041a9f800f401bec12068 Mon Sep 17 00:00:00 2001 From: Mauro Porras P Date: Thu, 22 Jun 2017 13:38:34 -0500 Subject: [PATCH 0187/1083] Add React Native aliases for logs (#5756) --- plugins/react-native/README.md | 3 +++ plugins/react-native/react-native.plugin.zsh | 3 +++ 2 files changed, 6 insertions(+) diff --git a/plugins/react-native/README.md b/plugins/react-native/README.md index c6fe396b8..980246cf1 100644 --- a/plugins/react-native/README.md +++ b/plugins/react-native/README.md @@ -24,3 +24,6 @@ plugins=(... react-native) | **rnios5s** | `react-native run-ios --simulator "iPhone 5s"` | | **rnios6** | `react-native run-ios --simulator "iPhone 6"` | | **rnios6s** | `react-native run-ios --simulator "iPhone 6s"` | +| _Logging_ | +| **rnland** | `react-native log-android` | +| **rnlios** | `react-native log-ios` | diff --git a/plugins/react-native/react-native.plugin.zsh b/plugins/react-native/react-native.plugin.zsh index 892a31fbe..0566941a1 100644 --- a/plugins/react-native/react-native.plugin.zsh +++ b/plugins/react-native/react-native.plugin.zsh @@ -9,3 +9,6 @@ alias rnios5='react-native run-ios --simulator "iPhone 5"' alias rnios5s='react-native run-ios --simulator "iPhone 5s"' alias rnios6='react-native run-ios --simulator "iPhone 6"' alias rnios6s='react-native run-ios --simulator "iPhone 6s"' + +alias rnland='react-native log-android' +alias rnlios='react-native log-ios' From accdcb2f1c3cca40527fef1fe4ab2d39eb6cf897 Mon Sep 17 00:00:00 2001 From: Janosch Knack Date: Sun, 24 Sep 2017 20:19:49 +0200 Subject: [PATCH 0188/1083] improved maven plugin (#6298) * added some apache maven plugins added arguments added longversion of arguments * SC2006 shellcheck see https://github.com/koalaman/shellcheck/wiki/SC2006 * SC2068 shellcheck see https://github.com/koalaman/shellcheck/wiki/SC2068 * SC2086 shellcheck see https://github.com/koalaman/shellcheck/wiki/SC2086 * shellcheck is not always right ;) --- plugins/mvn/mvn.plugin.zsh | 159 ++++++++++++++++++++++++++++--------- 1 file changed, 122 insertions(+), 37 deletions(-) diff --git a/plugins/mvn/mvn.plugin.zsh b/plugins/mvn/mvn.plugin.zsh index c5a7faa0f..f1e4d3ee0 100644 --- a/plugins/mvn/mvn.plugin.zsh +++ b/plugins/mvn/mvn.plugin.zsh @@ -1,24 +1,24 @@ # mvn-color based on https://gist.github.com/1027800 -BOLD=`tput bold` -UNDERLINE_ON=`tput smul` -UNDERLINE_OFF=`tput rmul` -TEXT_BLACK=`tput setaf 0` -TEXT_RED=`tput setaf 1` -TEXT_GREEN=`tput setaf 2` -TEXT_YELLOW=`tput setaf 3` -TEXT_BLUE=`tput setaf 4` -TEXT_MAGENTA=`tput setaf 5` -TEXT_CYAN=`tput setaf 6` -TEXT_WHITE=`tput setaf 7` -BACKGROUND_BLACK=`tput setab 0` -BACKGROUND_RED=`tput setab 1` -BACKGROUND_GREEN=`tput setab 2` -BACKGROUND_YELLOW=`tput setab 3` -BACKGROUND_BLUE=`tput setab 4` -BACKGROUND_MAGENTA=`tput setab 5` -BACKGROUND_CYAN=`tput setab 6` -BACKGROUND_WHITE=`tput setab 7` -RESET_FORMATTING=`tput sgr0` +BOLD=$(tput bold) +UNDERLINE_ON=$(tput smul) +UNDERLINE_OFF=$(tput rmul) +TEXT_BLACK=$(tput setaf 0) +TEXT_RED=$(tput setaf 1) +TEXT_GREEN=$(tput setaf 2) +TEXT_YELLOW=$(tput setaf 3) +TEXT_BLUE=$(tput setaf 4) +TEXT_MAGENTA=$(tput setaf 5) +TEXT_CYAN=$(tput setaf 6) +TEXT_WHITE=$(tput setaf 7) +BACKGROUND_BLACK=$(tput setab 0) +BACKGROUND_RED=$(tput setab 1) +BACKGROUND_GREEN=$(tput setab 2) +BACKGROUND_YELLOW=$(tput setab 3) +BACKGROUND_BLUE=$(tput setab 4) +BACKGROUND_MAGENTA=$(tput setab 5) +BACKGROUND_CYAN=$(tput setab 6) +BACKGROUND_WHITE=$(tput setab 7) +RESET_FORMATTING=$(tput sgr0) # Wrapper function for Maven's mvn command. @@ -26,15 +26,15 @@ mvn-color() { ( # Filter mvn output using sed. Before filtering set the locale to C, so invalid characters won't break some sed implementations unset LANG - LC_CTYPE=C mvn $@ | sed -e "s/\(\[INFO\]\)\(.*\)/${TEXT_BLUE}${BOLD}\1${RESET_FORMATTING}\2/g" \ + LC_CTYPE=C mvn "$@" | sed -e "s/\(\[INFO\]\)\(.*\)/${TEXT_BLUE}${BOLD}\1${RESET_FORMATTING}\2/g" \ -e "s/\(\[INFO\]\ BUILD SUCCESSFUL\)/${BOLD}${TEXT_GREEN}\1${RESET_FORMATTING}/g" \ -e "s/\(\[WARNING\]\)\(.*\)/${BOLD}${TEXT_YELLOW}\1${RESET_FORMATTING}\2/g" \ -e "s/\(\[ERROR\]\)\(.*\)/${BOLD}${TEXT_RED}\1${RESET_FORMATTING}\2/g" \ -e "s/Tests run: \([^,]*\), Failures: \([^,]*\), Errors: \([^,]*\), Skipped: \([^,]*\)/${BOLD}${TEXT_GREEN}Tests run: \1${RESET_FORMATTING}, Failures: ${BOLD}${TEXT_RED}\2${RESET_FORMATTING}, Errors: ${BOLD}${TEXT_RED}\3${RESET_FORMATTING}, Skipped: ${BOLD}${TEXT_YELLOW}\4${RESET_FORMATTING}/g" # Make sure formatting is reset - echo -ne ${RESET_FORMATTING} - ) + echo -ne "${RESET_FORMATTING}" + ) } # Override the mvn command with the colorized one. @@ -76,18 +76,18 @@ function listMavenCompletions { # failsafe failsafe:integration-test failsafe:verify # install - install:install-file + install:install-file install:help # site - site:site site:deploy site:run site:stage site:stage-deploy + site:site site:deploy site:run site:stage site:stage-deploy site:attach-descriptor site:jar site:effective-site # surefire surefire:test # checkstyle - checkstyle:checkstyle checkstyle:check + checkstyle:checkstyle checkstyle:check checkstyle:checkstyle-aggregate # javadoc - javadoc:javadoc javadoc:jar javadoc:aggregate + javadoc:javadoc javadoc:test-javadoc javadoc:javadoc-no-fork javadoc:test-javadoc-no-fork javadoc:aggregate javadoc:test-aggregate javadoc:jar javadoc:test-jar javadoc:aggregate-jar javadoc:test-aggregate-jar javadoc:fix javadoc:test-fix javadoc:resource-bundle javadoc:test-resource-bundle # jxr - jxr:jxr + jxr:jxr jxr:aggregate jxr:test-jxr jxr:test-aggregate # pmd pmd:pmd pmd:cpd pmd:check pmd:cpd-check @@ -100,21 +100,21 @@ function listMavenCompletions { # assembly assembly:single assembly:assembly # dependency - dependency:analyze dependency:analyze-dep-mgt dependency:analyze-only dependency:analyze-report dependency:build-classpath dependency:copy dependency:copy-dependencies dependency:get dependency:go-offline dependency:list dependency:purge-local-repository dependency:resolve dependency:resolve-plugins dependency:sources dependency:tree dependency:unpack dependency:unpack-dependencies + dependency:analyze dependency:analyze-dep-mgt dependency:analyze-only dependency:analyze-report dependency:analyze-duplicate dependency:build-classpath dependency:copy dependency:copy-dependencies dependency:display-ancestors dependency:get dependency:go-offline dependency:list dependency:list-repositories dependency:properties dependency:purge-local-repository dependency:resolve dependency:resolve-plugins dependency:sources dependency:tree dependency:unpack dependency:unpack-dependencies # enforcer - enforcer:enforce + enforcer:enforce enforcer:display-info # gpg gpg:sign gpg:sign-and-deploy-file # help help:active-profiles help:all-profiles help:describe help:effective-pom help:effective-settings help:evaluate help:expressions help:system # release - release:clean release:prepare release:rollback release:perform release:stage release:branch release:update-versions + release:clean release:prepare release:prepare-with-pom release:rollback release:perform release:stage release:branch release:update-versions # jgitflow jgitflow:feature-start jgitflow:feature-finish jgitflow:release-start jgitflow:release-finish jgitflow:hotfix-start jgitflow:hotfix-finish jgitflow:build-number # repository repository:bundle-create repository:bundle-pack # source - source:aggregate source:jar source:jar-no-fork + source:aggregate source:jar source:jar-no-fork source:test-jar source:test-jar-no-fork # eclipse eclipse:clean eclipse:eclipse @@ -142,7 +142,7 @@ function listMavenCompletions { # versions versions:display-dependency-updates versions:display-plugin-updates versions:display-property-updates versions:update-parent versions:update-properties versions:update-child-modules versions:lock-snapshots versions:unlock-snapshots versions:resolve-ranges versions:set versions:use-releases versions:use-next-releases versions:use-latest-releases versions:use-next-snapshots versions:use-latest-snapshots versions:use-next-versions versions:use-latest-versions versions:commit versions:revert # scm - scm:add scm:checkin scm:checkout scm:update scm:status + scm:add scm:bootstrap scm:branch scm:changelog scm:check-local-modification scm:checkin scm:checkout scm:diff scm:edit scm:export scm:list scm:remove scm:status scm:tag scm:unedit scm:update scm:update-subprojects scm:validate # buildnumber buildnumber:create buildnumber:create-timestamp buildnumber:help buildnumber:hgchangeset @@ -173,17 +173,102 @@ function listMavenCompletions { gwt:browser gwt:clean gwt:compile gwt:compile-report gwt:css gwt:debug gwt:eclipse gwt:eclipseTest gwt:generateAsync gwt:help gwt:i18n gwt:mergewebxml gwt:resources gwt:run gwt:sdkInstall gwt:source-jar gwt:soyc gwt:test # asciidoctor asciidoctor:process-asciidoc asciidoctor:auto-refresh asciidoctor:http asciidoctor:zip + # compiler + compiler:compile compiler:testCompile + # resources + resources:resources resources:testResources resources:copy-resources + # verifier + verifier:verify + # jar + jar:jar jar:test-jar + # rar + rar:rar + # acr + acr:acr + # shade + shade:shade + # changelog + changelog:changelog changelog:dev-activity changelog:file-activity + # changes + changes:announcement-mail changes:announcement-generate changes:changes-check changes:changes-validate changes:changes-report changes:jira-report changes:trac-report changes:github-report + # doap + doap:generate + # docck + docck:check + # jdeps + jdeps:jdkinternals jdeps:test-jdkinternals + # linkcheck + linkcheck:linkcheck + # project-info-reports + project-info-reports:cim project-info-reports:dependencies project-info-reports:dependency-convergence project-info-reports:dependency-info project-info-reports:dependency-management project-info-reports:distribution-management project-info-reports:help project-info-reports:index project-info-reports:issue-tracking project-info-reports:license project-info-reports:mailing-list project-info-reports:modules project-info-reports:plugin-management project-info-reports:plugins project-info-reports:project-team project-info-reports:scm project-info-reports:summary + # surefire-report + surefire-report:failsafe-report-only surefire-report:report surefire-report:report-only + # invoker + invoker:install invoker:integration-test invoker:verify invoker:run + # jarsigner + jarsigner:sign jarsigner:verify + # patch + patch:apply + # pdf + pdf:pdf + # plugin + plugin:descriptor plugin:report plugin:updateRegistry plugin:addPluginArtifactMetadata plugin:helpmojo + # remote-resources + remote-resources:bundle remote-resources:process + # scm-publish + scm-publish:help scm-publish:publish-scm scm-publish:scmpublish + # stage + stage:copy + # toolchain + toolchain:toolchain + # options - -Dmaven.test.skip=true -DskipTests -DskipITs -Dmaven.surefire.debug -DenableCiProfile -Dpmd.skip=true -Dcheckstyle.skip=true -Dtycho.mode=maven -Dmaven.test.failure.ignore=true -DgroupId= -DartifactId= -Dversion= -Dpackaging=jar -Dfile= + "-Dmaven.test.skip=true" -DskipTests -DskipITs -Dmaven.surefire.debug -DenableCiProfile "-Dpmd.skip=true" "-Dcheckstyle.skip=true" "-Dtycho.mode=maven" "-Dmaven.test.failure.ignore=true" "-DgroupId=" "-DartifactId=" "-Dversion=" "-Dpackaging=jar" "-Dfile=" # arguments - -am -amd -B -C -c -cpu -D -e -emp -ep -f -fae -ff -fn -gs -h -l -N -npr -npu -nsu -o -P -pl -q -rf -s -T -t -U -up -V -v -X + -am --also-make + -amd --also-make-dependents-am + -B --batch-mode + -b --builder + -C --strict-checksums + -c --lax-checksums + -cpu --check-plugin-updates + -D --define + -e --errors + -emp --encrypt-master-password + -ep --encrypt-password + -f --file + -fae --fail-at-end + -ff --fail-fast + -fn --fail-never + -gs --global-settings + -gt --global-toolchains + -h --help + -l --log-file + -llr --legacy-local-repository + -N --non-recursive + -npr --no-plugin-registry + -npu --no-plugin-updates + -nsu --no-snapshot-updates + -o --offline + -P --activate-profiles + -pl --projects + -q --quiet + -rf --resume-from + -s --settings + -t --toolchains + -T --threads + -U --update-snapshots + -up --update-plugins + -v --version + -V --show-version + -X --debug cli:execute cli:execute-phase archetype:generate generate-sources cobertura:cobertura - -Dtest= `if [ -d ./src/test/java ] ; then find ./src/test/java -type f -name '*.java' | grep -v svn | sed 's?.*/\([^/]*\)\..*?-Dtest=\1?' ; fi` - -Dit.test= `if [ -d ./src/test/java ] ; then find ./src/test/java -type f -name '*.java' | grep -v svn | sed 's?.*/\([^/]*\)\..*?-Dit.test=\1?' ; fi` + -Dtest=$(if [ -d ./src/test/java ] ; then find ./src/test/java -type f -name '*.java' | grep -v svn | sed 's?.*/\([^/]*\)\..*?-Dtest=\1?' ; fi) + -Dit.test=$(if [ -d ./src/test/java ] ; then find ./src/test/java -type f -name '*.java' | grep -v svn | sed 's?.*/\([^/]*\)\..*?-Dit.test=\1?' ; fi) ); } From 57742ccd726adcd1106c4e0ccee49c3514fa29e5 Mon Sep 17 00:00:00 2001 From: Zach Whitten Date: Wed, 1 Nov 2017 08:23:14 -0400 Subject: [PATCH 0189/1083] Update to mix plugin to support Phoenix v1.3.0+ tasks (#6355) --- plugins/mix/_mix | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/plugins/mix/_mix b/plugins/mix/_mix index cfeb4705e..025572a4d 100644 --- a/plugins/mix/_mix +++ b/plugins/mix/_mix @@ -36,6 +36,8 @@ _1st_arguments=( 'loadconfig:Loads and persists the given configuration' 'local:List local tasks' 'local.hex:Install hex locally' + 'local.phoenix:Updates Phoenix locally' + 'local.phx:Updates the Phoenix project generator locally' 'local.rebar:Install rebar locally' 'new:Create a new Elixir project' 'phoenix.digest:Digests and compress static files' @@ -44,9 +46,24 @@ _1st_arguments=( 'phoenix.gen.json:Generates a controller and model for a JSON based resource' 'phoenix.gen.model:Generates an Ecto model' 'phoenix.gen.secret:Generates a secret' - 'phoenix.new:Create a new Phoenix application' + 'phoenix.new:Creates a new Phoenix v1.2.1 application' 'phoenix.routes:Prints all routes' 'phoenix.server:Starts applications and their servers' + 'phx.digest:Digests and compresses static files' + 'phx.digest.clean:Removes old versions of static assets.' + 'phx.gen.channel:Generates a Phoenix channel' + 'phx.gen.context:Generates a context with functions around an Ecto schema' + 'phx.gen.embedded:Generates an embedded Ecto schema file' + 'phx.gen.html:Generates controller, views, and context for an HTML resource' + 'phx.gen.json:Generates controller, views, and context for a JSON resource' + 'phx.gen.presence:Generates a Presence tracker' + 'phx.gen.schema:Generates an Ecto schema and migration file' + 'phx.gen.secret:Generates a secret' + 'phx.new:Creates a new Phoenix v1.3.0 application' + 'phx.new.ecto:Creates a new Ecto project within an umbrella project' + 'phx.new.web:Creates a new Phoenix web project within an umbrella project' + 'phx.routes:Prints all routes' + 'phx.server:Starts applications and their servers' 'run:Run the given file or expression' "test:Run a project's tests" '--help:Describe available tasks' @@ -58,7 +75,7 @@ __task_list () local expl declare -a tasks - tasks=(app.start archive archive.build archive.install archive.uninstall clean cmd compile compile.protocols deps deps.clean deps.compile deps.get deps.unlock deps.update do escript.build help hex hex.config hex.docs hex.info hex.key hex.outdated hex.owner hex.publish hex.search hex.user loadconfig local local.hex local.rebar new phoenix.digest phoenix.gen.channel phoenix.gen.html phoenix.gen.json phoenix.gen.model phoenix.gen.secret phoenix.new phoenix.routes phoenix.server run test) + tasks=(app.start archive archive.build archive.install archive.uninstall clean cmd compile compile.protocols deps deps.clean deps.compile deps.get deps.unlock deps.update do escript.build help hex hex.config hex.docs hex.info hex.key hex.outdated hex.owner hex.publish hex.search hex.user loadconfig local local.hex local.rebar new phoenix.digest phoenix.gen.channel phoenix.gen.html phoenix.gen.json phoenix.gen.model phoenix.gen.secret phoenix.new phoenix.routes phoenix.server phx.digest phx.digest.clean phx.gen.channel phx.gen.context phx.gen.embedded phx.gen.html phx.gen.json phx.gen.presence phx.gen.schema phx.gen.secret phx.new phx.new.ecto phx.new.web phx.routes phx.server run test) _wanted tasks expl 'help' compadd $tasks } From 1700c948b4cbc5c99640e01923cd6b6e58baebee Mon Sep 17 00:00:00 2001 From: Tomas Chmelevskij Date: Wed, 1 Nov 2017 12:55:19 +0000 Subject: [PATCH 0190/1083] Add chaced word diff (#6378) --- 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 34942d387..52dcea7dd 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -85,6 +85,7 @@ alias gcs='git commit -S' alias gd='git diff' alias gdca='git diff --cached' +alias gdcw='git diff --cached --word-diff' alias gdct='git describe --tags `git rev-list --tags --max-count=1`' alias gdt='git diff-tree --no-commit-id --name-only -r' alias gdw='git diff --word-diff' From 47406d7afe01824182b90d1c0d0a460e1f07db5e Mon Sep 17 00:00:00 2001 From: Paul Morganthall Date: Wed, 1 Nov 2017 08:56:14 -0400 Subject: [PATCH 0191/1083] Replace preview link. (#6369) The old preview on Skitch is no longer available (closed account?). The new preview is on a free Flickr which might last longer. ? --- themes/gallifrey.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/gallifrey.zsh-theme b/themes/gallifrey.zsh-theme index fce7cb923..252566f06 100644 --- a/themes/gallifrey.zsh-theme +++ b/themes/gallifrey.zsh-theme @@ -1,4 +1,4 @@ -# ZSH Theme - Preview: http://img.skitch.com/20091113-qqtd3j8xinysujg5ugrsbr7x1y.jpg +# ZSH Theme - Preview: https://flic.kr/p/ZFvivf local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" PROMPT='%{$fg[green]%}%m%{$reset_color%} %2~ $(git_prompt_info)%{$reset_color%}%B»%b ' From b5898a5ec663177210db95b28155d14da64170f0 Mon Sep 17 00:00:00 2001 From: madpawel Date: Wed, 1 Nov 2017 13:56:29 +0100 Subject: [PATCH 0192/1083] add -backend-config flag to terraform init command (#6370) --- plugins/terraform/_terraform | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/terraform/_terraform b/plugins/terraform/_terraform index 97c42a559..d67820603 100644 --- a/plugins/terraform/_terraform +++ b/plugins/terraform/_terraform @@ -62,6 +62,7 @@ __init() { '-address=[(url) URL of the remote storage server. Required for HTTP backend, optional for Atlas and Consul.]' \ '-access-token=[(token) Authentication token for state storage server. Required for Atlas backend, optional for Consul.]' \ '-backend=[(atlas) Specifies the type of remote backend. Must be one of Atlas, Consul, or HTTP. Defaults to atlas.]' \ + '-backend-config=[(path) Specifies the path to remote backend config file.]' \ '-name=[(name) Name of the state file in the state storage server. Required for Atlas backend.]' \ '-path=[(path) Path of the remote state in Consul. Required for the Consul backend.]' } From 2e4539b0d4613e8e5081c81b80959e506038d295 Mon Sep 17 00:00:00 2001 From: Clay Anderson Date: Wed, 1 Nov 2017 06:57:15 -0600 Subject: [PATCH 0193/1083] Added link to powerline (#6352) --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index fd4a0abc0..558d24120 100644 --- a/README.md +++ b/README.md @@ -79,10 +79,11 @@ To use a different theme, simply change the value to match the name of your desi ```shell ZSH_THEME="agnoster" # (this is one of the fancy ones) -# you might need to install a special Powerline font on your console's host for this to work # see https://github.com/robbyrussell/oh-my-zsh/wiki/Themes#agnoster ``` +_Note: many themes require installing the [Powerline Fonts](https://github.com/powerline/fonts) in order to render properly._ + Open up a new terminal window and your prompt should look something like this: ![Agnoster theme](https://cloud.githubusercontent.com/assets/2618447/6316862/70f58fb6-ba03-11e4-82c9-c083bf9a6574.png) From 2102d10896fe14e912ed6ed8075bb0ddd3a5bc6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20F=C3=A6revaag?= Date: Wed, 1 Nov 2017 22:03:34 +0900 Subject: [PATCH 0194/1083] [wd] Update wd plugin to latest version (#6371) * [wd] Update wd plugin to v0.4.3 * [wd] Update wd plugin to v0.4.4 --- plugins/wd/README.md | 23 ++++++++++----- plugins/wd/_wd.sh | 21 +++++++++++++- plugins/wd/wd.sh | 67 +++++++++++++++++++++++++++----------------- 3 files changed, 78 insertions(+), 33 deletions(-) diff --git a/plugins/wd/README.md b/plugins/wd/README.md index ed149eb3e..b1deeffd5 100644 --- a/plugins/wd/README.md +++ b/plugins/wd/README.md @@ -3,16 +3,17 @@ wd [![Build Status](https://travis-ci.org/mfaerevaag/wd.png?branch=master)](https://travis-ci.org/mfaerevaag/wd) -`wd` (*warp directory*) lets you jump to custom directories in zsh, without using `cd`. Why? Because `cd` seems ineffecient when the folder is frequently visited or has a long path. +`wd` (*warp directory*) lets you jump to custom directories in zsh, without using `cd`. Why? Because `cd` seems inefficient when the folder is frequently visited or has a long path. -*NOTE*: If you are not using zsh, check out the `ruby` branch which has `wd` implemented as a gem. +![tty.gif](https://raw.githubusercontent.com/mfaerevaag/wd/master/tty.gif) +*NEWS*: If you are not using zsh, check out the c-port, [wd-c](https://github.com/mfaerevaag/wd-c), which works with all shells using wrapper functions. ### Setup ### oh-my-zsh -`wd` comes bundles with [oh-my-zshell](https://github.com/robbyrussell/oh-my-zsh)! +`wd` comes bundled with [oh-my-zshell](https://github.com/robbyrussell/oh-my-zsh)! Just add the plugin in your `~/.zshrc` file: @@ -27,6 +28,10 @@ Run either in terminal: * `wget --no-check-certificate https://github.com/mfaerevaag/wd/raw/master/install.sh -O - | sh` +##### Arch ([AUR](https://aur.archlinux.org/)) + + # yaourt -S zsh-plugin-wd-git + #### Manual @@ -48,7 +53,7 @@ Run either in terminal: #### Completion -If you're NOT using [oh-my-zsh](https://github.com/robbyrussell/oh-my-zsh) and you want to utelize the zsh-completion feature, you will also need to add the path to your `wd` installation (`~/bin/wd` if you used the automatic installer) to your `fpath`. E.g. in your `~/.zshrc`: +If you're NOT using [oh-my-zsh](https://github.com/robbyrussell/oh-my-zsh) and you want to utilize the zsh-completion feature, you will also need to add the path to your `wd` installation (`~/bin/wd` if you used the automatic installer) to your `fpath`. E.g. in your `~/.zshrc`: fpath=(~/path/to/wd $fpath) @@ -66,7 +71,9 @@ Also, you may have to force a rebuild of `zcompdump` by running: If a warp point with the same name exists, use `add!` to overwrite it. - Note, a warp point cannot contain colons, or only consist of only spaces and dots. The first will conflict in how `wd` stores the warp points, and the second will conflict other features, as below. + Note, a warp point cannot contain colons, or only consist of only spaces and dots. The first will conflict in how `wd` stores the warp points, and the second will conflict with other features, as below. + + You can omit point name to use the current directory's name instead. * From an other directory (not necessarily), warp to `foo` with: @@ -84,6 +91,8 @@ Also, you may have to force a rebuild of `zcompdump` by running: $ wd rm foo + You can omit point name to use the current directory's name instead. + * List all warp points (stored in `~/.warprc`): $ wd list @@ -143,8 +152,8 @@ The project is licensed under the [MIT-license](https://github.com/mfaerevaag/wd ### Finally -If you have issues, feedback or improvements, don't hesitate to report it or submit a pull-request. In the case of an issue, we would much appreciate if you would include a failing test in `test/tests.sh`. Explanation on how to run the tests, read the section "Testing" in this README. +If you have issues, feedback or improvements, don't hesitate to report it or submit a pull-request. In the case of an issue, we would much appreciate if you would include a failing test in `test/tests.sh`. For an explanation on how to run the tests, read the section "Testing" in this README. -Credit to [altschuler](https://github.com/altschuler) for awesome idea. +Credit to [altschuler](https://github.com/altschuler) for an awesome idea. Hope you enjoy! diff --git a/plugins/wd/_wd.sh b/plugins/wd/_wd.sh index b67f4a1e2..65fa1ddde 100644 --- a/plugins/wd/_wd.sh +++ b/plugins/wd/_wd.sh @@ -16,6 +16,19 @@ function _wd() { warp_points=( "${(f)mapfile[$CONFIG]//$HOME/~}" ) + typeset -A points + while read -r line + do + arr=(${(s,:,)line}) + name=${arr[1]} + path=${arr[2]} + + # replace ~ from path to fix completion (#17) + path=${path/#\~/$HOME} + + points[$name]=$path + done < $CONFIG + commands=( 'add:Adds the current working directory to your warp points' 'add!:Overwrites existing warp point' @@ -34,13 +47,15 @@ function _wd() { '1: :->first_arg' \ '2: :->second_arg' && ret=0 + local target=$words[2] + case $state in first_arg) _describe -t warp_points "Warp points" warp_points && ret=0 _describe -t commands "Commands" commands && ret=0 ;; second_arg) - case $words[2] in + case $target in add\!|rm) _describe -t points "Warp points" warp_points && ret=0 ;; @@ -56,6 +71,10 @@ function _wd() { path) _describe -t points "Warp points" warp_points && ret=0 ;; + *) + # complete sub directories from the warp point + _path_files -W "(${points[$target]})" -/ && ret=0 + ;; esac ;; esac diff --git a/plugins/wd/wd.sh b/plugins/wd/wd.sh index cf54713bd..c330dd358 100755 --- a/plugins/wd/wd.sh +++ b/plugins/wd/wd.sh @@ -8,7 +8,7 @@ # @github.com/mfaerevaag/wd # version -readonly WD_VERSION=0.4.2 +readonly WD_VERSION=0.4.4 # colors readonly WD_BLUE="\033[96m" @@ -72,25 +72,28 @@ wd_print_msg() wd_print_usage() { cat <<- EOF -Usage: wd [command] +Usage: wd [command] [point] Commands: - add Adds the current working directory to your warp points - add! Overwrites existing warp point - rm Removes the given warp point - show Print warp points to current directory - show Print path to given warp point - list Print all stored warp points -ls Show files from given warp point -path Show the path to given warp point - clean! Remove points warping to nonexistent directories + add Adds the current working directory to your warp points + add Adds the current working directory to your warp points with current directory's name + add! Overwrites existing warp point + add! Overwrites existing warp point with current directory's name + rm Removes the given warp point + rm Removes the given warp point with current directory's name + show Print path to given warp point + show Print warp points to current directory + list Print all stored warp points + ls Show files from given warp point (ls) + path Show the path to given warp point (pwd) + clean! Remove points warping to nonexistent directories - -v | --version Print version - -d | --debug Exit after execution with exit codes (for testing) - -c | --config Specify config file (default ~/.warprc) - -q | --quiet Suppress all output + -v | --version Print version + -d | --debug Exit after execution with exit codes (for testing) + -c | --config Specify config file (default ~/.warprc) + -q | --quiet Suppress all output - help Show this extremely helpful text + help Show this extremely helpful text EOF } @@ -131,10 +134,11 @@ wd_getdir() wd_warp() { local point=$1 + local sub=$2 if [[ $point =~ "^\.+$" ]] then - if [ $#1 < 2 ] + if [[ $#1 < 2 ]] then wd_exit_warn "Warping to current directory?" else @@ -143,7 +147,12 @@ wd_warp() fi elif [[ ${points[$point]} != "" ]] then - cd ${points[$point]/#\~/$HOME} + if [[ $sub != "" ]] + then + cd ${points[$point]/#\~/$HOME}/$sub + else + cd ${points[$point]/#\~/$HOME} + fi else wd_exit_fail "Unknown warp point '${point}'" fi @@ -154,6 +163,11 @@ wd_add() local force=$1 local point=$2 + if [[ $point == "" ]] + then + point=$(basename $PWD) + fi + if [[ $point =~ "^[\.]+$" ]] then wd_exit_fail "Warp point cannot be just dots" @@ -163,10 +177,7 @@ wd_add() elif [[ $point == *:* ]] then wd_exit_fail "Warp point cannot contain colons" - elif [[ $point == "" ]] - then - wd_exit_fail "Warp point cannot be empty" - elif [[ ${points[$2]} == "" ]] || $force + elif [[ ${points[$point]} == "" ]] || $force then wd_remove $point > /dev/null printf "%q:%s\n" "${point}" "${PWD/#$HOME/~}" >> $WD_CONFIG @@ -185,6 +196,11 @@ wd_remove() { local point=$1 + if [[ $point == "" ]] + then + point=$(basename $PWD) + fi + if [[ ${points[$point]} != "" ]] then local config_tmp=$WD_CONFIG.tmp @@ -294,7 +310,7 @@ wd_clean() { key=${arr[1]} val=${arr[2]} - if [ -d "$val" ] + if [ -d "${val/#\~/$HOME}" ] then wd_tmp=$wd_tmp"\n"`echo $line` else @@ -356,7 +372,8 @@ while read -r line do arr=(${(s,:,)line}) key=${arr[1]} - val=${arr[2]} + # join the rest, in case the path contains colons + val=${(j,:,)arr[2,-1]} points[$key]=$val done < $WD_CONFIG @@ -424,7 +441,7 @@ else break ;; *) - wd_warp $o + wd_warp $o $2 break ;; --) From e8e7bf3b892ef69aac97c171d02b4b026322dcec Mon Sep 17 00:00:00 2001 From: bjorn3 Date: Wed, 1 Nov 2017 14:04:03 +0100 Subject: [PATCH 0195/1083] Update rust plugin for latest rustc (#6342) * Update for latest rustc * Some debug option updates * Add some cargo flags * Fix bug in cargo plugin --- plugins/cargo/_cargo | 5 +++- plugins/rust/_rust | 65 ++++++++++++++++++++++++++++++++++---------- 2 files changed, 55 insertions(+), 15 deletions(-) diff --git a/plugins/cargo/_cargo b/plugins/cargo/_cargo index 175859202..54e709ca0 100644 --- a/plugins/cargo/_cargo +++ b/plugins/cargo/_cargo @@ -7,10 +7,13 @@ _cargo() { _arguments \ '(- 1 *)'{-h,--help}'[show help message]' \ + '(- 1 *)'{-V,--version}'[show version information]' \ '(- 1 *)'--list'[list installed commands]' \ + '(- 1 *)'--explain'[Run `rustc --explain CODE`]' \ '(- 1 *)'{-v,--verbose}'[use verbose output]' \ '(- 1 *)'--color'[colorization option]' \ - '(- 1 *)'{-V,--version}'[show version information]' \ + '(- 1 *)'--frozen'[Require Cargo.lock and cache are up to date]' \ + '(- 1 *)'--locked'[Require Cargo.lock is up to date]' \ '1: :_cargo_cmds' \ '*:: :->args' diff --git a/plugins/rust/_rust b/plugins/rust/_rust index f4e8f6f78..ac6aee160 100644 --- a/plugins/rust/_rust +++ b/plugins/rust/_rust @@ -15,59 +15,93 @@ _rustc_crate_types=( 'lib' 'rlib' 'dylib' + 'cdylib' 'staticlib' + 'proc-macro' ) _rustc_emit_types=( 'asm' - 'bc' - 'ir' + 'llvm-bc' + 'llvm-ir' 'obj' + 'metadata' 'link' + 'dep-info' + 'mir' +) +_rustc_print_types=( + 'crate-name' + 'file-names' + 'sysroot' + 'cfg' + 'target-list' + 'target-cpus' + 'target-features' + 'relocation-models' + 'code-models' + 'target-spec-json' + 'native-static-libs' ) _rustc_pretty_types=( 'normal[un-annotated source]' 'expanded[crates expanded]' - 'typed[crates expanded, with type annotations]' - 'identified[fully parenthesized, AST nodes and blocks with IDs]' + 'expanded,identified[fully parenthesized, AST nodes with IDs]' +) +_rustc_unpretty_types=( + 'normal[un-annotated source]' + 'expanded[crates expanded]' + 'expanded,identified[fully parenthesized, AST nodes with IDs]' 'flowgraph=[graphviz formatted flowgraph for node]:NODEID:' + 'everybody_loops[all function bodies replaced with `loop {}`]' + 'hir[the HIR]' + 'hir,identified' + 'hir,typed[HIR with types for each node]' ) _rustc_color_types=( 'auto[colorize, if output goes to a tty (default)]' 'always[always colorize output]' 'never[never colorize output]' ) +_rustc_error_format=( + 'human' + 'json' +) _rustc_opts_vals=( + --cfg='[Configure the compilation environment]:SPEC:' + -L'[Add a directory to the library search path]:DIR:_files -/' --crate-name='[Specify the name of the crate being built]' --crate-type='[Comma separated list of types of crates for the compiler to emit]:TYPES:_values -s "," "Crate types" "$_rustc_crate_types[@]"' --emit='[Comma separated list of types of output for the compiler to emit]:TYPES:_values -s "," "Emit Targets" "$_rustc_emit_types[@]"' + --print='[Comma separated list of compiler information to print on stdout]:TYPES:_values -s "," "Printable info" "$_rustc_print_types[@]"' + -o'[Write output to . Ignored if more than one --emit is specified.]:FILENAME:_files' + --out-dir='[Write output to compiler-chosen filename in . Ignored if -o is specified. (default the current directory)]:DIR:_files -/' + --explain='[Provide a detailed explanation of an error message]:OPT:' + --target='[Target triple cpu-manufacturer-kernel\[-os\] to compile]:TRIPLE:' + --extern'[Specify where an external rust library is located]:ARG:' + --sysroot='[Override the system root]:PATH:_files -/' + --error-format='[How errors and other messages are produced]:TYPES:_values "$_rustc_error_format"' --debuginfo='[Emit DWARF debug info to the objects created]:LEVEL:_values "Debug Levels" "$_rustc_debuginfo_levels[@]"' --dep-info='[Output dependency info to after compiling]::FILE:_files -/' - --sysroot='[Override the system root]:PATH:_files -/' - --cfg='[Configure the compilation environment]:SPEC:' - --out-dir='[Write output to compiler-chosen filename in . Ignored if -o is specified. (default the current directory)]:DIR:_files -/' - -o'[Write output to . Ignored if more than one --emit is specified.]:FILENAME:_files' --opt-level='[Optimize with possible levels 0-3]:LEVEL:(0 1 2 3)' --pretty='[Pretty-print the input instead of compiling]::TYPE:_values "TYPES" "$_rustc_pretty_types[@]"' - -L'[Add a directory to the library search path]:DIR:_files -/' - --target='[Target triple cpu-manufacturer-kernel\[-os\] to compile]:TRIPLE:' + --unpretty='[Present the input source, unstable (and less-pretty)]::TYPE:_values "TYPES" "$_rustc_unpretty_types[@]"' --color='[Configure coloring of output]:CONF:_values "COLORS" "$_rustc_color_types[@]"' {-v,--version}'[Print version info and exit]::VERBOSE:(verbose)' - --explain='[Provide a detailed explanation of an error message]:OPT:' - --extern'[Specify where an external rust library is located]:ARG:' ) _rustc_opts_switches=( -g'[Equivalent to --debuginfo=2]' + -O'[Equivalent to --opt-level=2]' + --test'[Build a test harness]' + --verbose'[Use verbose output]' {-h,--help}'[Display this message]' --no-analysis'[Parse and expand the output, but run no analysis or produce output]' --no-trans'[Run all passes except translation; no output]' - -O'[Equivalent to --opt-level=2]' --parse-only'[Parse only; do not compile, assemble, or link]' --print-crate-name'[Output the crate name and exit]' --print-file-name'[Output the file(s) that would be written if compilation continued and exit]' - --test'[Build a test harness]' ) _rustc_opts_codegen=( 'ar=[Path to the archive utility to use when assembling archives.]:BIN:_path_files' @@ -139,6 +173,9 @@ _rustc_opts_lint=( _rustc_opts_debug=( 'verbose[in general, enable more debug printouts]' + 'span-free-formats[when debug-printing compiler state, do not include spans]' + "identify-regions[make unnamed regions display as '# (where # is some non-ident unique id)]" + 'emit-end-regions[emit EndRegion as part of MIR; enable transforms that solely process EndRegion]' 'time-passes[measure time of each rustc pass]' 'count-llvm-insns[count where LLVM instrs originate]' 'time-llvm-passes[measure time of each LLVM pass]' From 529a12fac857efbfa749998ed872d668ff51d15d Mon Sep 17 00:00:00 2001 From: Jarryd Tilbrook Date: Wed, 1 Nov 2017 21:04:41 +0800 Subject: [PATCH 0196/1083] Add shortcut for opening current branch in Jira (#6366) --- plugins/jira/_jira | 1 + plugins/jira/jira.plugin.zsh | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/plugins/jira/_jira b/plugins/jira/_jira index 03fe6a499..890f97f4c 100644 --- a/plugins/jira/_jira +++ b/plugins/jira/_jira @@ -7,6 +7,7 @@ _1st_arguments=( 'dashboard:open the dashboard' 'reported:search for issues reported by a user' 'assigned:search for issues assigned to a user' + 'br:open the issue named after the git branch of the current directory' 'dumpconfig:display effective jira configuration' ) diff --git a/plugins/jira/jira.plugin.zsh b/plugins/jira/jira.plugin.zsh index 67c989457..fe1772cd8 100644 --- a/plugins/jira/jira.plugin.zsh +++ b/plugins/jira/jira.plugin.zsh @@ -51,8 +51,14 @@ function jira() { echo "JIRA_DEFAULT_ACTION=$JIRA_DEFAULT_ACTION" else # Anything that doesn't match a special action is considered an issue name - local issue_arg=$action - local issue="${jira_prefix}${issue_arg}" + # but `branch` is a special case that will parse the current git branch + if [[ "$action" == "br" ]]; then + local issue_arg=$(git rev-parse --abbrev-ref HEAD) + local issue="${jira_prefix}${issue_arg}" + else + local issue_arg=$action + local issue="${jira_prefix}${issue_arg}" + fi local url_fragment='' if [[ "$2" == "m" ]]; then url_fragment="#add-comment" From 1e027509d840d0d2a2fee1001543a5f2f34b3c28 Mon Sep 17 00:00:00 2001 From: Wenzheng Jiang Date: Thu, 2 Nov 2017 00:05:35 +1100 Subject: [PATCH 0197/1083] Add nixos support for autojump plugin (#6365) --- plugins/autojump/autojump.plugin.zsh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/autojump/autojump.plugin.zsh b/plugins/autojump/autojump.plugin.zsh index c05c699e1..7339fad9e 100644 --- a/plugins/autojump/autojump.plugin.zsh +++ b/plugins/autojump/autojump.plugin.zsh @@ -5,6 +5,8 @@ if [ $commands[autojump] ]; then # check if autojump is installed . $HOME/.autojump/share/autojump/autojump.zsh elif [ -f $HOME/.nix-profile/etc/profile.d/autojump.zsh ]; then # nix installation . $HOME/.nix-profile/etc/profile.d/autojump.zsh + elif [ -f /run/current-system/sw/share/autojump/autojump.zsh ]; then # nixos installation + . /run/current-system/sw/share/autojump/autojump.zsh elif [ -f /usr/share/autojump/autojump.zsh ]; then # debian and ubuntu package . /usr/share/autojump/autojump.zsh elif [ -f /etc/profile.d/autojump.zsh ]; then # manual installation From 6d5b1f1e3be483bb09315d22a2175d1c97998167 Mon Sep 17 00:00:00 2001 From: Jarryd Tilbrook Date: Wed, 1 Nov 2017 21:09:10 +0800 Subject: [PATCH 0198/1083] Allow jira default action file based setting (#6367) --- plugins/jira/jira.plugin.zsh | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/plugins/jira/jira.plugin.zsh b/plugins/jira/jira.plugin.zsh index fe1772cd8..7d4e5b921 100644 --- a/plugins/jira/jira.plugin.zsh +++ b/plugins/jira/jira.plugin.zsh @@ -2,13 +2,19 @@ # # See README.md for details -: ${JIRA_DEFAULT_ACTION:=new} - function jira() { emulate -L zsh - local action=${1:=$JIRA_DEFAULT_ACTION} + local action jira_url jira_prefix + if [[ -f .jira-default-action ]]; then + action=$(cat .jira-default-action) + elif [[ -f ~/.jira-default-action ]]; then + action=$(cat ~/.jira-default-action) + elif [[ -n "${JIRA_DEFAULT_ACTION}" ]]; then + action=${JIRA_DEFAULT_ACTION} + else + action="new" + fi - local jira_url jira_prefix if [[ -f .jira-url ]]; then jira_url=$(cat .jira-url) elif [[ -f ~/.jira-url ]]; then From 0fc24140951e9015569080b1596a0d7536f93a0d Mon Sep 17 00:00:00 2001 From: Arthur Schneider Date: Wed, 1 Nov 2017 14:09:31 +0100 Subject: [PATCH 0199/1083] Update git-flow aliases (#6335) It is possible to pull and push branches to/from origin --- plugins/git-flow/git-flow.plugin.zsh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plugins/git-flow/git-flow.plugin.zsh b/plugins/git-flow/git-flow.plugin.zsh index bda050725..5f5e4aa73 100644 --- a/plugins/git-flow/git-flow.plugin.zsh +++ b/plugins/git-flow/git-flow.plugin.zsh @@ -35,6 +35,10 @@ alias gflrs='git flow release start' alias gflff='git flow feature finish' alias gflhf='git flow hotfix finish' alias gflrf='git flow release finish' +alias gflfp='git flow feature publish' +alias gflhp='git flow hotfix publish' +alias gflrp='git flow release publish' +alias gflfpll='git flow feature pull' _git-flow () { From f812cfa16ab605a88793dce5b169886ae2802031 Mon Sep 17 00:00:00 2001 From: Eli Boyarski Date: Wed, 1 Nov 2017 15:10:02 +0200 Subject: [PATCH 0200/1083] README.md: shit load -> shit-load (#6344) * README.md: shit load -> shit-load * README.md: shit-load -> shitload --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 558d24120..4531f7b7b 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/to ### Plugins -Oh My Zsh comes with a shit load of plugins to take advantage of. You can take a look in the [plugins](https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins) directory and/or the [wiki](https://github.com/robbyrussell/oh-my-zsh/wiki/Plugins) to see what's currently available. +Oh My Zsh comes with a shitload of plugins to take advantage of. You can take a look in the [plugins](https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins) directory and/or the [wiki](https://github.com/robbyrussell/oh-my-zsh/wiki/Plugins) to see what's currently available. #### Enabling Plugins From 2526d71c56efe821caec6e2f03f0e5d695db3ecb Mon Sep 17 00:00:00 2001 From: Doug Yun Date: Wed, 1 Nov 2017 06:21:07 -0700 Subject: [PATCH 0201/1083] Use HTTPS for Planet Argon links (#6326) --- README.md | 4 ++-- tools/install.sh | 2 +- tools/upgrade.sh | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 4531f7b7b..0771a0361 100644 --- a/README.md +++ b/README.md @@ -226,7 +226,7 @@ We're on the social media. ## Merchandise -We have [stickers](http://shop.planetargon.com/products/ohmyzsh-stickers-set-of-3-stickers) and [shirts](http://shop.planetargon.com/products/ohmyzsh-t-shirts) for you to show off your love of Oh My Zsh. Again, this will help you become the talk of the town! +We have [stickers](https://shop.planetargon.com/products/ohmyzsh-stickers-set-of-3-stickers) and [shirts](http://shop.planetargon.com/products/ohmyzsh-t-shirts) for you to show off your love of Oh My Zsh. Again, this will help you become the talk of the town! ## License @@ -234,6 +234,6 @@ Oh My Zsh is released under the [MIT license](LICENSE.txt). ## About Planet Argon -![Planet Argon](http://pa-github-assets.s3.amazonaws.com/PARGON_logo_digital_COL-small.jpg) +![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). diff --git a/tools/install.sh b/tools/install.sh index 3f4de8681..187c828f5 100755 --- a/tools/install.sh +++ b/tools/install.sh @@ -107,7 +107,7 @@ main() { echo '' echo 'p.s. Follow us at https://twitter.com/ohmyzsh.' echo '' - echo 'p.p.s. Get stickers and t-shirts at http://shop.planetargon.com.' + echo 'p.p.s. Get stickers and t-shirts at https://shop.planetargon.com.' echo '' printf "${NORMAL}" env zsh diff --git a/tools/upgrade.sh b/tools/upgrade.sh index d5e7e8ba8..25b2de27a 100644 --- a/tools/upgrade.sh +++ b/tools/upgrade.sh @@ -33,7 +33,7 @@ then printf '%s\n' ' /____/ ' printf "${BLUE}%s\n" "Hooray! Oh My Zsh has been updated and/or is at the current version." printf "${BLUE}${BOLD}%s${NORMAL}\n" "To keep up on the latest news and updates, follow us on twitter: https://twitter.com/ohmyzsh" - printf "${BLUE}${BOLD}%s${NORMAL}\n" "Get your Oh My Zsh swag at: http://shop.planetargon.com/" + printf "${BLUE}${BOLD}%s${NORMAL}\n" "Get your Oh My Zsh swag at: https://shop.planetargon.com/" else printf "${RED}%s${NORMAL}\n" 'There was an error updating. Try again later?' fi From 4cb730773b52a47f2e9ab159a6b1c5185a3a37fb Mon Sep 17 00:00:00 2001 From: Mike Reardon Date: Wed, 1 Nov 2017 06:21:49 -0700 Subject: [PATCH 0202/1083] Added 'clean verify' to the mvn plugin targets (#6339) --- plugins/mvn/README.md | 1 + plugins/mvn/mvn.plugin.zsh | 1 + 2 files changed, 2 insertions(+) diff --git a/plugins/mvn/README.md b/plugins/mvn/README.md index ffc5f6832..986ac84a4 100644 --- a/plugins/mvn/README.md +++ b/plugins/mvn/README.md @@ -17,6 +17,7 @@ plugins=(... mvn) | `mvncist` | `mvn clean install -DskipTests` | | `mvncisto` | `mvn clean install -DskipTests --offline` | | `mvne` | `mvn eclipse:eclipse` | +| `mvncv` | `mvn clean verify` | | `mvnd` | `mvn deploy` | | `mvnp` | `mvn package` | | `mvnc` | `mvn clean` | diff --git a/plugins/mvn/mvn.plugin.zsh b/plugins/mvn/mvn.plugin.zsh index f1e4d3ee0..ee6fe2770 100644 --- a/plugins/mvn/mvn.plugin.zsh +++ b/plugins/mvn/mvn.plugin.zsh @@ -47,6 +47,7 @@ alias mvncist='mvn clean install -DskipTests' alias mvncisto='mvn clean install -DskipTests --offline' alias mvne='mvn eclipse:eclipse' alias mvnce='mvn clean eclipse:clean eclipse:eclipse' +alias mvncv='mvn clean verify' alias mvnd='mvn deploy' alias mvnp='mvn package' alias mvnc='mvn clean' From 93120c4151b0bbc831ce29f5386f8d9dcf313573 Mon Sep 17 00:00:00 2001 From: ramanduh Date: Sat, 4 Nov 2017 18:31:42 +0100 Subject: [PATCH 0203/1083] jira plugin: take into account action argument (fix #6388) (#6393) --- plugins/jira/jira.plugin.zsh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/jira/jira.plugin.zsh b/plugins/jira/jira.plugin.zsh index 7d4e5b921..0340dd7f4 100644 --- a/plugins/jira/jira.plugin.zsh +++ b/plugins/jira/jira.plugin.zsh @@ -5,7 +5,9 @@ function jira() { emulate -L zsh local action jira_url jira_prefix - if [[ -f .jira-default-action ]]; then + if [[ -n "$1" ]]; then + action=$1 + elif [[ -f .jira-default-action ]]; then action=$(cat .jira-default-action) elif [[ -f ~/.jira-default-action ]]; then action=$(cat ~/.jira-default-action) From 970fcec40e7f4b4fb1b3789d67a396d16226056d Mon Sep 17 00:00:00 2001 From: Muhammad Surga Savero Date: Sat, 4 Nov 2017 17:32:14 +0000 Subject: [PATCH 0204/1083] README.md: ZSH_THEM_RANDOM.. > ZSH_THEME_RANDOM.. (#6390) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0771a0361..df5ef48be 100644 --- a/README.md +++ b/README.md @@ -100,7 +100,7 @@ ZSH_THEME="random" # (...please let it be pie... please be some pie..) And if you want to pick random theme from a list of your favorite themes: ```shell -ZSH_THEM_RANDOM_CANDIDATES=( +ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" ) From 905eb815fa380d561d23af33bbbda6175025c343 Mon Sep 17 00:00:00 2001 From: David Librera Date: Sat, 4 Nov 2017 18:33:57 +0100 Subject: [PATCH 0205/1083] Check first for bin/stubs directory in _rails_command and _rake_command (#6372) --- plugins/rails/rails.plugin.zsh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/plugins/rails/rails.plugin.zsh b/plugins/rails/rails.plugin.zsh index c8974b5f4..eb3f30360 100644 --- a/plugins/rails/rails.plugin.zsh +++ b/plugins/rails/rails.plugin.zsh @@ -1,5 +1,7 @@ function _rails_command () { - if [ -e "bin/rails" ]; then + if [ -e "bin/stubs/rails" ]; then + bin/stubs/rails $@ + elif [ -e "bin/rails" ]; then bin/rails $@ elif [ -e "script/rails" ]; then ruby script/rails $@ @@ -11,7 +13,9 @@ function _rails_command () { } function _rake_command () { - if [ -e "bin/rake" ]; then + if [ -e "bin/stubs/rake" ]; then + bin/stubs/rake $@ + elif [ -e "bin/rake" ]; then bin/rake $@ elif type bundle &> /dev/null && [ -e "Gemfile" ]; then bundle exec rake $@ From fb1227088d2448d9de8385c466d8c2c1b92a1042 Mon Sep 17 00:00:00 2001 From: Sebastian Schlein Date: Sat, 4 Nov 2017 18:34:31 +0100 Subject: [PATCH 0206/1083] Enhanced Laravel 5 Plugin (#6376) --- plugins/laravel5/laravel5.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/laravel5/laravel5.plugin.zsh b/plugins/laravel5/laravel5.plugin.zsh index 38454f40d..487a0742b 100644 --- a/plugins/laravel5/laravel5.plugin.zsh +++ b/plugins/laravel5/laravel5.plugin.zsh @@ -1,6 +1,6 @@ # Laravel5 basic command completion _laravel5_get_command_list () { - php artisan --no-ansi | sed "1,/Available commands/d" | awk '/^ +[a-z]+/ { print $1 }' + php artisan --raw --no-ansi list | sed "s/[[:space:]].*//g" } _laravel5 () { From d29784e1aebab5e02db918b1ffbfa4d2d308799a Mon Sep 17 00:00:00 2001 From: Athaher Sirnaik Date: Sat, 4 Nov 2017 23:05:44 +0530 Subject: [PATCH 0207/1083] Improved npm aliases: run, publish (#6354) --- plugins/npm/npm.plugin.zsh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/plugins/npm/npm.plugin.zsh b/plugins/npm/npm.plugin.zsh index 43aedc36d..014fb55f8 100644 --- a/plugins/npm/npm.plugin.zsh +++ b/plugins/npm/npm.plugin.zsh @@ -38,9 +38,17 @@ alias npmV="npm -v" # List packages alias npmL="npm list" +# List top-level installed packages +alias npmL0="npm ls --depth=0" + # Run npm start alias npmst="npm start" # Run npm test alias npmt="npm test" +# Run npm scripts +alias npmR="npm run" + +# Run npm publish +alias npmP="npm publish" \ No newline at end of file From d6ccb41d0baa65a8b9496cbebdbf2589ffb5c85f Mon Sep 17 00:00:00 2001 From: William Bautista Date: Sat, 4 Nov 2017 17:41:14 +0000 Subject: [PATCH 0208/1083] Update Yarn plugin alias (#6246) --- plugins/yarn/yarn.plugin.zsh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/plugins/yarn/yarn.plugin.zsh b/plugins/yarn/yarn.plugin.zsh index 47c503acb..5fa512377 100644 --- a/plugins/yarn/yarn.plugin.zsh +++ b/plugins/yarn/yarn.plugin.zsh @@ -1,4 +1,11 @@ -alias yi="yarn install" +# Alias sorted alphabetically + +alias y="yarn " +alias ya="yarn add" +alias ycc="yarn cache clean" +alias yh="yarn help" +alias yo="yarn outdated" +alias yui="yarn upgrade-interactive" _yarn () { From 1ec5bab7d82bfc82ee4e9f37cc67b6476a060008 Mon Sep 17 00:00:00 2001 From: Canux Date: Mon, 6 Nov 2017 22:41:13 +0800 Subject: [PATCH 0209/1083] fix conflict with command ag (#6395) ag is a famous command just like grep. --- plugins/debian/debian.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/debian/debian.plugin.zsh b/plugins/debian/debian.plugin.zsh index 28131ff80..19966b6ac 100644 --- a/plugins/debian/debian.plugin.zsh +++ b/plugins/debian/debian.plugin.zsh @@ -50,7 +50,7 @@ if [[ $use_sudo -eq 1 ]]; then alias adg='sudo $apt_pref update && sudo $apt_pref $apt_upgr' alias adu='sudo $apt_pref update && sudo $apt_pref dist-upgrade' alias afu='sudo apt-file update' - alias ag='sudo $apt_pref $apt_upgr' + alias au='sudo $apt_pref $apt_upgr' alias ai='sudo $apt_pref install' # Install all packages given on the command line while using only the first word of each line: # acs ... | ail From d072c0fbec58439ede849facf89fa11225dd85d9 Mon Sep 17 00:00:00 2001 From: Tiago Rinaldi Date: Mon, 6 Nov 2017 12:41:33 -0200 Subject: [PATCH 0210/1083] Change `agud` alias from `dist-upgrade` to `full-upgrade` (#6384) --- plugins/ubuntu/readme.md | 2 +- plugins/ubuntu/ubuntu.plugin.zsh | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/plugins/ubuntu/readme.md b/plugins/ubuntu/readme.md index 5ad4bbcd2..99d62a6f7 100644 --- a/plugins/ubuntu/readme.md +++ b/plugins/ubuntu/readme.md @@ -16,6 +16,6 @@ afs = Apt-File Search --regexp - this has the regexp switch on without being rep Then there are the 2 other 4 letter aliases for combined commands, that are straight forward and easy to remember. aguu = sudo Apt-Get Update && sudo apt-get Upgrade - better then adg or not? -agud = sudo Apt-Get Update && sudo apt-get Dist-upgrade +agud = sudo Apt-Get Update && sudo apt-get full-upgrade For a full list aliases and the functions just watch the plugins code https://github.com/robbyrussell/oh-my-zsh/blob/master/plugins/ubuntu/ubuntu.plugin.zsh, look at the comments if you want to switch from the debian plugin. Ubuntu, Mint and & co users will like the new aar function to install packages from ppas with a single command. diff --git a/plugins/ubuntu/ubuntu.plugin.zsh b/plugins/ubuntu/ubuntu.plugin.zsh index 60ff0457f..eab2da409 100644 --- a/plugins/ubuntu/ubuntu.plugin.zsh +++ b/plugins/ubuntu/ubuntu.plugin.zsh @@ -2,6 +2,7 @@ # https://github.com/AlexBio # https://github.com/dbb # https://github.com/Mappleconfusers +# https://github.com/trinaldi # Nicolas Jonas nextgenthemes.com # https://github.com/loctauxphilippe # @@ -36,7 +37,7 @@ alias agi='sudo apt-get install' # ai alias agp='sudo apt-get purge' # ap alias agr='sudo apt-get remove' # ar alias agu='sudo apt-get update' # ad -alias agud='sudo apt-get update && sudo apt-get dist-upgrade' #adu +alias agud='sudo apt-get update && sudo apt-get full-upgrade' #adu alias agug='sudo apt-get upgrade' # ag alias aguu='sudo apt-get update && sudo apt-get upgrade' #adg alias agar='sudo apt-get autoremove' @@ -50,7 +51,7 @@ compdef _agi agi='sudo apt-get install' compdef _agp agp='sudo apt-get purge' compdef _agr agr='sudo apt-get remove' compdef _agu agu='sudo apt-get update' -compdef _agud agud='sudo apt-get update && sudo apt-get dist-upgrade' +compdef _agud agud='sudo apt-get update && sudo apt-get full-upgrade' compdef _agug agug='sudo apt-get upgrade' compdef _aguu aguu='sudo apt-get update && sudo apt-get upgrade' compdef _agar agar='sudo apt-get autoremove' From 9dab0af11f22f91c98a77892a14b16ca7fa7fbb4 Mon Sep 17 00:00:00 2001 From: Nicolas Cavigneaux Date: Mon, 6 Nov 2017 15:43:03 +0100 Subject: [PATCH 0211/1083] Set RBENV_ROOT to "$HOME/.rbenv" if not already set (#6324) This is the default behavior of rbenv and what users are expecting most of the time. It allows users to have their own set of rubies and gems. It also prevents losing all rubies when rbenv is updated using Homebrew which is not true when RBENV_ROOT is set to /usr/local/opt/rbenv. --- plugins/rbenv/rbenv.plugin.zsh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/rbenv/rbenv.plugin.zsh b/plugins/rbenv/rbenv.plugin.zsh index ef5106f2d..7430e9625 100644 --- a/plugins/rbenv/rbenv.plugin.zsh +++ b/plugins/rbenv/rbenv.plugin.zsh @@ -7,6 +7,9 @@ rbenvdirs=("$HOME/.rbenv" "/usr/local/rbenv" "/opt/rbenv" "/usr/local/opt/rbenv" if _homebrew-installed && rbenv_homebrew_path=$(brew --prefix rbenv 2>/dev/null); then rbenvdirs=($rbenv_homebrew_path "${rbenvdirs[@]}") unset rbenv_homebrew_path + if [[ $RBENV_ROOT = '' ]]; then + RBENV_ROOT="$HOME/.rbenv" + fi fi for rbenvdir in "${rbenvdirs[@]}" ; do From b53fbc36c15d5d2f65ec1779cec9e05b533337b6 Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Mon, 6 Nov 2017 18:18:56 +0330 Subject: [PATCH 0212/1083] plugin: npx (#6152) --- plugins/npx/README.md | 17 +++++++++++++++++ plugins/npx/npx.plugin.zsh | 7 +++++++ 2 files changed, 24 insertions(+) create mode 100644 plugins/npx/README.md create mode 100644 plugins/npx/npx.plugin.zsh diff --git a/plugins/npx/README.md b/plugins/npx/README.md new file mode 100644 index 000000000..2c94e4515 --- /dev/null +++ b/plugins/npx/README.md @@ -0,0 +1,17 @@ +# NPX Plugin +> npx(1) -- execute npm package binaries. ([more info](https://github.com/zkat/npx)) + +This plugin automatically registers npx command-not-found handler if `npx` exists in your `$PATH`. + +## Setup + +- Add plugin to `~/.zshrc` + +```bash +plugins=(.... npx) +``` + +- Globally install npx binary (you need node.js installed too!) +```bash +sudo npm install -g npx +``` \ No newline at end of file diff --git a/plugins/npx/npx.plugin.zsh b/plugins/npx/npx.plugin.zsh new file mode 100644 index 000000000..32bb67377 --- /dev/null +++ b/plugins/npx/npx.plugin.zsh @@ -0,0 +1,7 @@ +# NPX Plugin +# https://www.npmjs.com/package/npx +# Maintainer: Pooya Parsa + +(( $+commands[npx] )) && { + source <(npx --shell-auto-fallback zsh) +} From 9edb3fcebac250e12850530222a10a13d513f03f Mon Sep 17 00:00:00 2001 From: Vincent Date: Mon, 6 Nov 2017 22:49:27 +0800 Subject: [PATCH 0213/1083] Added: Helm plugins (#6265) --- plugins/helm/helm.plugin.zsh | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 plugins/helm/helm.plugin.zsh diff --git a/plugins/helm/helm.plugin.zsh b/plugins/helm/helm.plugin.zsh new file mode 100644 index 000000000..78499c15d --- /dev/null +++ b/plugins/helm/helm.plugin.zsh @@ -0,0 +1,7 @@ +# Autocompletion for helm. +# +# Copy from kubectl : https://github.com/pstadler + +if [ $commands[helm] ]; then + source <(helm completion zsh) +fi From 46062e25cc4ebae21465cac4680ce284dcf475a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20F=C3=A6revaag?= Date: Wed, 8 Nov 2017 00:40:24 +0900 Subject: [PATCH 0214/1083] [wd] Update wd plugin to latest (#6383) * Update wd plugin to v0.4.5 * [wd] Update wd plugin to v0.4.6 --- plugins/wd/_wd.sh | 6 +++--- plugins/wd/wd.sh | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/wd/_wd.sh b/plugins/wd/_wd.sh index 65fa1ddde..d5419d629 100644 --- a/plugins/wd/_wd.sh +++ b/plugins/wd/_wd.sh @@ -21,12 +21,12 @@ function _wd() { do arr=(${(s,:,)line}) name=${arr[1]} - path=${arr[2]} + target_path=${arr[2]} # replace ~ from path to fix completion (#17) - path=${path/#\~/$HOME} + target_path=${path/#\~/$HOME} - points[$name]=$path + points[$name]=$target_path done < $CONFIG commands=( diff --git a/plugins/wd/wd.sh b/plugins/wd/wd.sh index c330dd358..3d68583f1 100755 --- a/plugins/wd/wd.sh +++ b/plugins/wd/wd.sh @@ -8,7 +8,7 @@ # @github.com/mfaerevaag/wd # version -readonly WD_VERSION=0.4.4 +readonly WD_VERSION=0.4.6 # colors readonly WD_BLUE="\033[96m" From d12c2ea4e83779250fda8096571682d9d340ee09 Mon Sep 17 00:00:00 2001 From: Maciej Lasyk Date: Tue, 7 Nov 2017 16:45:25 +0100 Subject: [PATCH 0215/1083] Plugins: Terraform (#6373) Expanded Terraform plugin with function that can be used to show workspace name in the zsh prompt --- plugins/terraform/README.md | 10 ++++++++++ plugins/terraform/terraform.plugin.zsh | 7 +++++++ 2 files changed, 17 insertions(+) create mode 100644 plugins/terraform/terraform.plugin.zsh diff --git a/plugins/terraform/README.md b/plugins/terraform/README.md index 44e38a1c0..b39f9916b 100644 --- a/plugins/terraform/README.md +++ b/plugins/terraform/README.md @@ -9,3 +9,13 @@ Plugin for Terraform, a tool from Hashicorp for managing infrastructure safely a ### Usage * Type `terraform` into your prompt and hit `TAB` to see available completion options + +### Expanding ZSH prompt with current Terraform workspace name + +If you want to get current Terraform workspace name in your ZSH prompt open +your .zsh-theme file and in a choosen place insert: + +``` +$FG[045]\ +$(terraform_prompt_info)\ +``` diff --git a/plugins/terraform/terraform.plugin.zsh b/plugins/terraform/terraform.plugin.zsh new file mode 100644 index 000000000..84eec5cc1 --- /dev/null +++ b/plugins/terraform/terraform.plugin.zsh @@ -0,0 +1,7 @@ +function terraform_prompt_info() { + # check if in terraform dir + if [ -d .terraform ]; then + workspace=$(terraform workspace show 2> /dev/null) || return + echo "[${workspace}]" + fi +} From 1fca822ab229ed2bd0dbc8c7b2ea9fbcd7e1d2fc Mon Sep 17 00:00:00 2001 From: jrisebor Date: Tue, 7 Nov 2017 10:50:08 -0500 Subject: [PATCH 0216/1083] Fix Standard Error Redirection for composer plugin (#5935) --- plugins/composer/composer.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/composer/composer.plugin.zsh b/plugins/composer/composer.plugin.zsh index 8cf50d502..d00813e39 100644 --- a/plugins/composer/composer.plugin.zsh +++ b/plugins/composer/composer.plugin.zsh @@ -52,4 +52,4 @@ alias cgrm='composer global remove' alias cget='curl -s https://getcomposer.org/installer | php' # Add Composer's global binaries to PATH -export PATH=$PATH:$(composer global config bin-dir --absolute) 2>/dev/null +export PATH=$PATH:$(composer global config bin-dir --absolute 2>/dev/null) From 63cfade9a4328b1b8d0be9036529fae76bf34325 Mon Sep 17 00:00:00 2001 From: Marcel Siegert Date: Tue, 7 Nov 2017 16:51:38 +0100 Subject: [PATCH 0217/1083] Prepend function keyword in colored-man-pages plugin (#6238) Resolves: #6237 --- plugins/colored-man-pages/colored-man-pages.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/colored-man-pages/colored-man-pages.plugin.zsh b/plugins/colored-man-pages/colored-man-pages.plugin.zsh index 54f0bdda9..1bea536e0 100644 --- a/plugins/colored-man-pages/colored-man-pages.plugin.zsh +++ b/plugins/colored-man-pages/colored-man-pages.plugin.zsh @@ -16,7 +16,7 @@ EOF fi fi -man() { +function man() { env \ LESS_TERMCAP_mb=$(printf "\e[1;31m") \ LESS_TERMCAP_md=$(printf "\e[1;31m") \ From 9edde0950ef783fc55e69ca1f9ec971819758cd4 Mon Sep 17 00:00:00 2001 From: Kevin Kirkup Date: Tue, 7 Nov 2017 10:55:24 -0500 Subject: [PATCH 0218/1083] Add OpenShift autocompletion (#6049) --- plugins/oc/oc.plugin.zsh | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 plugins/oc/oc.plugin.zsh diff --git a/plugins/oc/oc.plugin.zsh b/plugins/oc/oc.plugin.zsh new file mode 100644 index 000000000..b968c4bd4 --- /dev/null +++ b/plugins/oc/oc.plugin.zsh @@ -0,0 +1,7 @@ +# Autocompletion for oc, the command line interface for OpenShift +# +# Author: https://github.com/kevinkirkup + +if [ $commands[oc] ]; then + source <(oc completion zsh) +fi From dfc03c7bb664229e9b014728f8ee4bc2220ad9d2 Mon Sep 17 00:00:00 2001 From: Luke Lazurite Date: Tue, 7 Nov 2017 10:57:07 -0500 Subject: [PATCH 0219/1083] optimize load of pyenv with homebrew (#6142) --- plugins/pyenv/pyenv.plugin.zsh | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/plugins/pyenv/pyenv.plugin.zsh b/plugins/pyenv/pyenv.plugin.zsh index aa1f9488a..ec3ae9f5b 100644 --- a/plugins/pyenv/pyenv.plugin.zsh +++ b/plugins/pyenv/pyenv.plugin.zsh @@ -8,9 +8,6 @@ _pyenv-from-homebrew-installed() { FOUND_PYENV=0 pyenvdirs=("$HOME/.pyenv" "/usr/local/pyenv" "/opt/pyenv") -if _homebrew-installed && _pyenv-from-homebrew-installed ; then - pyenvdirs=($(brew --prefix pyenv) "${pyenvdirs[@]}") -fi for pyenvdir in "${pyenvdirs[@]}" ; do if [ -d $pyenvdir/bin -a $FOUND_PYENV -eq 0 ] ; then @@ -30,6 +27,24 @@ for pyenvdir in "${pyenvdirs[@]}" ; do done unset pyenvdir +if [ $FOUND_PYENV -eq 0 ] ; then + pyenvdir=$(brew --prefix pyenv 2> /dev/null) + if [ $? -eq 0 -a -d $pyenvdir/bin ] ; then + FOUND_PYENV=1 + export PYENV_ROOT=$pyenvdir + export PATH=${pyenvdir}/bin:$PATH + eval "$(pyenv init - zsh)" + + if pyenv commands | command grep -q virtualenv-init; then + eval "$(pyenv virtualenv-init - zsh)" + fi + + function pyenv_prompt_info() { + echo "$(pyenv version-name)" + } + fi +fi + if [ $FOUND_PYENV -eq 0 ] ; then function pyenv_prompt_info() { echo "system: $(python -V 2>&1 | cut -f 2 -d ' ')" } fi From 790712f6f2cae48e8e57239b9ca9e7ab01254253 Mon Sep 17 00:00:00 2001 From: Michael Favia Date: Tue, 7 Nov 2017 08:00:14 -0800 Subject: [PATCH 0220/1083] Add aliases for kubectl to speed up repetitive commands. (#5856) --- plugins/kubectl/kubectl.plugin.zsh | 43 ++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/plugins/kubectl/kubectl.plugin.zsh b/plugins/kubectl/kubectl.plugin.zsh index 51ae142a2..88177b5a0 100644 --- a/plugins/kubectl/kubectl.plugin.zsh +++ b/plugins/kubectl/kubectl.plugin.zsh @@ -5,3 +5,46 @@ if [ $commands[kubectl] ]; then source <(kubectl completion zsh) fi + +# This command is used ALOT both below and in daily life +alias k=kubectl + +# Drop into an interactive terminal on a container +alias keti='k exec -ti' + +# Manage configuration quickly to switch contexts between local, dev ad staging. +alias kcuc='k config use-context' +alias kcsc='k config set-context' +alias kcdc='k config delete-context' +alias kccc='k config current-context' + +# Pod management. +alias kgp='k get pods' +alias klp='k logs pods' +alias kep='k edit pods' +alias kdp='k describe pods' +alias kdelp='k delete pods' + +# Service management. +alias kgs='k get svc' +alias kes='k edit svc' +alias kds='k describe svc' +alias kdels='k delete svc' + +# Secret management +alias kgsec='k get secret' +alias kdsec='k describe secret' +alias kdelsec='k delete secret' + +# Deployment management. +alias kgd='k get deployment' +alias ked='k edit deployment' +alias kdd='k describe deployment' +alias kdeld='k delete deployment' +alias ksd='k scale deployment' +alias krsd='k rollout status deployment' + +# Rollout management. +alias kgrs='k get rs' +alias krh='k rollout history' +alias kru='k rollout undo' From 47039f645ffa5e59d1d32aeee8e2cb432035f78a Mon Sep 17 00:00:00 2001 From: Nur Rony Date: Tue, 7 Nov 2017 22:03:14 +0600 Subject: [PATCH 0221/1083] feature(plugins): adds kops (kubernetes operations) plugin (#6107) --- plugins/kops/kops.plugin.zsh | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 plugins/kops/kops.plugin.zsh diff --git a/plugins/kops/kops.plugin.zsh b/plugins/kops/kops.plugin.zsh new file mode 100644 index 000000000..f707f3aff --- /dev/null +++ b/plugins/kops/kops.plugin.zsh @@ -0,0 +1,9 @@ +# Autocompletion for kops (Kubernetes Operations), +# the command line interface to get a production grade +# Kubernetes cluster up and running + +# Author: https://github.com/nmrony + +if [ $commands[kops] ]; then + source <(kops completion zsh) +fi From 9d6b6c5ce161280e52df3a33d584318d6dbc0bd9 Mon Sep 17 00:00:00 2001 From: T0mK0 Date: Tue, 7 Nov 2017 11:03:54 -0500 Subject: [PATCH 0222/1083] speed up chruby plugin by eliminating(as much as possible) calls to brew (#6080) * speed up chruby plugin by eliminating(as much as possible) calls to brew * speed up aws plugin by eliminating(as much as possible) calls to brew --- plugins/aws/aws.plugin.zsh | 19 +++++++++++++++++-- plugins/chruby/chruby.plugin.zsh | 22 +++++++++++++++++++--- 2 files changed, 36 insertions(+), 5 deletions(-) diff --git a/plugins/aws/aws.plugin.zsh b/plugins/aws/aws.plugin.zsh index d31052f83..6a0e04add 100644 --- a/plugins/aws/aws.plugin.zsh +++ b/plugins/aws/aws.plugin.zsh @@ -1,9 +1,24 @@ _homebrew-installed() { type brew &> /dev/null + _xit=$? + if [ $_xit -eq 0 ];then + # ok , we have brew installed + # speculatively we check default brew prefix + if [ -h /usr/local/opt/awscli ];then + _brew_prefix="/usr/local/opt/awscli" + else + # ok , it is not default prefix + # this call to brew is expensive ( about 400 ms ), so at least let's make it only once + _brew_prefix=$(brew --prefix awscli) + fi + return 0 + else + return $_xit + fi } _awscli-homebrew-installed() { - brew list awscli &> /dev/null + [ -r $_brew_prefix/libexec/bin/aws_zsh_completer.sh ] &> /dev/null } export AWS_HOME=~/.aws @@ -28,7 +43,7 @@ function aws_profiles { compctl -K aws_profiles asp if _homebrew-installed && _awscli-homebrew-installed ; then - _aws_zsh_completer_path=$(brew --prefix awscli)/libexec/bin/aws_zsh_completer.sh + _aws_zsh_completer_path=$_brew_prefix/libexec/bin/aws_zsh_completer.sh else _aws_zsh_completer_path=$(which aws_zsh_completer.sh) fi diff --git a/plugins/chruby/chruby.plugin.zsh b/plugins/chruby/chruby.plugin.zsh index 758b4a56c..998d92098 100644 --- a/plugins/chruby/chruby.plugin.zsh +++ b/plugins/chruby/chruby.plugin.zsh @@ -16,12 +16,28 @@ # rvm and rbenv plugins also provide this alias alias rubies='chruby' + _homebrew-installed() { whence brew &> /dev/null + _xit=$? + if [ $_xit -eq 0 ];then + # ok , we have brew installed + # speculatively we check default brew prefix + if [ -h /usr/local/opt/chruby ];then + _brew_prefix="/usr/local/opt/chruby" + else + # ok , it is not default prefix + # this call to brew is expensive ( about 400 ms ), so at least let's make it only once + _brew_prefix=$(brew --prefix chruby) + fi + return 0 + else + return $_xit + fi } _chruby-from-homebrew-installed() { - [ -r $(brew --prefix chruby) ] &> /dev/null + [ -r _brew_prefix ] &> /dev/null } _ruby-build_installed() { @@ -64,8 +80,8 @@ _chruby_dirs() { } if _homebrew-installed && _chruby-from-homebrew-installed ; then - source $(brew --prefix chruby)/share/chruby/chruby.sh - source $(brew --prefix chruby)/share/chruby/auto.sh + source $_brew_prefix/share/chruby/chruby.sh + source $_brew_prefix/share/chruby/auto.sh _chruby_dirs elif [[ -r "/usr/local/share/chruby/chruby.sh" ]] ; then source /usr/local/share/chruby/chruby.sh From c2fb24a7922077a364c853df923403c372ef5916 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Czocha=C5=84ski?= Date: Tue, 7 Nov 2017 17:04:38 +0100 Subject: [PATCH 0223/1083] Fixed the gpg-agent plugin for new gpg versions (#6140) The gpg-agent plugin did not work for gpg versions above or equal to 2.1 because of the `--write-env-file` option deprecation. This new version works fine and also enables the ssh-agent support only if it is enabled in the gpg-agent config file. --- plugins/gpg-agent/gpg-agent.plugin.zsh | 51 ++++++-------------------- 1 file changed, 12 insertions(+), 39 deletions(-) diff --git a/plugins/gpg-agent/gpg-agent.plugin.zsh b/plugins/gpg-agent/gpg-agent.plugin.zsh index 3e6a34f42..0bf65d58f 100644 --- a/plugins/gpg-agent/gpg-agent.plugin.zsh +++ b/plugins/gpg-agent/gpg-agent.plugin.zsh @@ -1,41 +1,14 @@ -local GPG_ENV=$HOME/.gnupg/gpg-agent.env - -function start_agent_nossh { - eval $(/usr/bin/env gpg-agent --quiet --daemon --write-env-file ${GPG_ENV} 2> /dev/null) - chmod 600 ${GPG_ENV} - export GPG_AGENT_INFO -} - -function start_agent_withssh { - eval $(/usr/bin/env gpg-agent --quiet --daemon --enable-ssh-support --write-env-file ${GPG_ENV} 2> /dev/null) - chmod 600 ${GPG_ENV} - export GPG_AGENT_INFO - export SSH_AUTH_SOCK - export SSH_AGENT_PID -} - -# check if another agent is running -if ! gpg-connect-agent --quiet /bye > /dev/null 2> /dev/null; then - # source settings of old agent, if applicable - if [ -f "${GPG_ENV}" ]; then - . ${GPG_ENV} > /dev/null - export GPG_AGENT_INFO - export SSH_AUTH_SOCK - export SSH_AGENT_PID - fi - - # check again if another agent is running using the newly sourced settings - if ! gpg-connect-agent --quiet /bye > /dev/null 2> /dev/null; then - # check for existing ssh-agent - if ssh-add -l > /dev/null 2> /dev/null; then - # ssh-agent running, start gpg-agent without ssh support - start_agent_nossh; - else - # otherwise start gpg-agent with ssh support - start_agent_withssh; - fi - fi +# Enable gpg-agent if it is not running +GPG_AGENT_SOCKET="${XDG_RUNTIME_DIR}/gnupg/S.gpg-agent.ssh" +if [ ! -S $GPG_AGENT_SOCKET ]; then + gpg-agent --daemon >/dev/null 2>&1 + export GPG_TTY=$(tty) +fi + +# Set SSH to use gpg-agent if it is configured to do so +GNUPGCONFIG=${GNUPGHOME:-"$HOME/.gnupg/gpg-agent.conf"} +if [ -r "$GNUPGCONFIG" ] && grep -q enable-ssh-support "$GNUPGCONFIG"; then + unset SSH_AGENT_PID + export SSH_AUTH_SOCK=$GPG_AGENT_SOCKET fi -GPG_TTY=$(tty) -export GPG_TTY From 766b47d8b85dea53ae6afb64031f6ed9dc271663 Mon Sep 17 00:00:00 2001 From: Jakub Sacha Date: Tue, 7 Nov 2017 17:05:19 +0100 Subject: [PATCH 0224/1083] Add docker-machine plugin (#4782) --- plugins/docker-machine/README.md | 19 +++++++++++ .../docker-machine/docker-machine.plugin.zsh | 33 +++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 plugins/docker-machine/README.md create mode 100644 plugins/docker-machine/docker-machine.plugin.zsh diff --git a/plugins/docker-machine/README.md b/plugins/docker-machine/README.md new file mode 100644 index 000000000..308a6cfdb --- /dev/null +++ b/plugins/docker-machine/README.md @@ -0,0 +1,19 @@ +# docker-machine plugin for oh my zsh + +### Usage + +#### docker-vm +Will create a docker-machine with the name "dev" (required only once) +To create a second machine call "docker-vm foobar" or pass any other name + +#### docker-up +This will start your "dev" docker-machine (if necessary) and set it as the active one +To start a named machine use "docker-up foobar" + +#### docker-switch dev +Use this to activate a running docker-machine (or to switch between multiple machines) +You need to call either this or docker-up when opening a new terminal + +#### docker-stop +This will stop your "dev" docker-machine +To stop a named machine use "docker-stop foobar" \ No newline at end of file diff --git a/plugins/docker-machine/docker-machine.plugin.zsh b/plugins/docker-machine/docker-machine.plugin.zsh new file mode 100644 index 000000000..235d90ee8 --- /dev/null +++ b/plugins/docker-machine/docker-machine.plugin.zsh @@ -0,0 +1,33 @@ +DEFAULT_MACHINE="default" + +docker-up() { + if [ -z "$1" ] + then + docker-machine start "${DEFAULT_MACHINE}" + eval $(docker-machine env "${DEFAULT_MACHINE}") + else + docker-machine start $1 + eval $(docker-machine env $1) + fi + echo $DOCKER_HOST +} +docker-stop() { + if [ -z "$1" ] + then + docker-machine stop "${DEFAULT_MACHINE}" + else + docker-machine stop $1 + fi +} +docker-switch() { + eval $(docker-machine env $1) + echo $DOCKER_HOST +} +docker-vm() { + if [ -z "$1" ] + then + docker-machine create -d virtualbox --virtualbox-disk-size 20000 --virtualbox-memory 4096 --virtualbox-cpu-count 2 "${DEFAULT_MACHINE}" + else + docker-machine create -d virtualbox --virtualbox-disk-size 20000 --virtualbox-memory 4096 --virtualbox-cpu-count 2 $1 + fi +} \ No newline at end of file From 5486aa21eb3e3a6068a814531799063280800c19 Mon Sep 17 00:00:00 2001 From: Jonathan Channon Date: Tue, 7 Nov 2017 16:06:19 +0000 Subject: [PATCH 0225/1083] Added --force-with-lease method (#5025) --- plugins/git/git.plugin.zsh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 52dcea7dd..4536e191a 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -107,6 +107,10 @@ ggf() { [[ "$#" != 1 ]] && local b="$(git_current_branch)" git push --force origin "${b:=$1}" } +ggfl() { +[[ "$#" != 1 ]] && local b="$(git_current_branch)" +git push --force-with-lease origin "${b:=$1}" +} compdef _git ggf=git-checkout ggl() { From ed85147e6e6cee9d030fd32f7643e5323a707cfc Mon Sep 17 00:00:00 2001 From: Mahmoud Hossam Date: Tue, 7 Nov 2017 18:06:42 +0200 Subject: [PATCH 0226/1083] Rename clashing ag alias (#5849) * Fix ubuntu ag alias clashing with the silver searcher * Add aliases for git apply and git merge --abort --- plugins/git/git.plugin.zsh | 2 ++ plugins/ubuntu/ubuntu.plugin.zsh | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 4536e191a..fa0c06500 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -44,6 +44,7 @@ alias ga='git add' alias gaa='git add --all' alias gapa='git add --patch' alias gau='git add --update' +alias gap='git apply' alias gb='git branch' alias gba='git branch -a' @@ -191,6 +192,7 @@ alias gmom='git merge origin/master' alias gmt='git mergetool --no-prompt' alias gmtvim='git mergetool --no-prompt --tool=vimdiff' alias gmum='git merge upstream/master' +alias gma='git merge --abort' alias gp='git push' alias gpd='git push --dry-run' diff --git a/plugins/ubuntu/ubuntu.plugin.zsh b/plugins/ubuntu/ubuntu.plugin.zsh index eab2da409..ba7143687 100644 --- a/plugins/ubuntu/ubuntu.plugin.zsh +++ b/plugins/ubuntu/ubuntu.plugin.zsh @@ -28,7 +28,7 @@ compdef _afu afu='sudo apt-file update' alias ppap='sudo ppa-purge' compdef _ppap ppap='sudo ppa-purge' -alias ag='sudo apt-get' # age - but without sudo +alias apg='sudo apt-get' # age - but without sudo alias aga='sudo apt-get autoclean' # aac alias agb='sudo apt-get build-dep' # abd alias agc='sudo apt-get clean' # adc @@ -42,7 +42,7 @@ alias agug='sudo apt-get upgrade' # ag alias aguu='sudo apt-get update && sudo apt-get upgrade' #adg alias agar='sudo apt-get autoremove' -compdef _ag ag='sudo apt-get' +compdef _ag apg='sudo apt-get' compdef _aga aga='sudo apt-get autoclean' compdef _agb agb='sudo apt-get build-dep' compdef _agc agc='sudo apt-get clean' From 85401d481106e4d47709dea0270d5160004d9b30 Mon Sep 17 00:00:00 2001 From: "Aviv A. Rosenberg" Date: Tue, 7 Nov 2017 18:11:21 +0200 Subject: [PATCH 0227/1083] Plugin for iTerm2 (#3790) * Plugin for iTerm2 on OSX iTerm2 is a popular terminal emulator for OSX (https://www.iterm2.com). The plugin currently implements one function, iterm2_profile, which allows easily changing the currently selected user settings profile, without creating a new tab or window, just by calling the function. For example, this is handy for switching from a dark to a light colored profile without having to re-open anything. In addition, it also works within tmux running inside iTerm2. * iTerm2 Plugin: Run any iTerm2 command Refactored the plugin so that it can run arbitrary iTerm2 commands. Should work with any of the supported commands, see https://iterm2.com/documentation-escape-codes.html * iTerm2 Plugin: Add functions to change tab color --- plugins/iterm2/iterm2.plugin.zsh | 68 ++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 plugins/iterm2/iterm2.plugin.zsh diff --git a/plugins/iterm2/iterm2.plugin.zsh b/plugins/iterm2/iterm2.plugin.zsh new file mode 100644 index 000000000..e4ac72ee3 --- /dev/null +++ b/plugins/iterm2/iterm2.plugin.zsh @@ -0,0 +1,68 @@ +##################################################### +# iTerm2 plugin for oh-my-zsh # +# Author: Aviv Rosenberg (github.com/avivrosenberg) # +##################################################### + +### +# This plugin is only relevant if the terminal is iTerm2 on OSX. +if [[ "$OSTYPE" == darwin* ]] && [[ -n "$ITERM_SESSION_ID" ]] ; then + + ### + # Executes an arbitrary iTerm2 command via an escape code sequce. + # See https://iterm2.com/documentation-escape-codes.html for all supported commands. + # Example: $ _iterm2_command "1337;StealFocus" + function _iterm2_command() { + local cmd="$1" + + # Escape codes for wrapping commands for iTerm2. + local iterm2_prefix="\x1B]" + local iterm2_suffix="\x07" + + # If we're in tmux, a special escape code must be prepended/appended so that + # the iTerm2 escape code is passed on into iTerm2. + if [[ -n $TMUX ]]; then + local tmux_prefix="\x1BPtmux;\x1B" + local tmux_suffix="\x1B\\" + fi + + echo -n "${tmux_prefix}${iterm2_prefix}${cmd}${iterm2_suffix}${tmux_suffix}" + } + + ### + # iterm2_profile(): Function for changing the current terminal window's + # profile (colors, fonts, settings, etc). + # To change the current iTerm2 profile, call this function and pass in a name + # of another existing iTerm2 profile (name can contain spaces). + function iterm2_profile() { + # Desired name of profile + local profile="$1" + + # iTerm2 command for changing profile + local cmd="1337;SetProfile=$profile" + + # send the sequence + _iterm2_command "${cmd}" + + # update shell variable + ITERM_PROFILE="$profile" + } + + ### + # iterm2_tab_color(): Changes the color of iTerm2's currently active tab. + # Usage: iterm2_tab_color + # where red/green/blue are on the range 0-255. + function iterm2_tab_color() { + _iterm2_command "6;1;bg;red;brightness;$1" + _iterm2_command "6;1;bg;green;brightness;$2" + _iterm2_command "6;1;bg;blue;brightness;$3" + } + + + ### + # iterm2_tab_color_reset(): Resets the color of iTerm2's current tab back to + # default. + function iterm2_tab_color_reset() { + _iterm2_command "6;1;bg;*;default" + } + +fi From 7a7480b987c00bd916e2abf7179f92164ac44362 Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Wed, 8 Nov 2017 10:46:40 -0800 Subject: [PATCH 0228/1083] Updating template and README to list plugins on individual lines vs one long one. Easier scanning for you and me. --- README.md | 22 +++++++++++++++++----- templates/zshrc.zsh-template | 4 +++- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index df5ef48be..541f48d40 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ __Oh My Zsh will not make you a 10x developer...but you might feel like one.__ Once installed, your terminal shell will become the talk of the town _or your money back!_ With each keystroke in your command prompt, you'll take advantage of the hundreds of powerful plugins and beautiful themes. Strangers will come up to you in cafés and ask you, _"that is amazing! are you some sort of genius?"_ -Finally, you'll begin to get the sort of attention that you have always felt you deserved. ...or maybe you'll use the time that you're saving to start flossing more often. +Finally, you'll begin to get the sort of attention that you have always felt you deserved. ...or maybe you'll use the time that you're saving to start flossing more often. 😬 To learn more, visit [ohmyz.sh](http://ohmyz.sh) and follow [@ohmyzsh](https://twitter.com/ohmyzsh) on Twitter. @@ -51,10 +51,22 @@ Oh My Zsh comes with a shitload of plugins to take advantage of. You can take a Once you spot a plugin (or several) that you'd like to use with Oh My Zsh, you'll need to enable them in the `.zshrc` file. You'll find the zshrc file in your `$HOME` directory. Open it with your favorite text editor and you'll see a spot to list all the plugins you want to load. -For example, this line might begin to look like this: +```shell +vi ~/.zshrc +``` + +For example, this might begin to look like this: ```shell -plugins=(git bundler osx rake ruby) +plugins=( + git + bundler + dotenv + osx + rake + rbenv + ruby +) ``` #### Using Plugins @@ -69,7 +81,7 @@ We'll admit it. Early in the Oh My Zsh world, we may have gotten a bit too theme _Robby's theme is the default one. It's not the fanciest one. It's not the simplest one. It's just the right one (for him)._ -Once you find a theme that you want to use, you will need to edit the `~/.zshrc` file. You'll see an environment variable (all caps) in there that looks like: +Once you find a theme that you'd like to use, you will need to edit the `~/.zshrc` file. You'll see an environment variable (all caps) in there that looks like: ```shell ZSH_THEME="robbyrussell" @@ -193,7 +205,7 @@ If you'd like to upgrade at any point in time (maybe someone just released a new upgrade_oh_my_zsh ``` -Magic! +Magic! 🎉 ## Uninstalling Oh My Zsh diff --git a/templates/zshrc.zsh-template b/templates/zshrc.zsh-template index 966d7a975..bba2d370d 100644 --- a/templates/zshrc.zsh-template +++ b/templates/zshrc.zsh-template @@ -58,7 +58,9 @@ ZSH_THEME="robbyrussell" # Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/ # Example format: plugins=(rails git textmate ruby lighthouse) # Add wisely, as too many plugins slow down shell startup. -plugins=(git) +plugins=( + git +) source $ZSH/oh-my-zsh.sh From 2c87f85ad56663c322f6a72f4ef6ad70b74c8aad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Czocha=C5=84ski?= Date: Wed, 8 Nov 2017 23:02:38 +0100 Subject: [PATCH 0229/1083] Fix wrong $GNUPGHOME usage in gpg-agent plugin (#6403) $GNUPGHOME variable was used incorrectly and caused a grep error when set. --- plugins/gpg-agent/gpg-agent.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/gpg-agent/gpg-agent.plugin.zsh b/plugins/gpg-agent/gpg-agent.plugin.zsh index 0bf65d58f..69e239ccf 100644 --- a/plugins/gpg-agent/gpg-agent.plugin.zsh +++ b/plugins/gpg-agent/gpg-agent.plugin.zsh @@ -6,7 +6,7 @@ if [ ! -S $GPG_AGENT_SOCKET ]; then fi # Set SSH to use gpg-agent if it is configured to do so -GNUPGCONFIG=${GNUPGHOME:-"$HOME/.gnupg/gpg-agent.conf"} +GNUPGCONFIG="${GNUPGHOME:-"$HOME/.gnupg"}/gpg-agent.conf" if [ -r "$GNUPGCONFIG" ] && grep -q enable-ssh-support "$GNUPGCONFIG"; then unset SSH_AGENT_PID export SSH_AUTH_SOCK=$GPG_AGENT_SOCKET From 7cea8475fbf8e1ba9e665e7740e35182c57bfb6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juanra=20N=C3=BA=C3=B1ez?= Date: Wed, 8 Nov 2017 17:03:11 -0500 Subject: [PATCH 0230/1083] Added aliases for listing packages (#6374) Added 'agli' to list all installed packages. Added 'aglu' to list available updates only. --- plugins/ubuntu/ubuntu.plugin.zsh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/plugins/ubuntu/ubuntu.plugin.zsh b/plugins/ubuntu/ubuntu.plugin.zsh index ba7143687..082481466 100644 --- a/plugins/ubuntu/ubuntu.plugin.zsh +++ b/plugins/ubuntu/ubuntu.plugin.zsh @@ -21,7 +21,16 @@ compdef _ags ags='apt-get source' alias acp='apt-cache policy' # app compdef _acp acp='apt-cache policy' +#List all installed packages +alias agli='apt list --installed' +compdef _agli agli='apt list --installed' + # superuser operations ###################################################### + +# List available updates only +alias aglu='sudo apt-get -u upgrade --assume-no' +compdef _aglu aglu='sudo apt-get -u upgrade --assume-no' + alias afu='sudo apt-file update' compdef _afu afu='sudo apt-file update' From dcb8101fdeded9aa4310d867f9c809c976a0f1cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20F=C3=A6revaag?= Date: Fri, 10 Nov 2017 08:10:33 +0900 Subject: [PATCH 0231/1083] [wd] Fix update of wd plugin to v0.4.6 (#6407) --- plugins/wd/_wd.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/wd/_wd.sh b/plugins/wd/_wd.sh index d5419d629..4354a71f4 100644 --- a/plugins/wd/_wd.sh +++ b/plugins/wd/_wd.sh @@ -24,7 +24,7 @@ function _wd() { target_path=${arr[2]} # replace ~ from path to fix completion (#17) - target_path=${path/#\~/$HOME} + target_path=${target_path/#\~/$HOME} points[$name]=$target_path done < $CONFIG From 41eedd37005f6b3668fcebe2a5f5a26324753519 Mon Sep 17 00:00:00 2001 From: Antonis Kalipetis Date: Sat, 11 Nov 2017 19:40:03 +0200 Subject: [PATCH 0232/1083] Update Docker completion plugin (#6410) --- plugins/docker/README.md | 2 +- plugins/docker/_docker | 472 ++++++++++++++++++++++++++++++--------- 2 files changed, 373 insertions(+), 101 deletions(-) diff --git a/plugins/docker/README.md b/plugins/docker/README.md index 1615f75f5..e91798485 100644 --- a/plugins/docker/README.md +++ b/plugins/docker/README.md @@ -1,5 +1,5 @@ ## Docker autocomplete plugin A copy of the completion script from the -[docker](https://github.com/docker/docker/tree/master/contrib/completion/zsh) +[docker/cli](https://github.com/docker/cli/blob/master/contrib/completion/zsh/_docker) git repo. diff --git a/plugins/docker/_docker b/plugins/docker/_docker index 1aec353c5..5d6edd880 100644 --- a/plugins/docker/_docker +++ b/plugins/docker/_docker @@ -78,7 +78,7 @@ __docker_get_containers() { s="${${line[${begin[CONTAINER ID]},${end[CONTAINER ID]}]%% ##}[0,12]}" s="$s:${(l:15:: :::)${${line[${begin[CREATED]},${end[CREATED]}]/ ago/}%% ##}}" s="$s, ${${${line[${begin[IMAGE]},${end[IMAGE]}]}/:/\\:}%% ##}" - if [[ ${line[${begin[STATUS]},${end[STATUS]}]} = Exit* ]]; then + if [[ ${line[${begin[STATUS]},${end[STATUS]}]} = (Exit*|Created*) ]]; then stopped=($stopped $s) else running=($running $s) @@ -100,7 +100,7 @@ __docker_get_containers() { (( $#s != 0 )) || continue s="$s:${(l:15:: :::)${${line[${begin[CREATED]},${end[CREATED]}]/ ago/}%% ##}}" s="$s, ${${${line[${begin[IMAGE]},${end[IMAGE]}]}/:/\\:}%% ##}" - if [[ ${line[${begin[STATUS]},${end[STATUS]}]} = Exit* ]]; then + if [[ ${line[${begin[STATUS]},${end[STATUS]}]} = (Exit*|Created*) ]]; then stopped=($stopped $s) else running=($running $s) @@ -221,17 +221,19 @@ __docker_get_log_options() { integer ret=1 local log_driver=${opt_args[--log-driver]:-"all"} - local -a awslogs_options fluentd_options gelf_options journald_options json_file_options logentries_options syslog_options splunk_options + local -a common_options common_options2 awslogs_options fluentd_options gelf_options journald_options json_file_options logentries_options syslog_options splunk_options - awslogs_options=("awslogs-region" "awslogs-group" "awslogs-stream") - fluentd_options=("env" "fluentd-address" "fluentd-async-connect" "fluentd-buffer-limit" "fluentd-retry-wait" "fluentd-max-retries" "labels" "tag") - gcplogs_options=("env" "gcp-log-cmd" "gcp-project" "labels") - gelf_options=("env" "gelf-address" "gelf-compression-level" "gelf-compression-type" "labels" "tag") - journald_options=("env" "labels" "tag") - json_file_options=("env" "labels" "max-file" "max-size") - logentries_options=("logentries-token") - syslog_options=("env" "labels" "syslog-address" "syslog-facility" "syslog-format" "syslog-tls-ca-cert" "syslog-tls-cert" "syslog-tls-key" "syslog-tls-skip-verify" "tag") - splunk_options=("env" "labels" "splunk-caname" "splunk-capath" "splunk-format" "splunk-gzip" "splunk-gzip-level" "splunk-index" "splunk-insecureskipverify" "splunk-source" "splunk-sourcetype" "splunk-token" "splunk-url" "splunk-verify-connection" "tag") + common_options=("max-buffer-size" "mode") + common_options2=("env" "env-regex" "labels") + awslogs_options=($common_options "awslogs-create-group" "awslogs-datetime-format" "awslogs-group" "awslogs-multiline-pattern" "awslogs-region" "awslogs-stream" "tag") + fluentd_options=($common_options $common_options2 "fluentd-address" "fluentd-async-connect" "fluentd-buffer-limit" "fluentd-retry-wait" "fluentd-max-retries" "tag") + gcplogs_options=($common_options $common_options2 "gcp-log-cmd" "gcp-meta-id" "gcp-meta-name" "gcp-meta-zone" "gcp-project") + gelf_options=($common_options $common_options2 "gelf-address" "gelf-compression-level" "gelf-compression-type" "tag") + journald_options=($common_options $common_options2 "tag") + json_file_options=($common_options $common_options2 "max-file" "max-size") + logentries_options=($common_options $common_options2 "logentries-token" "tag") + syslog_options=($common_options $common_options2 "syslog-address" "syslog-facility" "syslog-format" "syslog-tls-ca-cert" "syslog-tls-cert" "syslog-tls-key" "syslog-tls-skip-verify" "tag") + splunk_options=($common_options $common_options2 "splunk-caname" "splunk-capath" "splunk-format" "splunk-gzip" "splunk-gzip-level" "splunk-index" "splunk-insecureskipverify" "splunk-source" "splunk-sourcetype" "splunk-token" "splunk-url" "splunk-verify-connection" "tag") [[ $log_driver = (awslogs|all) ]] && _describe -t awslogs-options "awslogs options" awslogs_options "$@" && ret=0 [[ $log_driver = (fluentd|all) ]] && _describe -t fluentd-options "fluentd options" fluentd_options "$@" && ret=0 @@ -261,8 +263,12 @@ __docker_complete_log_options() { if compset -P '*='; then case "${${words[-1]%=*}#*=}" in (syslog-format) - syslog_format_opts=('rfc3164' 'rfc5424' 'rfc5424micro') - _describe -t syslog-format-opts "Syslog format Options" syslog_format_opts && ret=0 + local opts=('rfc3164' 'rfc5424' 'rfc5424micro') + _describe -t syslog-format-opts "syslog format options" opts && ret=0 + ;; + (mode) + local opts=('blocking' 'non-blocking') + _describe -t mode-opts "mode options" opts && ret=0 ;; *) _message 'value' && ret=0 @@ -362,7 +368,7 @@ __docker_complete_ps_filters() { ;; esac else - opts=('ancestor' 'before' 'exited' 'health' 'id' 'label' 'name' 'network' 'since' 'status' 'volume') + opts=('ancestor' 'before' 'exited' 'expose' 'health' 'id' 'label' 'name' 'network' 'publish' 'since' 'status' 'volume') _describe -t filter-opts "Filter Options" opts -qS "=" && ret=0 fi @@ -474,6 +480,77 @@ __docker_complete_events_filter() { return ret } +__docker_complete_prune_filters() { + [[ $PREFIX = -* ]] && return 1 + integer ret=1 + declare -a opts + + opts=('until') + + if compset -P '*='; then + case "${${words[-1]%=*}#*=}" in + *) + _message 'value' && ret=0 + ;; + esac + else + _describe -t filter-opts "filter options" opts -qS "=" && ret=0 + fi + + return ret +} + +# BO checkpoint + +__docker_checkpoint_commands() { + local -a _docker_checkpoint_subcommands + _docker_checkpoint_subcommands=( + "create:Create a checkpoint from a running container" + "ls:List checkpoints for a container" + "rm:Remove a checkpoint" + ) + _describe -t docker-checkpoint-commands "docker checkpoint command" _docker_checkpoint_subcommands +} + +__docker_checkpoint_subcommand() { + local -a _command_args opts_help + local expl help="--help" + integer ret=1 + + opts_help=("(: -)--help[Print usage]") + + case "$words[1]" in + (create) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help)--checkpoint-dir=[Use a custom checkpoint storage directory]:dir:_directories" \ + "($help)--leave-running[Leave the container running after checkpoint]" \ + "($help -)1:container:__docker_complete_running_containers" \ + "($help -)2:checkpoint: " && ret=0 + ;; + (ls|list) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help)--checkpoint-dir=[Use a custom checkpoint storage directory]:dir:_directories" \ + "($help -)1:container:__docker_complete_containers" && ret=0 + ;; + (rm|remove) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help)--checkpoint-dir=[Use a custom checkpoint storage directory]:dir:_directories" \ + "($help -)1:container:__docker_complete_containers" \ + "($help -)2:checkpoint: " && ret=0 + ;; + (help) + _arguments $(__docker_arguments) ":subcommand:__docker_checkpoint_commands" && ret=0 + ;; + esac + + return ret +} + +# EO checkpoint + # BO container __docker_container_commands() { @@ -526,6 +603,7 @@ __docker_container_subcommand() { "($help)--cidfile=[Write the container ID to the file]:CID file:_files" "($help)--cpus=[Number of CPUs (default 0.000)]:cpus: " "($help)*--device=[Add a host device to the container]:device:_files" + "($help)*--device-cgroup-rule=[Add a rule to the cgroup allowed devices list]:device:cgroup: " "($help)*--device-read-bps=[Limit the read rate (bytes per second) from a device]:device:IO rate: " "($help)*--device-read-iops=[Limit the read rate (IO per second) from a device]:device:IO rate: " "($help)*--device-write-bps=[Limit the write rate (bytes per second) to a device]:device:IO rate: " @@ -541,16 +619,18 @@ __docker_container_subcommand() { "($help)*--group=[Set one or more supplementary user groups for the container]:group:_groups" "($help -h --hostname)"{-h=,--hostname=}"[Container host name]:hostname:_hosts" "($help -i --interactive)"{-i,--interactive}"[Keep stdin open even if not attached]" - "($help)--ip=[Container IPv4 address]:IPv4: " - "($help)--ip6=[Container IPv6 address]:IPv6: " + "($help)--init[Run an init inside the container that forwards signals and reaps processes]" + "($help)--ip=[IPv4 address]:IPv4: " + "($help)--ip6=[IPv6 address]:IPv6: " "($help)--ipc=[IPC namespace to use]:IPC namespace: " "($help)--isolation=[Container isolation technology]:isolation:(default hyperv process)" "($help)*--link=[Add link to another container]:link:->link" - "($help)*--link-local-ip=[Add a link-local address for the container]:IPv4/IPv6: " + "($help)*--link-local-ip=[Container IPv4/IPv6 link-local addresses]:IPv4/IPv6: " "($help)*"{-l=,--label=}"[Container metadata]:label: " "($help)--log-driver=[Default driver for container logs]:logging driver:__docker_complete_log_drivers" "($help)*--log-opt=[Log driver specific options]:log driver options:__docker_complete_log_options" "($help)--mac-address=[Container MAC address]:MAC address: " + "($help)*--mount=[Attach a filesystem mount to the container]:mount: " "($help)--name=[Container name]:name: " "($help)--network=[Connect a container to a network]:network mode:(bridge none container host)" "($help)*--network-alias=[Add network-scoped alias for the container]:alias: " @@ -564,6 +644,7 @@ __docker_container_subcommand() { "($help)--read-only[Mount the container's root filesystem as read only]" "($help)*--security-opt=[Security options]:security option: " "($help)*--shm-size=[Size of '/dev/shm' (format is '')]:shm size: " + "($help)--stop-signal=[Signal to kill a container]:signal:_signals" "($help)--stop-timeout=[Timeout (in seconds) to stop a container]:time: " "($help)*--sysctl=-[sysctl options]:sysctl: " "($help -t --tty)"{-t,--tty}"[Allocate a pseudo-tty]" @@ -731,6 +812,7 @@ __docker_container_subcommand() { (prune) _arguments $(__docker_arguments) \ $opts_help \ + "($help)*--filter=[Filter values]:filter:__docker_complete_prune_filters" \ "($help -f --force)"{-f,--force}"[Do not prompt for confirmation]" && ret=0 ;; (rename) @@ -779,7 +861,6 @@ __docker_container_subcommand() { "($help)--rm[Remove intermediate containers when it exits]" \ "($help)--runtime=[Name of the runtime to be used for that container]:runtime:__docker_complete_runtimes" \ "($help)--sig-proxy[Proxy all received signals to the process (non-TTY mode only)]" \ - "($help)--stop-signal=[Signal to kill a container]:signal:_signals" \ "($help)--storage-opt=[Storage driver options for the container]:storage options:->storage-opt" \ "($help -): :__docker_complete_images" \ "($help -):command: _command_names -e" \ @@ -816,6 +897,7 @@ __docker_container_subcommand() { "($help -a --all)"{-a,--all}"[Show all containers (default shows just running)]" \ "($help)--format=[Pretty-print images using a Go template]:template: " \ "($help)--no-stream[Disable streaming stats and only pull the first result]" \ + "($help)--no-trunc[Do not truncate output]" \ "($help -)*:containers:__docker_complete_running_containers" && ret=0 ;; (stop) @@ -899,6 +981,7 @@ __docker_image_subcommand() { (build) _arguments $(__docker_arguments) \ $opts_help \ + "($help)*--add-host=[Add a custom host-to-IP mapping]:host\:ip mapping: " \ "($help)*--build-arg=[Build-time variables]:=: " \ "($help)*--cache-from=[Images to consider as cache sources]: :__docker_complete_repositories_with_tags" \ "($help -c --cpu-shares)"{-c=,--cpu-shares=}"[CPU shares (relative weight)]:CPU shares:(0 10 100 200 500 800 1000)" \ @@ -923,6 +1006,7 @@ __docker_image_subcommand() { "($help -q --quiet)"{-q,--quiet}"[Suppress verbose build output]" \ "($help)--rm[Remove intermediate containers after a successful build]" \ "($help)*--shm-size=[Size of '/dev/shm' (format is '')]:shm size: " \ + "($help)--squash[Squash newly built layers into a single new layer]" \ "($help -t --tag)*"{-t=,--tag=}"[Repository, name and tag for the image]: :__docker_complete_repositories_with_tags" \ "($help)*--ulimit=[ulimit options]:ulimit: " \ "($help)--userns=[Container user namespace]:user namespace:(host)" \ @@ -962,21 +1046,17 @@ __docker_image_subcommand() { $opts_help \ "($help -a --all)"{-a,--all}"[Show all images]" \ "($help)--digests[Show digests]" \ - "($help)*"{-f=,--filter=}"[Filter values]:filter:->filter-options" \ + "($help)*"{-f=,--filter=}"[Filter values]:filter:__docker_complete_images_filters" \ "($help)--format=[Pretty-print images using a Go template]:template: " \ "($help)--no-trunc[Do not truncate output]" \ "($help -q --quiet)"{-q,--quiet}"[Only show numeric IDs]" \ "($help -): :__docker_complete_repositories" && ret=0 - case $state in - (filter-options) - __docker_complete_images_filters && ret=0 - ;; - esac ;; (prune) _arguments $(__docker_arguments) \ $opts_help \ "($help -a --all)"{-a,--all}"[Remove all unused images, not just dangling ones]" \ + "($help)*--filter=[Filter values]:filter:__docker_complete_prune_filters" \ "($help -f --force)"{-f,--force}"[Do not prompt for confirmation]" && ret=0 ;; (pull) @@ -1038,16 +1118,20 @@ __docker_network_complete_ls_filters() { (name) __docker_complete_networks_names && ret=0 ;; + (scope) + opts=('global' 'local' 'swarm') + _describe -t scope-filter-opts "Scope filter options" opts && ret=0 + ;; (type) - type_opts=('builtin' 'custom') - _describe -t type-filter-opts "Type Filter Options" type_opts && ret=0 + opts=('builtin' 'custom') + _describe -t type-filter-opts "Type filter options" opts && ret=0 ;; *) _message 'value' && ret=0 ;; esac else - opts=('driver' 'id' 'label' 'name' 'type') + opts=('driver' 'id' 'label' 'name' 'scope' 'type') _describe -t filter-opts "Filter Options" opts -qS "=" && ret=0 fi @@ -1142,8 +1226,8 @@ __docker_network_subcommand() { _arguments $(__docker_arguments) \ $opts_help \ "($help)*--alias=[Add network-scoped alias for the container]:alias: " \ - "($help)--ip=[Container IPv4 address]:IPv4: " \ - "($help)--ip6=[Container IPv6 address]:IPv6: " \ + "($help)--ip=[IPv4 address]:IPv4: " \ + "($help)--ip6=[IPv6 address]:IPv6: " \ "($help)*--link=[Add a link to another container]:link:->link" \ "($help)*--link-local-ip=[Add a link-local address for the container]:IPv4/IPv6: " \ "($help -)1:network:__docker_complete_networks" \ @@ -1186,24 +1270,21 @@ __docker_network_subcommand() { _arguments $(__docker_arguments) \ $opts_help \ "($help -f --format)"{-f=,--format=}"[Format the output using the given go template]:template: " \ + "($help)--verbose[Show detailed information]" \ "($help -)*:network:__docker_complete_networks" && ret=0 ;; (ls) _arguments $(__docker_arguments) \ $opts_help \ "($help)--no-trunc[Do not truncate the output]" \ - "($help)*"{-f=,--filter=}"[Provide filter values]:filter:->filter-options" \ + "($help)*"{-f=,--filter=}"[Provide filter values]:filter:__docker_network_complete_ls_filters" \ "($help)--format=[Pretty-print networks using a Go template]:template: " \ "($help -q --quiet)"{-q,--quiet}"[Only display numeric IDs]" && ret=0 - case $state in - (filter-options) - __docker_network_complete_ls_filters && ret=0 - ;; - esac ;; (prune) _arguments $(__docker_arguments) \ $opts_help \ + "($help)*--filter=[Filter values]:filter:__docker_complete_prune_filters" \ "($help -f --force)"{-f,--force}"[Do not prompt for confirmation]" && ret=0 ;; (rm) @@ -1262,7 +1343,7 @@ __docker_node_complete_ps_filters() { if compset -P '*='; then case "${${words[-1]%=*}#*=}" in (desired-state) - state_opts=('accepted' 'running') + state_opts=('accepted' 'running' 'shutdown') _describe -t state-opts "desired state options" state_opts && ret=0 ;; *) @@ -1394,13 +1475,8 @@ __docker_node_subcommand() { (ls|list) _arguments $(__docker_arguments) \ $opts_help \ - "($help)*"{-f=,--filter=}"[Provide filter values]:filter:->filter-options" \ + "($help)*"{-f=,--filter=}"[Provide filter values]:filter:__docker_node_complete_ls_filters" \ "($help -q --quiet)"{-q,--quiet}"[Only display IDs]" && ret=0 - case $state in - (filter-options) - __docker_node_complete_ls_filters && ret=0 - ;; - esac ;; (promote) _arguments $(__docker_arguments) \ @@ -1411,15 +1487,12 @@ __docker_node_subcommand() { _arguments $(__docker_arguments) \ $opts_help \ "($help -a --all)"{-a,--all}"[Display all instances]" \ - "($help)*"{-f=,--filter=}"[Provide filter values]:filter:->filter-options" \ + "($help)*"{-f=,--filter=}"[Provide filter values]:filter:__docker_node_complete_ps_filters" \ + "($help)--format=[Format the output using the given go template]:template: " \ "($help)--no-resolve[Do not map IDs to Names]" \ "($help)--no-trunc[Do not truncate output]" \ + "($help -q --quiet)"{-q,--quiet}"[Only display IDs]" \ "($help -)*:node:__docker_complete_nodes" && ret=0 - case $state in - (filter-options) - __docker_node_complete_ps_filters && ret=0 - ;; - esac ;; (update) _arguments $(__docker_arguments) \ @@ -1442,13 +1515,42 @@ __docker_node_subcommand() { # BO plugin -__docker_complete_plugins() { +__docker_plugin_complete_ls_filters() { + [[ $PREFIX = -* ]] && return 1 + integer ret=1 + + if compset -P '*='; then + case "${${words[-1]%=*}#*=}" in + (capability) + opts=('authz' 'ipamdriver' 'logdriver' 'metricscollector' 'networkdriver' 'volumedriver') + _describe -t capability-opts "capability options" opts && ret=0 + ;; + (enabled) + opts=('false' 'true') + _describe -t enabled-opts "enabled options" opts && ret=0 + ;; + *) + _message 'value' && ret=0 + ;; + esac + else + opts=('capability' 'enabled') + _describe -t filter-opts "filter options" opts -qS "=" && ret=0 + fi + + return ret +} + +__docker_plugins() { [[ $PREFIX = -* ]] && return 1 integer ret=1 local line s - declare -a lines plugins + declare -a lines plugins args - lines=(${(f)${:-"$(_call_program commands docker $docker_options plugin ls)"$'\n'}}) + filter=$1; shift + [[ $filter != "none" ]] && args=("-f $filter") + + lines=(${(f)${:-"$(_call_program commands docker $docker_options plugin ls $args)"$'\n'}}) # Parse header line to find columns local i=1 j=1 k header=${lines[1]} @@ -1474,6 +1576,21 @@ __docker_complete_plugins() { return ret } +__docker_complete_plugins() { + [[ $PREFIX = -* ]] && return 1 + __docker_plugins none "$@" +} + +__docker_complete_enabled_plugins() { + [[ $PREFIX = -* ]] && return 1 + __docker_plugins enabled=true "$@" +} + +__docker_complete_disabled_plugins() { + [[ $PREFIX = -* ]] && return 1 + __docker_plugins enabled=false "$@" +} + __docker_plugin_commands() { local -a _docker_plugin_subcommands _docker_plugin_subcommands=( @@ -1485,6 +1602,7 @@ __docker_plugin_commands() { "push:Push a plugin" "rm:Remove a plugin" "set:Change settings for a plugin" + "upgrade:Upgrade an existing plugin" ) _describe -t docker-plugin-commands "docker plugin command" _docker_plugin_subcommands } @@ -1497,16 +1615,68 @@ __docker_plugin_subcommand() { opts_help=("(: -)--help[Print usage]") case "$words[1]" in - (disable|enable|inspect|install|ls|push|rm) + (disable) _arguments $(__docker_arguments) \ $opts_help \ + "($help -f --force)"{-f,--force}"[Force the disable of an active plugin]" \ + "($help -)1:plugin:__docker_complete_enabled_plugins" && ret=0 + ;; + (enable) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help)--timeout=[HTTP client timeout (in seconds)]:timeout: " \ + "($help -)1:plugin:__docker_complete_disabled_plugins" && ret=0 + ;; + (inspect) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -f --format)"{-f=,--format=}"[Format the output using the given Go template]:template: " \ + "($help -)*:plugin:__docker_complete_plugins" && ret=0 + ;; + (install) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help)--alias=[Local name for plugin]:alias: " \ + "($help)--disable[Do not enable the plugin on install]" \ + "($help)--disable-content-trust[Skip image verification (default true)]" \ + "($help)--grant-all-permissions[Grant all permissions necessary to run the plugin]" \ + "($help -)1:plugin:__docker_complete_plugins" \ + "($help -)*:key=value: " && ret=0 + ;; + (ls|list) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help)*"{-f=,--filter=}"[Filter output based on conditions provided]:filter:__docker_plugin_complete_ls_filters" \ + "($help --format)--format=[Format the output using the given Go template]:template: " \ + "($help)--no-trunc[Don't truncate output]" \ + "($help -q --quiet)"{-q,--quiet}"[Only display IDs]" && ret=0 + ;; + (push) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help)--disable-content-trust[Skip image verification (default true)]" \ "($help -)1:plugin:__docker_complete_plugins" && ret=0 ;; + (rm|remove) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -f --force)"{-f,--force}"[Force the removal of an active plugin]" \ + "($help -)*:plugin:__docker_complete_plugins" && ret=0 + ;; (set) _arguments $(__docker_arguments) \ $opts_help \ "($help -)1:plugin:__docker_complete_plugins" \ - "($help-)*:key=value: " && ret=0 + "($help -)*:key=value: " && ret=0 + ;; + (upgrade) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help)--disable-content-trust[Skip image verification (default true)]" \ + "($help)--grant-all-permissions[Grant all permissions necessary to run the plugin]" \ + "($help)--skip-remote-check[Do not check if specified remote plugin matches existing plugin image]" \ + "($help -)1:plugin:__docker_complete_plugins" \ + "($help -):remote: " && ret=0 ;; (help) _arguments $(__docker_arguments) ":subcommand:__docker_plugin_commands" && ret=0 @@ -1588,7 +1758,7 @@ __docker_secret_subcommand() { case "$words[1]" in (create) - _arguments $(__docker_arguments) \ + _arguments $(__docker_arguments) -A '-*' \ $opts_help \ "($help)*"{-l=,--label=}"[Secret labels]:label: " \ "($help -):secret: " && ret=0 @@ -1602,6 +1772,7 @@ __docker_secret_subcommand() { (ls|list) _arguments $(__docker_arguments) \ $opts_help \ + "($help)--format=[Format the output using the given go template]:template: " \ "($help -q --quiet)"{-q,--quiet}"[Only display IDs]" && ret=0 ;; (rm|remove) @@ -1630,6 +1801,10 @@ __docker_service_complete_ls_filters() { (id) __docker_complete_services_ids && ret=0 ;; + (mode) + opts=('global' 'replicated') + _describe -t mode-opts "mode options" opts && ret=0 + ;; (name) __docker_complete_services_names && ret=0 ;; @@ -1638,7 +1813,7 @@ __docker_service_complete_ls_filters() { ;; esac else - opts=('id' 'label' 'name') + opts=('id' 'label' 'mode' 'name') _describe -t filter-opts "filter options" opts -qS "=" && ret=0 fi @@ -1652,7 +1827,7 @@ __docker_service_complete_ps_filters() { if compset -P '*='; then case "${${words[-1]%=*}#*=}" in (desired-state) - state_opts=('accepted' 'running') + state_opts=('accepted' 'running' 'shutdown') _describe -t state-opts "desired state options" state_opts && ret=0 ;; *) @@ -1667,6 +1842,28 @@ __docker_service_complete_ps_filters() { return ret } +__docker_service_complete_placement_pref() { + [[ $PREFIX = -* ]] && return 1 + integer ret=1 + + if compset -P '*='; then + case "${${words[-1]%=*}#*=}" in + (spread) + opts=('engine.labels' 'node.labels') + _describe -t spread-opts "spread options" opts -qS "." && ret=0 + ;; + *) + _message 'value' && ret=0 + ;; + esac + else + opts=('spread') + _describe -t pref-opts "placement pref options" opts -qS "=" && ret=0 + fi + + return ret +} + __docker_services() { [[ $PREFIX = -* ]] && return 1 integer ret=1 @@ -1732,8 +1929,10 @@ __docker_service_commands() { _docker_service_subcommands=( "create:Create a new service" "inspect:Display detailed information on one or more services" + "logs:Fetch the logs of a service or task" "ls:List services" "rm:Remove one or more services" + "rollback:Revert changes to a service's configuration" "scale:Scale one or multiple replicated services" "ps:List the tasks of a service" "update:Update a service" @@ -1764,19 +1963,25 @@ __docker_service_subcommand() { "($help)*--mount=[Attach a filesystem mount to the service]:mount: " "($help)*--network=[Network attachments]:network: " "($help)--no-healthcheck[Disable any container-specified HEALTHCHECK]" - "($help)*"{-p=,--publish=}"[Publish a port as a node port]:port: " + "($help)--read-only[Mount the container's root filesystem as read only]" "($help)--replicas=[Number of tasks]:replicas: " "($help)--reserve-cpu=[Reserve CPUs]:value: " "($help)--reserve-memory=[Reserve Memory]:value: " "($help)--restart-condition=[Restart when condition is met]:mode:(any none on-failure)" "($help)--restart-delay=[Delay between restart attempts]:delay: " "($help)--restart-max-attempts=[Maximum number of restarts before giving up]:max-attempts: " - "($help)--restart-window=[Window used to evaluate the restart policy]:window: " + "($help)--restart-window=[Window used to evaluate the restart policy]:duration: " + "($help)--rollback-delay=[Delay between task rollbacks]:duration: " + "($help)--rollback-failure-action=[Action on rollback failure]:action:(continue pause)" + "($help)--rollback-max-failure-ratio=[Failure rate to tolerate during a rollback]:failure rate: " + "($help)--rollback-monitor=[Duration after each task rollback to monitor for failure]:duration: " + "($help)--rollback-parallelism=[Maximum number of tasks rolled back simultaneously]:number: " "($help)*--secret=[Specify secrets to expose to the service]:secret:__docker_complete_secrets" "($help)--stop-grace-period=[Time to wait before force killing a container]:grace period: " + "($help)--stop-signal=[Signal to stop the container]:signal:_signals" "($help -t --tty)"{-t,--tty}"[Allocate a pseudo-TTY]" "($help)--update-delay=[Delay between updates]:delay: " - "($help)--update-failure-action=[Action on update failure]:mode:(pause continue)" + "($help)--update-failure-action=[Action on update failure]:mode:(continue pause rollback)" "($help)--update-max-failure-ratio=[Failure rate to tolerate during an update]:fraction: " "($help)--update-monitor=[Duration after each task update to monitor for failure]:window: " "($help)--update-parallelism=[Maximum number of tasks updated simultaneously]:number: " @@ -1797,7 +2002,8 @@ __docker_service_subcommand() { "($help)*--env-file=[Read environment variables from a file]:environment file:_files" \ "($help)--mode=[Service Mode]:mode:(global replicated)" \ "($help)--name=[Service name]:name: " \ - "($help)*--publish=[Publish a port]:port: " \ + "($help)*--placement-pref=[Add a placement preference]:pref:__docker_service_complete_placement_pref" \ + "($help)*"{-p=,--publish=}"[Publish a port as a node port]:port: " \ "($help -): :__docker_complete_images" \ "($help -):command: _command_names -e" \ "($help -)*::arguments: _normal" && ret=0 @@ -1809,25 +2015,41 @@ __docker_service_subcommand() { "($help)--pretty[Print the information in a human friendly format]" \ "($help -)*:service:__docker_complete_services" && ret=0 ;; + (logs) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -f --follow)"{-f,--follow}"[Follow log output]" \ + "($help)--no-resolve[Do not map IDs to Names]" \ + "($help)--no-task-ids[Do not include task IDs]" \ + "($help)--no-trunc[Do not truncate output]" \ + "($help)--since=[Show logs since timestamp]:timestamp: " \ + "($help)--tail=[Number of lines to show from the end of the logs]:lines:(1 10 20 50 all)" \ + "($help -t --timestamps)"{-t,--timestamps}"[Show timestamps]" \ + "($help -)1:service:__docker_complete_services" && ret=0 + ;; (ls|list) _arguments $(__docker_arguments) \ $opts_help \ - "($help)*"{-f=,--filter=}"[Filter output based on conditions provided]:filter:->filter-options" \ + "($help)*"{-f=,--filter=}"[Filter output based on conditions provided]:filter:__docker_service_complete_ls_filters" \ + "($help)--format=[Pretty-print services using a Go template]:template: " \ "($help -q --quiet)"{-q,--quiet}"[Only display IDs]" && ret=0 - case $state in - (filter-options) - __docker_service_complete_ls_filters && ret=0 - ;; - esac ;; (rm|remove) _arguments $(__docker_arguments) \ $opts_help \ "($help -)*:service:__docker_complete_services" && ret=0 ;; + (rollback) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -d --detach)"{-d=false,--detach=false}"[Disable detached mode]" \ + "($help -q --quiet)"{-q,--quiet}"[Suppress progress output]" \ + "($help -)*:service:__docker_complete_services" && ret=0 + ;; (scale) _arguments $(__docker_arguments) \ $opts_help \ + "($help -d --detach)"{-d=false,--detach=false}"[Disable detached mode]" \ "($help -)*:service:->values" && ret=0 case $state in (values) @@ -1842,16 +2064,12 @@ __docker_service_subcommand() { (ps) _arguments $(__docker_arguments) \ $opts_help \ - "($help)*"{-f=,--filter=}"[Provide filter values]:filter:->filter-options" \ + "($help)*"{-f=,--filter=}"[Provide filter values]:filter:__docker_service_complete_ps_filters" \ + "($help)--format=[Format the output using the given go template]:template: " \ "($help)--no-resolve[Do not map IDs to Names]" \ "($help)--no-trunc[Do not truncate output]" \ "($help -q --quiet)"{-q,--quiet}"[Only display task IDs]" \ - "($help -)1:service:__docker_complete_services" && ret=0 - case $state in - (filter-options) - __docker_service_complete_ps_filters && ret=0 - ;; - esac + "($help -)*:service:__docker_complete_services" && ret=0 ;; (update) _arguments $(__docker_arguments) \ @@ -1870,6 +2088,8 @@ __docker_service_subcommand() { "($help)*--group-add=[Add additional supplementary user groups to the container]:group:_groups" \ "($help)*--group-rm=[Remove previously added supplementary user groups from the container]:group:_groups" \ "($help)--image=[Service image tag]:image:__docker_complete_repositories" \ + "($help)*--placement-pref-add=[Add a placement preference]:pref:__docker_service_complete_placement_pref" \ + "($help)*--placement-pref-rm=[Remove a placement preference]:pref:__docker_service_complete_placement_pref" \ "($help)*--publish-add=[Add or update a port]:port: " \ "($help)*--publish-rm=[Remove a port(target-port mandatory)]:port: " \ "($help)--rollback[Rollback to previous specification]" \ @@ -1894,7 +2114,7 @@ __docker_stack_complete_ps_filters() { if compset -P '*='; then case "${${words[-1]%=*}#*=}" in (desired-state) - state_opts=('accepted' 'running') + state_opts=('accepted' 'running' 'shutdown') _describe -t state-opts "desired state options" state_opts && ret=0 ;; *) @@ -2000,8 +2220,10 @@ __docker_stack_subcommand() { $opts_help \ "($help -a --all)"{-a,--all}"[Display all tasks]" \ "($help)*"{-f=,--filter=}"[Filter output based on conditions provided]:filter:__docker_stack_complete_ps_filters" \ + "($help)--format=[Format the output using the given go template]:template: " \ "($help)--no-resolve[Do not map IDs to Names]" \ "($help)--no-trunc[Do not truncate output]" \ + "($help -q --quiet)"{-q,--quiet}"[Only display task IDs]" \ "($help -):stack:__docker_complete_stacks" && ret=0 ;; (rm|remove|down) @@ -2013,6 +2235,7 @@ __docker_stack_subcommand() { _arguments $(__docker_arguments) \ $opts_help \ "($help)*"{-f=,--filter=}"[Filter output based on conditions provided]:filter:__docker_stack_complete_services_filters" \ + "($help)--format=[Pretty-print services using a Go template]:template: " \ "($help -q --quiet)"{-q,--quiet}"[Only display IDs]" \ "($help -):stack:__docker_complete_stacks" && ret=0 ;; @@ -2035,6 +2258,8 @@ __docker_swarm_commands() { "join:Join a swarm as a node and/or manager" "join-token:Manage join tokens" "leave:Leave a swarm" + "unlock:Unlock swarm" + "unlock-key:Manage the unlock key" "update:Update the swarm" ) _describe -t docker-swarm-commands "docker swarm command" _docker_swarm_subcommands @@ -2051,7 +2276,12 @@ __docker_swarm_subcommand() { (init) _arguments $(__docker_arguments) \ $opts_help \ - "($help)--advertise-addr[Advertised address]:ip\:port: " \ + "($help)--advertise-addr=[Advertised address]:ip\:port: " \ + "($help)--data-path-addr=[Data path IP or interface]:ip " \ + "($help)--autolock[Enable manager autolocking]" \ + "($help)--availability=[Availability of the node]:availability:(active drain pause)" \ + "($help)--cert-expiry=[Validity period for node certificates]:duration: " \ + "($help)--dispatcher-heartbeat=[Dispatcher heartbeat period]:duration: " \ "($help)*--external-ca=[Specifications of one or more certificate signing endpoints]:endpoint: " \ "($help)--force-new-cluster[Force create a new cluster from current state]" \ "($help)--listen-addr=[Listen address]:ip\:port: " \ @@ -2060,9 +2290,11 @@ __docker_swarm_subcommand() { "($help)--task-history-limit=[Task history retention limit]:limit: " && ret=0 ;; (join) - _arguments $(__docker_arguments) \ + _arguments $(__docker_arguments) -A '-*' \ $opts_help \ - "($help)--advertise-addr[Advertised address]:ip\:port: " \ + "($help)--advertise-addr=[Advertised address]:ip\:port: " \ + "($help)--data-path-addr=[Data path IP or interface]:ip " \ + "($help)--availability=[Availability of the node]:availability:(active drain pause)" \ "($help)--listen-addr=[Listen address]:ip\:port: " \ "($help)--token=[Token for entry into the swarm]:secret: " \ "($help -):host\:port: " && ret=0 @@ -2079,12 +2311,23 @@ __docker_swarm_subcommand() { $opts_help \ "($help -f --force)"{-f,--force}"[Force this node to leave the swarm, ignoring warnings]" && ret=0 ;; + (unlock) + _arguments $(__docker_arguments) \ + $opts_help && ret=0 + ;; + (unlock-key) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -q --quiet)"{-q,--quiet}"[Only display token]" \ + "($help)--rotate[Rotate unlock token]" && ret=0 + ;; (update) _arguments $(__docker_arguments) \ $opts_help \ + "($help)--autolock[Enable manager autolocking]" \ "($help)--cert-expiry=[Validity period for node certificates]:duration: " \ - "($help)*--external-ca=[Specifications of one or more certificate signing endpoints]:endpoint: " \ "($help)--dispatcher-heartbeat=[Dispatcher heartbeat period]:duration: " \ + "($help)*--external-ca=[Specifications of one or more certificate signing endpoints]:endpoint: " \ "($help)--max-snapshots[Number of additional Raft snapshots to retain]" \ "($help)--snapshot-interval[Number of log entries between Raft snapshots]" \ "($help)--task-history-limit=[Task history retention limit]:limit: " && ret=0 @@ -2142,7 +2385,9 @@ __docker_system_subcommand() { _arguments $(__docker_arguments) \ $opts_help \ "($help -a --all)"{-a,--all}"[Remove all unused data, not just dangling ones]" \ - "($help -f --force)"{-f,--force}"[Do not prompt for confirmation]" && ret=0 + "($help)*--filter=[Filter values]:filter:__docker_complete_prune_filters" \ + "($help -f --force)"{-f,--force}"[Do not prompt for confirmation]" \ + "($help)--volumes=[Remove all unused volumes]" && ret=0 ;; (help) _arguments $(__docker_arguments) ":subcommand:__docker_volume_commands" && ret=0 @@ -2253,14 +2498,9 @@ __docker_volume_subcommand() { (ls) _arguments $(__docker_arguments) \ $opts_help \ - "($help)*"{-f=,--filter=}"[Provide filter values]:filter:->filter-options" \ + "($help)*"{-f=,--filter=}"[Provide filter values]:filter:__docker_volume_complete_ls_filters" \ "($help)--format=[Pretty-print volumes using a Go template]:template: " \ "($help -q --quiet)"{-q,--quiet}"[Only display volume names]" && ret=0 - case $state in - (filter-options) - __docker_volume_complete_ls_filters && ret=0 - ;; - esac ;; (prune) _arguments $(__docker_arguments) \ @@ -2290,14 +2530,28 @@ __docker_caching_policy() { __docker_commands() { local cache_policy + integer force_invalidation=0 zstyle -s ":completion:${curcontext}:" cache-policy cache_policy if [[ -z "$cache_policy" ]]; then zstyle ":completion:${curcontext}:" cache-policy __docker_caching_policy fi - if ( [[ ${+_docker_subcommands} -eq 0 ]] || _cache_invalid docker_subcommands) \ - && ! _retrieve_cache docker_subcommands; + if ( (( ! ${+_docker_hide_legacy_commands} )) || _cache_invalid docker_hide_legacy_commands ) \ + && ! _retrieve_cache docker_hide_legacy_commands; + then + _docker_hide_legacy_commands="${DOCKER_HIDE_LEGACY_COMMANDS}" + _store_cache docker_hide_legacy_commands _docker_hide_legacy_commands + fi + + if [[ "${_docker_hide_legacy_commands}" != "${DOCKER_HIDE_LEGACY_COMMANDS}" ]]; then + force_invalidation=1 + _docker_hide_legacy_commands="${DOCKER_HIDE_LEGACY_COMMANDS}" + _store_cache docker_hide_legacy_commands _docker_hide_legacy_commands + fi + + if ( [[ ${+_docker_subcommands} -eq 0 ]] || _cache_invalid docker_subcommands ) \ + && ! _retrieve_cache docker_subcommands || [[ ${force_invalidation} -eq 1 ]]; then local -a lines lines=(${(f)"$(_call_program commands docker 2>&1)"}) @@ -2322,6 +2576,23 @@ __docker_subcommand() { (build|history|import|load|pull|push|save|tag) __docker_image_subcommand && ret=0 ;; + (checkpoint) + local curcontext="$curcontext" state + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -): :->command" \ + "($help -)*:: :->option-or-argument" && ret=0 + + case $state in + (command) + __docker_checkpoint_commands && ret=0 + ;; + (option-or-argument) + curcontext=${curcontext%:*:*}:docker-${words[-1]}: + __docker_checkpoint_subcommand && ret=0 + ;; + esac + ;; (container) local curcontext="$curcontext" state _arguments $(__docker_arguments) \ @@ -2343,6 +2614,7 @@ __docker_subcommand() { _arguments $(__docker_arguments) \ $opts_help \ "($help)*--add-runtime=[Register an additional OCI compatible runtime]:runtime:__docker_complete_runtimes" \ + "($help)*--allow-nondistributable-artifacts=[Push nondistributable artifacts to specified registries]:registry: " \ "($help)--api-cors-header=[CORS headers in the Engine API]:CORS headers: " \ "($help)*--authorization-plugin=[Authorization plugins to load]" \ "($help -b --bridge)"{-b=,--bridge=}"[Attach containers to a network bridge]:bridge:_net_interfaces" \ @@ -2353,11 +2625,13 @@ __docker_subcommand() { "($help)*--cluster-store-opt=[Cluster store options]:Cluster options:->cluster-store-options" \ "($help)--config-file=[Path to daemon configuration file]:Config File:_files" \ "($help)--containerd=[Path to containerd socket]:socket:_files -g \"*.sock\"" \ + "($help)--data-root=[Root directory of persisted Docker data]:path:_directories" \ "($help -D --debug)"{-D,--debug}"[Enable debug mode]" \ "($help)--default-gateway[Container default gateway IPv4 address]:IPv4 address: " \ "($help)--default-gateway-v6[Container default gateway IPv6 address]:IPv6 address: " \ + "($help)--default-shm-size=[Default shm size for containers]:size:" \ "($help)*--default-ulimit=[Default ulimits for containers]:ulimit: " \ - "($help)--disable-legacy-registry[Disable contacting legacy registries]" \ + "($help)--disable-legacy-registry[Disable contacting legacy registries (default true)]" \ "($help)*--dns=[DNS server to use]:DNS: " \ "($help)*--dns-opt=[DNS options to use]:DNS option: " \ "($help)*--dns-search=[DNS search domains to use]:DNS search: " \ @@ -2367,9 +2641,9 @@ __docker_subcommand() { "($help)--fixed-cidr=[IPv4 subnet for fixed IPs]:IPv4 subnet: " \ "($help)--fixed-cidr-v6=[IPv6 subnet for fixed IPs]:IPv6 subnet: " \ "($help -G --group)"{-G=,--group=}"[Group for the unix socket]:group:_groups" \ - "($help -g --graph)"{-g=,--graph=}"[Root of the Docker runtime]:path:_directories" \ "($help -H --host)"{-H=,--host=}"[tcp://host:port to bind/connect to]:host: " \ "($help)--icc[Enable inter-container communication]" \ + "($help)--init[Run an init inside containers to forward signals and reap processes]" \ "($help)--init-path=[Path to the docker-init binary]:docker-init binary:_files" \ "($help)*--insecure-registry=[Enable insecure registry communication]:registry: " \ "($help)--ip=[Default IP when binding container ports]" \ @@ -2475,6 +2749,8 @@ __docker_subcommand() { __docker_complete_nodes && ret=0 elif [[ ${words[(r)--type=plugin]} == --type=plugin ]]; then __docker_complete_plugins && ret=0 + elif [[ ${words[(r)--type=service]} == --type=secrets ]]; then + __docker_complete_secrets && ret=0 elif [[ ${words[(r)--type=service]} == --type=service ]]; then __docker_complete_services && ret=0 elif [[ ${words[(r)--type=volume]} == --type=volume ]]; then @@ -2485,6 +2761,7 @@ __docker_subcommand() { __docker_complete_networks __docker_complete_nodes __docker_complete_plugins + __docker_complete_secrets __docker_complete_services __docker_complete_volumes && ret=0 fi @@ -2492,14 +2769,15 @@ __docker_subcommand() { esac ;; (login) - _arguments $(__docker_arguments) \ + _arguments $(__docker_arguments) -A '-*' \ $opts_help \ "($help -p --password)"{-p=,--password=}"[Password]:password: " \ + "($help)--password-stdin[Read password from stdin]" \ "($help -u --user)"{-u=,--user=}"[Username]:username: " \ "($help -)1:server: " && ret=0 ;; (logout) - _arguments $(__docker_arguments) \ + _arguments $(__docker_arguments) -A '-*' \ $opts_help \ "($help -)1:server: " && ret=0 ;; @@ -2563,18 +2841,12 @@ __docker_subcommand() { __docker_image_subcommand && ret=0 ;; (search) - _arguments $(__docker_arguments) \ + _arguments $(__docker_arguments) -A '-*' \ $opts_help \ - "($help)*"{-f=,--filter=}"[Filter values]:filter:->filter-options" \ + "($help)*"{-f=,--filter=}"[Filter values]:filter:__docker_complete_search_filters" \ "($help)--limit=[Maximum returned search results]:limit:(1 5 10 25 50)" \ "($help)--no-trunc[Do not truncate output]" \ "($help -):term: " && ret=0 - - case $state in - (filter-options) - __docker_complete_search_filters && ret=0 - ;; - esac ;; (secret) local curcontext="$curcontext" state From 2bd24f7e0de0ab2fa6131f15f49d3d86f4d7f4a8 Mon Sep 17 00:00:00 2001 From: Ning Sun Date: Tue, 14 Nov 2017 08:35:55 -0600 Subject: [PATCH 0233/1083] Fixed Pacaur aliases (#6416) `pacaur -Syua` only updated AUR pakcages, wihch is incompatible with semantics of `pacupg` and `yaupg`. Removing `-a` here it would work for both main repos and aur. --- plugins/archlinux/archlinux.plugin.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/archlinux/archlinux.plugin.zsh b/plugins/archlinux/archlinux.plugin.zsh index 105bd2d5f..0fab1252b 100644 --- a/plugins/archlinux/archlinux.plugin.zsh +++ b/plugins/archlinux/archlinux.plugin.zsh @@ -28,8 +28,8 @@ if (( $+commands[yaourt] )); then fi if (( $+commands[pacaur] )); then - alias paupg='pacaur -Syua' - alias pasu='pacaur -Syua --noconfirm' + alias paupg='pacaur -Syu' + alias pasu='pacaur -Syu --noconfirm' alias pain='pacaur -S' alias pains='pacaur -U' alias pare='pacaur -R' From 510d90749f156ef5f10b656630191df13a86e989 Mon Sep 17 00:00:00 2001 From: Michael Nikitochkin Date: Tue, 14 Nov 2017 15:36:22 +0100 Subject: [PATCH 0234/1083] Fix the terraform function name (#6418) * Fix the terraform function name Current function name do worse. I always use `terr` and before those prompt it was add space in the end. Now because we have multiple functions and binaries started with terraform there are no space. * Updated terraform readme Updated the name of new function name --- plugins/terraform/README.md | 2 +- plugins/terraform/terraform.plugin.zsh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/terraform/README.md b/plugins/terraform/README.md index b39f9916b..46855e417 100644 --- a/plugins/terraform/README.md +++ b/plugins/terraform/README.md @@ -17,5 +17,5 @@ your .zsh-theme file and in a choosen place insert: ``` $FG[045]\ -$(terraform_prompt_info)\ +$(tf_prompt_info)\ ``` diff --git a/plugins/terraform/terraform.plugin.zsh b/plugins/terraform/terraform.plugin.zsh index 84eec5cc1..b170f73a6 100644 --- a/plugins/terraform/terraform.plugin.zsh +++ b/plugins/terraform/terraform.plugin.zsh @@ -1,4 +1,4 @@ -function terraform_prompt_info() { +function tf_prompt_info() { # check if in terraform dir if [ -d .terraform ]; then workspace=$(terraform workspace show 2> /dev/null) || return From d792b1114c570ec1520ba7696c5c110d10cea41c Mon Sep 17 00:00:00 2001 From: catull Date: Tue, 14 Nov 2017 15:36:53 +0100 Subject: [PATCH 0235/1083] With zsh 5.4 a simple "local FLAGS" meant as an array must be explicitly declared so. This fix avoids the dreaded "parse_git_dirty:3: FLAGS: attempt to assign array value to non-array". (#6414) --- lib/git.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/git.zsh b/lib/git.zsh index f7eccb81d..167b4b0ea 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -11,7 +11,7 @@ function git_prompt_info() { # Checks if working tree is dirty function parse_git_dirty() { local STATUS='' - local FLAGS + local -a FLAGS FLAGS=('--porcelain') if [[ "$(command git config --get oh-my-zsh.hide-dirty)" != "1" ]]; then if [[ $POST_1_7_2_GIT -gt 0 ]]; then From e273cf004e1ff0510aee61416885f3003bcd15d9 Mon Sep 17 00:00:00 2001 From: Brandon Weaver Date: Tue, 14 Nov 2017 06:37:31 -0800 Subject: [PATCH 0236/1083] Update ruby.plugin.zsh (#2117) Added some Gem command shorthands, and ruby shorthand --- plugins/ruby/ruby.plugin.zsh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/plugins/ruby/ruby.plugin.zsh b/plugins/ruby/ruby.plugin.zsh index 38e4d7cd0..177b35b31 100644 --- a/plugins/ruby/ruby.plugin.zsh +++ b/plugins/ruby/ruby.plugin.zsh @@ -4,3 +4,11 @@ alias sgem='sudo gem' # Find ruby file alias rfind='find . -name "*.rb" | xargs grep -n' + +# Shorthand Ruby +alias rb="ruby" + +# Gem Command Shorthands +alias gin="gem install" +alias gun="gem uninstall" +alias gli="gem list" From 2af2d1aa31caa534c419e72d75daa667ff725de2 Mon Sep 17 00:00:00 2001 From: kg Date: Tue, 5 Dec 2017 07:08:07 +0800 Subject: [PATCH 0237/1083] add autocomplete for adb -s option (#6121) --- plugins/adb/README.md | 2 +- plugins/adb/_adb | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/plugins/adb/README.md b/plugins/adb/README.md index 075beec0e..83dcc7288 100644 --- a/plugins/adb/README.md +++ b/plugins/adb/README.md @@ -1,7 +1,7 @@ # adb autocomplete plugin * Adds autocomplete options for all adb commands. - +* Add autocomplete for `adb -s` ## Requirements diff --git a/plugins/adb/_adb b/plugins/adb/_adb index 5f37bedac..2e3c3658e 100644 --- a/plugins/adb/_adb +++ b/plugins/adb/_adb @@ -43,11 +43,20 @@ local expl local -a pkgs installed_pkgs _arguments \ + '-s[devices]:specify device:->specify_device' \ '*:: :->subcmds' && return 0 +case "$state" in + specify_device) + _values 'devices' $(adb devices|awk 'NR>1&& $1 ~ /^[a-zA-Z0-9].*$/ \ + {printf "%s[Device_%d:%s] ",$1,++i,$2 }') + return + ;; +esac + if (( CURRENT == 1 )); then _describe -t commands "adb subcommand" _1st_arguments return fi -_files +_files \ No newline at end of file From e999f104e74039b291070af435a494a88eb7d704 Mon Sep 17 00:00:00 2001 From: kg Date: Fri, 8 Dec 2017 07:52:52 +0800 Subject: [PATCH 0238/1083] Update adb (#6472) --- plugins/adb/_adb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/adb/_adb b/plugins/adb/_adb index 2e3c3658e..8cbf6593c 100644 --- a/plugins/adb/_adb +++ b/plugins/adb/_adb @@ -48,8 +48,8 @@ _arguments \ case "$state" in specify_device) - _values 'devices' $(adb devices|awk 'NR>1&& $1 ~ /^[a-zA-Z0-9].*$/ \ - {printf "%s[Device_%d:%s] ",$1,++i,$2 }') + _values 'devices' $(adb devices -l|awk 'NR>1&& $1 ~ /^[a-zA-Z0-9].*$/ \ + {printf "%s[%s] ",$1,$6 }') return ;; esac From a7fb55cf13bd5956a183e42916cf160a962b6370 Mon Sep 17 00:00:00 2001 From: yongxin SHI Date: Fri, 8 Dec 2017 07:53:10 +0800 Subject: [PATCH 0239/1083] add pip --user (#6470) --- plugins/pip/_pip | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/pip/_pip b/plugins/pip/_pip index 732ffabea..607f68e58 100644 --- a/plugins/pip/_pip +++ b/plugins/pip/_pip @@ -72,6 +72,7 @@ case "$words[1]" in install) _arguments \ '(-U --upgrade)'{-U,--upgrade}'[upgrade all packages to the newest available version]' \ + '(--user)--user[install packages to user home]' \ '(-f --find-links)'{-f,--find-links}'[URL for finding packages]' \ '(-r --requirement)'{-r,--requirement}'[Requirements file for packages to install]:File:_files' \ '(--no-deps --no-dependencies)'{--no-deps,--no-dependencies}'[iIgnore package dependencies]' \ From c3b072eace1ce19a48e36c2ead5932ae2d2e06d9 Mon Sep 17 00:00:00 2001 From: Harish Narayanan Date: Thu, 14 Dec 2017 16:01:32 +0000 Subject: [PATCH 0240/1083] Replace spotify command in the osx plugin with a more recent copy of the upstream project (#6419) * Remove older shpotify code from the macOS plugin * Add Shpotify 2.0.1 from the upstream repository at https://github.com/hnarayanan/shpotify/releases/tag/2.0.1 * Wrap the Shpotify script in a function and import into the macOS plugin * Fix import path of the shpotify script * Add shpotify permission notice in the macos plugin rREADME * Merge with the upstream shpotify project - Fix playlist playback - Add a 'stop' command --- plugins/osx/README.md | 27 +++ plugins/osx/osx.plugin.zsh | 267 +--------------------- plugins/osx/spotify | 438 +++++++++++++++++++++++++++++++++++++ 3 files changed, 466 insertions(+), 266 deletions(-) create mode 100644 plugins/osx/spotify diff --git a/plugins/osx/README.md b/plugins/osx/README.md index b77daecc5..d3a8f94df 100644 --- a/plugins/osx/README.md +++ b/plugins/osx/README.md @@ -12,6 +12,33 @@ plugins=(... osx) Original author: [Sorin Ionescu](https://github.com/sorin-ionescu) +## Acknowledgements + +This application makes use of the following third party scripts: + +[shpotify](https://github.com/hnarayanan/shpotify) + +Copyright (c) 2012–2017 [Harish Narayanan](https://harishnarayanan.org/). + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + ## Commands diff --git a/plugins/osx/osx.plugin.zsh b/plugins/osx/osx.plugin.zsh index e8488ebc9..b7d6aca72 100644 --- a/plugins/osx/osx.plugin.zsh +++ b/plugins/osx/osx.plugin.zsh @@ -277,272 +277,7 @@ EOF } # Spotify control function -function spotify() { - - showHelp () { - echo "Usage:"; - echo; - echo " $(basename "$0") "; - echo; - echo "Commands:"; - echo; - echo " play # Resumes playback where Spotify last left off."; - echo " play [song name] # Finds a song by name and plays it."; - echo " play album [album name] # Finds an album by name and plays it."; - echo " play artist [artist name] # Finds an artist by name and plays it."; - echo " play list [playlist name] # Finds a playlist by name and plays it."; - echo " pause # Pauses Spotify playback."; - echo " next # Skips to the next song in a playlist."; - echo " prev # Returns to the previous song in a playlist."; - echo " pos [time] # Jumps to a time (in secs) in the current song."; - echo " quit # Stops playback and quits Spotify."; - echo; - echo " vol up # Increases the volume by 10%."; - echo " vol down # Decreases the volume by 10%."; - echo " vol [amount] # Sets the volume to an amount between 0 and 100."; - echo " vol show # Shows the current Spotify volume."; - echo; - echo " status # Shows the current player status."; - echo " share # Copies the current song URL to the clipboard." - echo " info # Shows Full Information about song that is playing."; - echo; - echo " toggle shuffle # Toggles shuffle playback mode."; - echo " toggle repeat # Toggles repeat playback mode."; - } - - cecho(){ - bold=$(tput bold); - green=$(tput setaf 2); - reset=$(tput sgr0); - echo "$bold$green$1$reset"; - } - - showStatus () { - state=$(osascript -e 'tell application "Spotify" to player state as string'); - cecho "Spotify is currently $state."; - if [ "$state" = "playing" ]; then - artist=$(osascript -e 'tell application "Spotify" to artist of current track as string'); - album=$(osascript -e 'tell application "Spotify" to album of current track as string'); - track=$(osascript -e 'tell application "Spotify" to name of current track as string'); - duration=$(osascript -e 'tell application "Spotify" to duration of current track as string'); - duration=$(echo "scale=2; $duration / 60 / 1000" | bc); - position=$(osascript -e 'tell application "Spotify" to player position as string' | tr ',' '.'); - position=$(echo "scale=2; $position / 60" | bc | awk '{printf "%0.2f", $0}'); - - printf "$reset""Artist: %s\nAlbum: %s\nTrack: %s \nPosition: %s / %s\n" "$artist" "$album" "$track" "$position" "$duration"; - fi - } - - - - if [ $# = 0 ]; then - showHelp; - else - if [ "$1" != "quit" ] && [ "$(osascript -e 'application "Spotify" is running')" = "false" ]; then - osascript -e 'tell application "Spotify" to activate' - sleep 2 - fi - fi - - while [ $# -gt 0 ]; do - arg=$1; - - case $arg in - "play" ) - if [ $# != 1 ]; then - # There are additional arguments, so find out how many - array=( $@ ); - len=${#array[@]}; - SPOTIFY_SEARCH_API="https://api.spotify.com/v1/search" - SPOTIFY_PLAY_URI=""; - - searchAndPlay() { - type="$1" - Q="$2" - - cecho "Searching ${type}s for: $Q"; - - SPOTIFY_PLAY_URI=$( \ - curl -s -G $SPOTIFY_SEARCH_API --data-urlencode "q=$Q" -d "type=$type&limit=1&offset=0" -H "Accept: application/json" \ - | grep -E -o "spotify:$type:[a-zA-Z0-9]+" -m 1 - ) - } - - case $2 in - "list" ) - _args=${array[*]:2:$len}; - Q=$_args; - - cecho "Searching playlists for: $Q"; - - results=$( \ - curl -s -G $SPOTIFY_SEARCH_API --data-urlencode "q=$Q" -d "type=playlist&limit=10&offset=0" -H "Accept: application/json" \ - | grep -E -o "spotify:user:[a-zA-Z0-9_]+:playlist:[a-zA-Z0-9]+" -m 10 \ - ) - - count=$( \ - echo "$results" | grep -c "spotify:user" \ - ) - - if [ "$count" -gt 0 ]; then - random=$(( RANDOM % count)); - - SPOTIFY_PLAY_URI=$( \ - echo "$results" | awk -v random="$random" '/spotify:user:[a-zA-Z0-9]+:playlist:[a-zA-Z0-9]+/{i++}i==random{print; exit}' \ - ) - fi;; - - "album" | "artist" | "track" ) - _args=${array[*]:2:$len}; - searchAndPlay "$2" "$_args";; - - * ) - _args=${array[*]:1:$len}; - searchAndPlay track "$_args";; - esac - - if [ "$SPOTIFY_PLAY_URI" != "" ]; then - cecho "Playing ($Q Search) -> Spotify URL: $SPOTIFY_PLAY_URI"; - - osascript -e "tell application \"Spotify\" to play track \"$SPOTIFY_PLAY_URI\""; - - else - cecho "No results when searching for $Q"; - fi - else - # play is the only param - cecho "Playing Spotify."; - osascript -e 'tell application "Spotify" to play'; - fi - break ;; - - "pause" ) - state=$(osascript -e 'tell application "Spotify" to player state as string'); - if [ "$state" = "playing" ]; then - cecho "Pausing Spotify."; - else - cecho "Playing Spotify."; - fi - - osascript -e 'tell application "Spotify" to playpause'; - break ;; - - "quit" ) - if [ "$(osascript -e 'application "Spotify" is running')" = "false" ]; then - cecho "Spotify was not running." - else - cecho "Closing Spotify."; - osascript -e 'tell application "Spotify" to quit'; - fi - break ;; - - "next" ) - cecho "Going to next track." ; - osascript -e 'tell application "Spotify" to next track'; - break ;; - - "prev" ) - cecho "Going to previous track."; - osascript -e 'tell application "Spotify" to previous track'; - break ;; - - "vol" ) - vol=$(osascript -e 'tell application "Spotify" to sound volume as integer'); - if [[ "$2" = "show" || "$2" = "" ]]; then - cecho "Current Spotify volume level is $vol."; - break ; - elif [ "$2" = "up" ]; then - if [ "$vol" -le 90 ]; then - newvol=$(( vol+10 )); - cecho "Increasing Spotify volume to $newvol."; - else - newvol=100; - cecho "Spotify volume level is at max."; - fi - elif [ "$2" = "down" ]; then - if [ "$vol" -ge 10 ]; then - newvol=$(( vol-10 )); - cecho "Reducing Spotify volume to $newvol."; - else - newvol=0; - cecho "Spotify volume level is at min."; - fi - elif [ "$2" -ge 0 ]; then - newvol=$2; - fi - - osascript -e "tell application \"Spotify\" to set sound volume to $newvol"; - break ;; - - "toggle" ) - if [ "$2" = "shuffle" ]; then - osascript -e 'tell application "Spotify" to set shuffling to not shuffling'; - curr=$(osascript -e 'tell application "Spotify" to shuffling'); - cecho "Spotify shuffling set to $curr"; - elif [ "$2" = "repeat" ]; then - osascript -e 'tell application "Spotify" to set repeating to not repeating'; - curr=$(osascript -e 'tell application "Spotify" to repeating'); - cecho "Spotify repeating set to $curr"; - fi - break ;; - - "pos" ) - cecho "Adjusting Spotify play position." - osascript -e "tell application \"Spotify\" to set player position to $2"; - break ;; - - "status" ) - showStatus; - break ;; - - "info" ) - info=$(osascript -e 'tell application "Spotify" - set tM to round (duration of current track / 60) rounding down - set tS to duration of current track mod 60 - set pos to player position as text - set myTime to tM as text & "min " & tS as text & "s" - set nM to round (player position / 60) rounding down - set nS to round (player position mod 60) rounding down - set nowAt to nM as text & "min " & nS as text & "s" - set info to "" & "\nArtist: " & artist of current track - set info to info & "\nTrack: " & name of current track - set info to info & "\nAlbum Artist: " & album artist of current track - set info to info & "\nAlbum: " & album of current track - set info to info & "\nSeconds: " & duration of current track - set info to info & "\nSeconds played: " & pos - set info to info & "\nDuration: " & mytime - set info to info & "\nNow at: " & nowAt - set info to info & "\nPlayed Count: " & played count of current track - set info to info & "\nTrack Number: " & track number of current track - set info to info & "\nPopularity: " & popularity of current track - set info to info & "\nId: " & id of current track - set info to info & "\nSpotify URL: " & spotify url of current track - set info to info & "\nArtwork: " & artwork of current track - set info to info & "\nPlayer: " & player state - set info to info & "\nVolume: " & sound volume - set info to info & "\nShuffle: " & shuffling - set info to info & "\nRepeating: " & repeating - end tell - return info') - echo "$info"; - break ;; - - "share" ) - url=$(osascript -e 'tell application "Spotify" to spotify url of current track'); - remove='spotify:track:' - url=${url#$remove} - url="http://open.spotify.com/track/$url" - cecho "Share URL: $url"; - cecho -n "$url" | pbcopy - break;; - - -h|--help| *) - showHelp; - break ;; - esac - done -} - +source ${ZSH}/plugins/osx/spotify # Show/hide hidden files in the Finder alias showfiles="defaults write com.apple.finder AppleShowAllFiles -bool true && killall Finder" diff --git a/plugins/osx/spotify b/plugins/osx/spotify new file mode 100644 index 000000000..69f6c5419 --- /dev/null +++ b/plugins/osx/spotify @@ -0,0 +1,438 @@ +#!/usr/bin/env bash + +function spotify() { +# Copyright (c) 2012--2017 Harish Narayanan +# +# Contains numerous helpful contributions from Jorge Colindres, Thomas +# Pritchard, iLan Epstein, Gabriele Bonetti, Sean Heller, Eric Martin +# and Peter Fonseca. + +# Permission is hereby granted, free of charge, to any person +# obtaining a copy of this software and associated documentation files +# (the "Software"), to deal in the Software without restriction, +# including without limitation the rights to use, copy, modify, merge, +# publish, distribute, sublicense, and/or sell copies of the Software, +# and to permit persons to whom the Software is furnished to do so, +# subject to the following conditions: + +# The above copyright notice and this permission notice shall be +# included in all copies or substantial portions of the Software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS +# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +USER_CONFIG_DEFAULTS="CLIENT_ID=\"\"\nCLIENT_SECRET=\"\""; +USER_CONFIG_FILE="${HOME}/.shpotify.cfg"; +if ! [[ -f "${USER_CONFIG_FILE}" ]]; then + touch "${USER_CONFIG_FILE}"; + echo -e "${USER_CONFIG_DEFAULTS}" > "${USER_CONFIG_FILE}"; +fi +source "${USER_CONFIG_FILE}"; + +showAPIHelp() { + echo; + echo "Connecting to Spotify's API:"; + echo; + echo " This command line application needs to connect to Spotify's API in order to"; + echo " find music by name. It is very likely you want this feature!"; + echo; + echo " To get this to work, you need to sign up (or in) and create an 'Application' at:"; + echo " https://developer.spotify.com/my-applications/#!/applications/create"; + echo; + echo " Once you've created an application, find the 'Client ID' and 'Client Secret'"; + echo " values, and enter them into your shpotify config file at '${USER_CONFIG_FILE}'"; + echo; + echo " Be sure to quote your values and don't add any extra spaces!"; + echo " When done, it should look like this (but with your own values):"; + echo ' CLIENT_ID="abc01de2fghijk345lmnop"'; + echo ' CLIENT_SECRET="qr6stu789vwxyz"'; +} + +showHelp () { + echo "Usage:"; + echo; + echo " `basename $0` "; + echo; + echo "Commands:"; + echo; + echo " play # Resumes playback where Spotify last left off."; + echo " play # Finds a song by name and plays it."; + echo " play album # Finds an album by name and plays it."; + echo " play artist # Finds an artist by name and plays it."; + echo " play list # Finds a playlist by name and plays it."; + echo " play uri # Play songs from specific uri."; + echo; + echo " next # Skips to the next song in a playlist."; + echo " prev # Returns to the previous song in a playlist."; + echo " replay # Replays the current track from the begining."; + echo " pos