From e9793fc1995254172338bc53082d704b22d31a0d Mon Sep 17 00:00:00 2001 From: Luis Ferrer-Labarca Date: Mon, 19 Sep 2016 22:50:16 -0400 Subject: [PATCH 01/19] Added 'gbd' alias for 'git branch -d' (#5417) --- 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 6197c234..25da0350 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -46,6 +46,7 @@ alias gapa='git add --patch' alias gb='git branch' alias gba='git branch -a' +alias gbd='git branch -d' alias gbda='git branch --no-color --merged | command grep -vE "^(\*|\s*(master|develop|dev)\s*$)" | command xargs -n 1 git branch -d' alias gbl='git blame -b -w' alias gbnm='git branch --no-merged' From 836fe3138552defff447ebd50271225d29bae91c Mon Sep 17 00:00:00 2001 From: Mohnish G J Date: Tue, 20 Sep 2016 08:21:50 +0530 Subject: [PATCH 02/19] Add an alias for Rails console sandbox (#5316) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The command ‘rails console —sandbox’ loads our Rails application, connects to the database and automatically starts a database transaction. All database operations performed within this console session are rolled back upon leaving the console. Reference - https://www.codeschool.com/blog/2014/06/17/rails-console-sandbox/ --- plugins/rails/rails.plugin.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/rails/rails.plugin.zsh b/plugins/rails/rails.plugin.zsh index e532639b..c8974b5f 100644 --- a/plugins/rails/rails.plugin.zsh +++ b/plugins/rails/rails.plugin.zsh @@ -36,6 +36,7 @@ alias -g RET='RAILS_ENV=test' # Rails aliases alias rc='rails console' +alias rcs='rails console --sandbox' alias rd='rails destroy' alias rdb='rails dbconsole' alias rg='rails generate' From 63d300edb04e1c2c2eea888f3085836bc9b580f7 Mon Sep 17 00:00:00 2001 From: Mohammad Mahdi Rahimi Date: Tue, 20 Sep 2016 07:26:12 +0430 Subject: [PATCH 03/19] Spotify Controller (#5356) * initial spotify control * volume up/down added * add info, share and status option * add color echo * change pause to play/pause * add Search Option for album,artist and tracks * add search option for playlist * fix showStatus output * complete help * readme updated * seach show Url of song --- plugins/osx/README.md | 1 + plugins/osx/osx.plugin.zsh | 264 +++++++++++++++++++++++++++++++++++++ 2 files changed, 265 insertions(+) diff --git a/plugins/osx/README.md b/plugins/osx/README.md index 0fcd23dd..b77daecc 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.| diff --git a/plugins/osx/osx.plugin.zsh b/plugins/osx/osx.plugin.zsh index a3e55097..aa6a256c 100644 --- a/plugins/osx/osx.plugin.zsh +++ b/plugins/osx/osx.plugin.zsh @@ -261,6 +261,270 @@ 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 " 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" "$artist" "$album" "$track" "$position" "$duration"; + fi + } + + + + 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" ) + 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" ) + cecho "Quitting Spotify."; + osascript -e 'tell application "Spotify" to quit'; + exit 1 ;; + + "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 +} + + # 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 cb60cfc7bdc7745dd48afe265df3a13f9cd3e54d Mon Sep 17 00:00:00 2001 From: Ariel Rivas Date: Mon, 19 Sep 2016 23:57:51 -0300 Subject: [PATCH 04/19] Avoid unnecesary processing... (#5352) by discarding directories or files with permissions already correctly set --- plugins/perms/perms.plugin.zsh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/plugins/perms/perms.plugin.zsh b/plugins/perms/perms.plugin.zsh index 81f56d57..7cdebab7 100644 --- a/plugins/perms/perms.plugin.zsh +++ b/plugins/perms/perms.plugin.zsh @@ -6,10 +6,10 @@ ### Aliases # Set all files' permissions to 644 recursively in a directory -alias set644='find . -type f -print0 | xargs -0 chmod 644' +alias set644='find . -type f ! -perm 644 -print0 | xargs -0 chmod 644' # Set all directories' permissions to 755 recursively in a directory -alias set755='find . -type d -print0 | xargs -0 chmod 755' +alias set755='find . -type d ! -perm 755 -print0 | xargs -0 chmod 755' ### Functions @@ -63,14 +63,14 @@ EOF exit_status=0; if [[ $use_slow == true ]]; then # Process directories first so non-traversable ones are fixed as we go - find "$target" -type d -exec chmod $chmod_opts 755 {} \; + find "$target" -type d ! -perm 755 -exec chmod $chmod_opts 755 {} \; if [[ $? != 0 ]]; then exit_status=$?; fi - find "$target" -type f -exec chmod $chmod_opts 644 {} \; + find "$target" -type f ! -perm 644 -exec chmod $chmod_opts 644 {} \; if [[ $? != 0 ]]; then exit_status=$?; fi else - find "$target" -type d -print0 | xargs -0 chmod $chmod_opts 755 + find "$target" -type d ! -perm 755 -print0 | xargs -0 chmod $chmod_opts 755 if [[ $? != 0 ]]; then exit_status=$?; fi - find "$target" -type f -print0 | xargs -0 chmod $chmod_opts 644 + find "$target" -type f ! -perm 644 -print0 | xargs -0 chmod $chmod_opts 644 if [[ $? != 0 ]]; then exit_status=$?; fi fi echo "Complete" From 83765bf3f7c5e92c9141a03d9791638f7eb68277 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabi=C3=A1n=20R=C3=ADos?= Date: Tue, 20 Sep 2016 04:58:45 +0200 Subject: [PATCH 05/19] missing listing and versions (#5341) versions is missing list is missing --- plugins/npm/npm.plugin.zsh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/plugins/npm/npm.plugin.zsh b/plugins/npm/npm.plugin.zsh index 02e4f3e9..43aedc36 100644 --- a/plugins/npm/npm.plugin.zsh +++ b/plugins/npm/npm.plugin.zsh @@ -32,6 +32,12 @@ alias npmE='PATH="$(npm bin)":"$PATH"' # Check which npm modules are outdated alias npmO="npm outdated" +# Check package versions +alias npmV="npm -v" + +# List packages +alias npmL="npm list" + # Run npm start alias npmst="npm start" From fb8953d525ddd3ed01db02a266b284bd9fa5fbd2 Mon Sep 17 00:00:00 2001 From: Matt Nichols Date: Mon, 19 Sep 2016 21:00:16 -0600 Subject: [PATCH 06/19] Fix peepcode theme ruby prompt info (#5339) The ruby prompt info was not interpolating properly. Switching to use ruby_prompt_info helper. This addresses the issue. --- themes/peepcode.zsh-theme | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/themes/peepcode.zsh-theme b/themes/peepcode.zsh-theme index 9dc58294..b6dfa687 100644 --- a/themes/peepcode.zsh-theme +++ b/themes/peepcode.zsh-theme @@ -41,10 +41,4 @@ PROMPT=' %~ ${smiley} %{$reset_color%}' -if [[ -d ~/.rvm ]] && [[ -e ~/.rvm/bin/rvm-prompt ]]; then - rvm_prompt='$(~/.rvm/bin/rvm-prompt)' -else - rvm_prompt='' -fi - -RPROMPT='%{$fg[white]%} $rvm_prompt$(git_prompt)%{$reset_color%}' +RPROMPT='%{$fg[white]%} $(ruby_prompt_info)$(git_prompt)%{$reset_color%}' From d1ce70f68540bdf6a7f27ab9879e8222d0e7a604 Mon Sep 17 00:00:00 2001 From: grindhold Date: Tue, 20 Sep 2016 05:00:42 +0200 Subject: [PATCH 07/19] added support for bazaar in agnoster theme (#5016) the agnoster theme is now able to render basic information if the user is currently residing inside a bazaar folder. if so, it will render a green promt segment with "bzr" and the current revision number in it. if there are untracked files, the bar will be rendered in yellow. if there are changes to already tracked files, a + character will be printed. --- themes/agnoster.zsh-theme | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/themes/agnoster.zsh-theme b/themes/agnoster.zsh-theme index da1f9b6e..e1a294ee 100644 --- a/themes/agnoster.zsh-theme +++ b/themes/agnoster.zsh-theme @@ -127,6 +127,27 @@ prompt_git() { fi } +prompt_bzr() { + if (bzr status >/dev/null 2>&1); then + status_mod=`bzr status | head -n1 | grep "modified" | wc -m` + status_all=`bzr status | head -n1 | wc -m` + revision=`bzr log | head -n2 | tail -n1 | sed 's/^revno: //'` + if [[ $status_mod -gt 0 ]] ; then + prompt_segment yellow black + echo -n "bzr@"$revision "✚ " + else + if [[ $status_all -gt 0 ]] ; then + prompt_segment yellow black + echo -n "bzr@"$revision + + else + prompt_segment green black + echo -n "bzr@"$revision + fi + fi + fi +} + prompt_hg() { (( $+commands[hg] )) || return local rev status @@ -198,6 +219,7 @@ build_prompt() { prompt_context prompt_dir prompt_git + prompt_bzr prompt_hg prompt_end } From 9d91e92f26e3cb2d89eb43065ad960e4a344d52c Mon Sep 17 00:00:00 2001 From: Brian Goff Date: Tue, 20 Sep 2016 14:40:07 -0400 Subject: [PATCH 08/19] Update docker completion to match docker upstream (#5060) See https://github.com/docker/docker/blob/master/contrib/completion/zsh/_docker Signed-off-by: Brian Goff --- plugins/docker/_docker | 58 ++++++++++-------------------------------- 1 file changed, 14 insertions(+), 44 deletions(-) diff --git a/plugins/docker/_docker b/plugins/docker/_docker index 66dfeea9..55437924 100644 --- a/plugins/docker/_docker +++ b/plugins/docker/_docker @@ -138,7 +138,7 @@ __docker_containers_names() { __docker_get_containers all names "$@" } -__docker_complete_info_plugins() { +__docker_plugins() { [[ $PREFIX = -* ]] && return 1 integer ret=1 emulate -L zsh @@ -228,7 +228,7 @@ __docker_get_log_options() { journald_options=("env" "labels" "tag") json_file_options=("env" "labels" "max-file" "max-size") 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-index" "splunk-insecureskipverify" "splunk-source" "splunk-sourcetype" "splunk-token" "splunk-url" "splunk-verify-connection" "tag") + splunk_options=("env" "labels" "splunk-caname" "splunk-capath" "splunk-index" "splunk-insecureskipverify" "splunk-source" "splunk-sourcetype" "splunk-token" "splunk-url" "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 @@ -340,7 +340,7 @@ __docker_complete_ps_filters() { __docker_networks && ret=0 ;; (status) - status_opts=('created' 'dead' 'exited' 'paused' 'restarting' 'running' 'removing') + status_opts=('created' 'dead' 'exited' 'paused' 'restarting' 'running') _describe -t status-filter-opts "Status Filter Options" status_opts && ret=0 ;; (volume) @@ -463,8 +463,6 @@ __docker_complete_events_filter() { return ret } -# BO network - __docker_network_complete_ls_filters() { [[ $PREFIX = -* ]] && return 1 integer ret=1 @@ -472,7 +470,7 @@ __docker_network_complete_ls_filters() { if compset -P '*='; then case "${${words[-1]%=*}#*=}" in (driver) - __docker_complete_info_plugins Network && ret=0 + __docker_plugins Network && ret=0 ;; (id) __docker_networks_ids && ret=0 @@ -631,7 +629,6 @@ __docker_network_subcommand() { $opts_help \ "($help)--no-trunc[Do not truncate the output]" \ "($help)*"{-f=,--filter=}"[Provide filter values]:filter:->filter-options" \ - "($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) @@ -652,8 +649,6 @@ __docker_network_subcommand() { return ret } -# EO network - # BO node __docker_node_complete_ls_filters() { @@ -721,6 +716,7 @@ __docker_nodes() { [[ $filter != "none" ]] && args=("-f $filter") lines=(${(f)"$(_call_program commands docker $docker_options node ls $args)"}) + # Parse header line to find columns local i=1 j=1 k header=${lines[1]} declare -A begin end @@ -846,7 +842,6 @@ __docker_node_subcommand() { "($help -a --all)"{-a,--all}"[Display all instances]" \ "($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 case $state in (filter-options) @@ -1162,7 +1157,6 @@ __docker_service_subcommand() { "($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 -)1:service:__docker_complete_services" && ret=0 case $state in (filter-options) @@ -1256,8 +1250,6 @@ __docker_swarm_subcommand() { # EO swarm -# BO volume - __docker_volume_complete_ls_filters() { [[ $PREFIX = -* ]] && return 1 integer ret=1 @@ -1269,7 +1261,7 @@ __docker_volume_complete_ls_filters() { _describe -t dangling-filter-opts "Dangling Filter Options" dangling_opts && ret=0 ;; (driver) - __docker_complete_info_plugins Volume && ret=0 + __docker_plugins Volume && ret=0 ;; (name) __docker_volumes && ret=0 @@ -1279,7 +1271,7 @@ __docker_volume_complete_ls_filters() { ;; esac else - opts=('dangling' 'driver' 'label' 'name') + opts=('dangling' 'driver' 'name') _describe -t filter-opts "Filter Options" opts -qS "=" && ret=0 fi @@ -1338,12 +1330,12 @@ __docker_volume_subcommand() { case "$words[1]" in (create) - _arguments $(__docker_arguments) -A '-*' \ + _arguments $(__docker_arguments) \ $opts_help \ "($help -d --driver)"{-d=,--driver=}"[Volume driver name]:Driver name:(local)" \ "($help)*--label=[Set metadata for a volume]:label=value: " \ - "($help)*"{-o=,--opt=}"[Driver specific options]:Driver option: " \ - "($help -)1:Volume name: " && ret=0 + "($help)--name=[Volume name]" \ + "($help)*"{-o=,--opt=}"[Driver specific options]:Driver option: " && ret=0 ;; (inspect) _arguments $(__docker_arguments) \ @@ -1355,7 +1347,6 @@ __docker_volume_subcommand() { _arguments $(__docker_arguments) \ $opts_help \ "($help)*"{-f=,--filter=}"[Provide filter values]:filter:->filter-options" \ - "($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) @@ -1366,7 +1357,6 @@ __docker_volume_subcommand() { (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) @@ -1377,8 +1367,6 @@ __docker_volume_subcommand() { return ret } -# EO volume - __docker_caching_policy() { oldp=( "$1"(Nmh+1) ) # 1 hour (( $#oldp )) @@ -1701,7 +1689,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 containers using a Go template]:template: " \ + "($help)--format[Pretty-print containers using a Go template]:format: " \ "($help)--no-trunc[Do not truncate output]" \ "($help -q --quiet)"{-q,--quiet}"[Only show numeric IDs]" \ "($help -): :__docker_repositories" && ret=0 @@ -1722,8 +1710,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 + $opts_help && ret=0 ;; (inspect) local state @@ -1819,23 +1806,6 @@ __docker_subcommand() { $opts_help \ "($help -)*:containers:__docker_runningcontainers" && ret=0 ;; - (plugin) - local curcontext="$curcontext" state - _arguments $(__docker_arguments) \ - $opts_help \ - "($help -): :->command" \ - "($help -)*:: :->option-or-argument" && ret=0 - - case $state in - (command) - __docker_plugin_commands && ret=0 - ;; - (option-or-argument) - curcontext=${curcontext%:*:*}:docker-${words[-1]}: - __docker_plugin_subcommand && ret=0 - ;; - esac - ;; (port) _arguments $(__docker_arguments) \ $opts_help \ @@ -1848,9 +1818,9 @@ __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]:format: " \ "($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)-n[Show n last created containers, include non-running one]: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]" \ From f39dcfda8d287bdfeda2bc1e0a7ab3785c6e4a73 Mon Sep 17 00:00:00 2001 From: Zach Himsel Date: Tue, 20 Sep 2016 10:40:54 -0600 Subject: [PATCH 09/19] Update docker completion from upstream (#5426) https://github.com/docker/docker/blob/be9e3f59e625a7be05f21a23f6debfb3f6728573/contrib/completion/zsh/_docker --- plugins/docker/_docker | 67 +++++++++++++++++++++++++++++++----------- 1 file changed, 50 insertions(+), 17 deletions(-) diff --git a/plugins/docker/_docker b/plugins/docker/_docker index 55437924..1366fd61 100644 --- a/plugins/docker/_docker +++ b/plugins/docker/_docker @@ -138,7 +138,7 @@ __docker_containers_names() { __docker_get_containers all names "$@" } -__docker_plugins() { +__docker_complete_info_plugins() { [[ $PREFIX = -* ]] && return 1 integer ret=1 emulate -L zsh @@ -228,7 +228,7 @@ __docker_get_log_options() { journald_options=("env" "labels" "tag") json_file_options=("env" "labels" "max-file" "max-size") 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-index" "splunk-insecureskipverify" "splunk-source" "splunk-sourcetype" "splunk-token" "splunk-url" "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") [[ $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 @@ -340,7 +340,7 @@ __docker_complete_ps_filters() { __docker_networks && ret=0 ;; (status) - status_opts=('created' 'dead' 'exited' 'paused' 'restarting' 'running') + status_opts=('created' 'dead' 'exited' 'paused' 'restarting' 'running' 'removing') _describe -t status-filter-opts "Status Filter Options" status_opts && ret=0 ;; (volume) @@ -434,7 +434,7 @@ __docker_complete_events_filter() { (event) local -a event_opts event_opts=('attach' 'commit' 'connect' 'copy' 'create' 'delete' 'destroy' 'detach' 'die' 'disconnect' 'exec_create' 'exec_detach' - 'exec_start' 'export' 'import' 'kill' 'load' 'mount' 'oom' 'pause' 'pull' 'push' 'reload' 'rename' 'resize' 'restart' 'save' 'start' + 'exec_start' 'export' 'health_status' 'import' 'kill' 'load' 'mount' 'oom' 'pause' 'pull' 'push' 'reload' 'rename' 'resize' 'restart' 'save' 'start' 'stop' 'tag' 'top' 'unmount' 'unpause' 'untag' 'update') _describe -t event-filter-opts "event filter options" event_opts && ret=0 ;; @@ -463,6 +463,8 @@ __docker_complete_events_filter() { return ret } +# BO network + __docker_network_complete_ls_filters() { [[ $PREFIX = -* ]] && return 1 integer ret=1 @@ -470,7 +472,7 @@ __docker_network_complete_ls_filters() { if compset -P '*='; then case "${${words[-1]%=*}#*=}" in (driver) - __docker_plugins Network && ret=0 + __docker_complete_info_plugins Network && ret=0 ;; (id) __docker_networks_ids && ret=0 @@ -629,6 +631,7 @@ __docker_network_subcommand() { $opts_help \ "($help)--no-trunc[Do not truncate the output]" \ "($help)*"{-f=,--filter=}"[Provide filter values]:filter:->filter-options" \ + "($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) @@ -649,6 +652,8 @@ __docker_network_subcommand() { return ret } +# EO network + # BO node __docker_node_complete_ls_filters() { @@ -716,7 +721,6 @@ __docker_nodes() { [[ $filter != "none" ]] && args=("-f $filter") lines=(${(f)"$(_call_program commands docker $docker_options node ls $args)"}) - # Parse header line to find columns local i=1 j=1 k header=${lines[1]} declare -A begin end @@ -788,7 +792,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" + "ps:List tasks running on a node, defaults to current node" "update:Update a node" ) _describe -t docker-node-commands "docker node command" _docker_node_subcommands @@ -842,6 +846,7 @@ __docker_node_subcommand() { "($help -a --all)"{-a,--all}"[Display all instances]" \ "($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 case $state in (filter-options) @@ -1078,6 +1083,7 @@ __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)*--label=[Service labels]:label: " "($help)--limit-cpu=[Limit CPUs]:value: " "($help)--limit-memory=[Limit Memory]:value: " @@ -1157,6 +1163,7 @@ __docker_service_subcommand() { "($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 -)1:service:__docker_complete_services" && ret=0 case $state in (filter-options) @@ -1171,6 +1178,7 @@ __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)*--group-rm=[Remove previously added user groups from the container]:group:_groups" \ "($help)--image=[Service image tag]:image:__docker_repositories" \ "($help -)1:service:__docker_complete_services" && ret=0 ;; @@ -1250,6 +1258,8 @@ __docker_swarm_subcommand() { # EO swarm +# BO volume + __docker_volume_complete_ls_filters() { [[ $PREFIX = -* ]] && return 1 integer ret=1 @@ -1261,7 +1271,7 @@ __docker_volume_complete_ls_filters() { _describe -t dangling-filter-opts "Dangling Filter Options" dangling_opts && ret=0 ;; (driver) - __docker_plugins Volume && ret=0 + __docker_complete_info_plugins Volume && ret=0 ;; (name) __docker_volumes && ret=0 @@ -1271,7 +1281,7 @@ __docker_volume_complete_ls_filters() { ;; esac else - opts=('dangling' 'driver' 'name') + opts=('dangling' 'driver' 'label' 'name') _describe -t filter-opts "Filter Options" opts -qS "=" && ret=0 fi @@ -1330,12 +1340,12 @@ __docker_volume_subcommand() { case "$words[1]" in (create) - _arguments $(__docker_arguments) \ + _arguments $(__docker_arguments) -A '-*' \ $opts_help \ "($help -d --driver)"{-d=,--driver=}"[Volume driver name]:Driver name:(local)" \ "($help)*--label=[Set metadata for a volume]:label=value: " \ - "($help)--name=[Volume name]" \ - "($help)*"{-o=,--opt=}"[Driver specific options]:Driver option: " && ret=0 + "($help)*"{-o=,--opt=}"[Driver specific options]:Driver option: " \ + "($help -)1:Volume name: " && ret=0 ;; (inspect) _arguments $(__docker_arguments) \ @@ -1347,6 +1357,7 @@ __docker_volume_subcommand() { _arguments $(__docker_arguments) \ $opts_help \ "($help)*"{-f=,--filter=}"[Provide filter values]:filter:->filter-options" \ + "($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) @@ -1357,6 +1368,7 @@ __docker_volume_subcommand() { (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) @@ -1367,6 +1379,8 @@ __docker_volume_subcommand() { return ret } +# EO volume + __docker_caching_policy() { oldp=( "$1"(Nmh+1) ) # 1 hour (( $#oldp )) @@ -1646,7 +1660,8 @@ __docker_subcommand() { $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: " && ret=0 + "($help)--until=[Events created until this timestamp]:timestamp: " \ + "($help)--format=[Format the output using the given go template]:template: " && ret=0 ;; (exec) local state @@ -1689,7 +1704,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 containers using a Go template]:format: " \ + "($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 @@ -1710,7 +1725,8 @@ __docker_subcommand() { ;; (info|version) _arguments $(__docker_arguments) \ - $opts_help && ret=0 + $opts_help \ + "($help -f --format)"{-f=,--format=}"[Format the output using the given go template]:template: " && ret=0 ;; (inspect) local state @@ -1806,6 +1822,23 @@ __docker_subcommand() { $opts_help \ "($help -)*:containers:__docker_runningcontainers" && ret=0 ;; + (plugin) + local curcontext="$curcontext" state + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -): :->command" \ + "($help -)*:: :->option-or-argument" && ret=0 + + case $state in + (command) + __docker_plugin_commands && ret=0 + ;; + (option-or-argument) + curcontext=${curcontext%:*:*}:docker-${words[-1]}: + __docker_plugin_subcommand && ret=0 + ;; + esac + ;; (port) _arguments $(__docker_arguments) \ $opts_help \ @@ -1818,9 +1851,9 @@ __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]:format: " \ + "($help)--format[Pretty-print containers using a Go template]:template: " \ "($help -l --latest)"{-l,--latest}"[Show only the latest created container]" \ - "($help)-n[Show n last created containers, include non-running one]:n:(1 5 10 25 50)" \ + "($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]" \ From 7e5483d672aab9764231d9a569b6c7451474eecb Mon Sep 17 00:00:00 2001 From: Dawnflash Lightstring Date: Wed, 21 Sep 2016 12:20:08 +0200 Subject: [PATCH 10/19] Add check for git and bzr to agnoster theme Plugin command-not-found on Arch Linux returns 0 if git or bzr is found in repos, hence outputting unwanted pkgfile output. Checking if the commands exist first fixes all such issues. --- themes/agnoster.zsh-theme | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/themes/agnoster.zsh-theme b/themes/agnoster.zsh-theme index e1a294ee..07546fd3 100644 --- a/themes/agnoster.zsh-theme +++ b/themes/agnoster.zsh-theme @@ -86,7 +86,7 @@ prompt_context() { # Git: branch/detached head, dirty status prompt_git() { - + (( $+commands[git] )) || return local PL_BRANCH_CHAR () { local LC_ALL="" LC_CTYPE="en_US.UTF-8" @@ -128,6 +128,7 @@ prompt_git() { } prompt_bzr() { + (( $+commands[bzr] )) || return if (bzr status >/dev/null 2>&1); then status_mod=`bzr status | head -n1 | grep "modified" | wc -m` status_all=`bzr status | head -n1 | wc -m` From 973c92cd91d595fde37a4dbd5a6389072654252f Mon Sep 17 00:00:00 2001 From: Ash Furrow Date: Wed, 21 Sep 2016 11:55:58 -0400 Subject: [PATCH 11/19] Adds option for directory to Xcode xc function. (#5253) --- plugins/xcode/README.md | 2 +- plugins/xcode/xcode.plugin.zsh | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/plugins/xcode/README.md b/plugins/xcode/README.md index 15e65785..c12ce047 100644 --- a/plugins/xcode/README.md +++ b/plugins/xcode/README.md @@ -26,7 +26,7 @@ plugins=(... xcode) ### `xc` -Opens the current directory in Xcode as an Xcode project. This will open one of the `.xcworkspace` and `.xcodeproj` files that it can find in the current working directory. +Opens the current directory in Xcode as an Xcode project. This will open one of the `.xcworkspace` and `.xcodeproj` files that it can find in the current working directory. You can also specify a directory to look in for the Xcode files. Returns 1 if it didn't find any relevant files. ### `simulator` diff --git a/plugins/xcode/xcode.plugin.zsh b/plugins/xcode/xcode.plugin.zsh index 0a2fa083..f711c39f 100644 --- a/plugins/xcode/xcode.plugin.zsh +++ b/plugins/xcode/xcode.plugin.zsh @@ -7,10 +7,19 @@ alias xcsel='sudo xcode-select --switch' # source: http://gist.github.com/subdigital/5420709 function xc { local xcode_proj - xcode_proj=(*.{xcworkspace,xcodeproj}(N)) + if [[ $# == 0 ]]; then + xcode_proj=(*.{xcworkspace,xcodeproj}(N)) + else + xcode_proj=($1/*.{xcworkspace,xcodeproj}(N)) + fi + if [[ ${#xcode_proj} -eq 0 ]]; then - echo "No xcworkspace/xcodeproj file found in the current directory." + if [[ $# == 0 ]]; then + echo "No xcworkspace/xcodeproj file found in the current directory." + else + echo "No xcworkspace/xcodeproj file found in $1." + fi return 1 else echo "Found ${xcode_proj[1]}" From bd599066d763a0792b6c6b1654f098f3ca6e1df7 Mon Sep 17 00:00:00 2001 From: Carlo Dapor Date: Fri, 12 Aug 2016 20:50:57 +0200 Subject: [PATCH 12/19] Added angular-cli (ng) completion. --- plugins/ng/ng.plugin.zsh | 73 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 plugins/ng/ng.plugin.zsh diff --git a/plugins/ng/ng.plugin.zsh b/plugins/ng/ng.plugin.zsh new file mode 100644 index 00000000..8e9b4ab1 --- /dev/null +++ b/plugins/ng/ng.plugin.zsh @@ -0,0 +1,73 @@ + +ng_opts='addon asset-sizes b build completion d destroy doc e2e g generate get h help i init install lint make-this-awesome new s serve server set t test v version -h --help' + +_ng_completion () { + local words cword opts + read -Ac words + read -cn cword + let cword-=1 + + case $words[cword] in + addon ) + opts='-b --blueprint -d -dir --directory --dry-run -sb --skip-bower -sg --skip-git -sn --skip-npm -v --verbose' + ;; + + asset-sizes ) + opts='-o --output-path' + ;; + + i | install) + opts='' + ;; + + b | build ) + opts='--environment --output-path --suppress-sizes --watch --watcher -dev -e -prod' + ;; + + d | destroy ) + opts='--dry-run --verbose --pod --classic --dummy --in-repo --in-repo-addon -d -v -p -c -dum -id -ir' + ;; + + g | generate ) + opts='component directive pipe route service --generate -d --dry-run --verbose -v --pod -p --classic -c --dummy -dum -id --in-repo --in-repo-addon -ir' + ;; + + h | help | -h | --help) + opts='--json --verbose -v' + ;; + + init ) + opts='--blueprint --dry-run --link-cli --mobile --name --prefix --skip-bower --skip-npm --source-dir --style --verbose -b -d -lc -n -p -sb -sd -sn -v' + ;; + + new ) + opts='--blueprint --directory --dry-run --link-cli --mobile --prefix --skip-bower --skip-git --skip-npm --source-dir --style --verbose -b -d -dir -lc -p -sb -sd -sg -sn -v' + ;; + + s | serve | server ) + opts='--environment --host --insecure-proxy --inspr --live-reload --live-reload-host --live-reload-port --output-path --port --proxy --ssl --ssl-cert --ssl-key --watcher -H -dev -e -lr -lrbu -lrh -lrp -op -out -p -pr -prod -pxy -w' + ;; + + set ) + opts='--global -g' + ;; + + t | test ) + opts='--browsers --colors --config-file --environment --filter --host --launch --log-level --module --path --port --query --reporter --server --silent --test-page --test-port --watch -H -c -cf -e -f -m -r -s -tp -w' + ;; + + v | version ) + opts='--verbose' + ;; + + ng | *) + opts=$ng_opts + ;; + esac + + setopt shwordsplit + reply=($opts) + unset shwordsplit +} + +compctl -K _ng_completion ng From a748f513a6270fafca8328d614c7200a6f1e7484 Mon Sep 17 00:00:00 2001 From: Carlo Dapor Date: Fri, 12 Aug 2016 21:01:51 +0200 Subject: [PATCH 13/19] The argument completion also has no extra options. --- plugins/ng/ng.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/ng/ng.plugin.zsh b/plugins/ng/ng.plugin.zsh index 8e9b4ab1..ce34c8b5 100644 --- a/plugins/ng/ng.plugin.zsh +++ b/plugins/ng/ng.plugin.zsh @@ -16,7 +16,7 @@ _ng_completion () { opts='-o --output-path' ;; - i | install) + completion | i | install) opts='' ;; From 3da2f7ea6a5aa6ea312846e070b534df5aa78baf Mon Sep 17 00:00:00 2001 From: Carlo Dapor Date: Fri, 12 Aug 2016 23:43:19 +0200 Subject: [PATCH 14/19] Updated options for generate. Added gh-pages:deploy / github-pages:deploy. --- plugins/ng/ng.plugin.zsh | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/plugins/ng/ng.plugin.zsh b/plugins/ng/ng.plugin.zsh index ce34c8b5..2488bc23 100644 --- a/plugins/ng/ng.plugin.zsh +++ b/plugins/ng/ng.plugin.zsh @@ -1,5 +1,5 @@ -ng_opts='addon asset-sizes b build completion d destroy doc e2e g generate get h help i init install lint make-this-awesome new s serve server set t test v version -h --help' +ng_opts='addon asset-sizes b build completion d destroy doc e2e g generate get github-pages:deploy gh-pages:deploy h help i init install lint make-this-awesome new s serve server set t test v version -h --help' _ng_completion () { local words cword opts @@ -16,12 +16,8 @@ _ng_completion () { opts='-o --output-path' ;; - completion | i | install) - opts='' - ;; - b | build ) - opts='--environment --output-path --suppress-sizes --watch --watcher -dev -e -prod' + opts='--environment --output-path --suppress-sizes --target --watch --watcher -dev -e -prod' ;; d | destroy ) @@ -29,7 +25,11 @@ _ng_completion () { ;; g | generate ) - opts='component directive pipe route service --generate -d --dry-run --verbose -v --pod -p --classic -c --dummy -dum -id --in-repo --in-repo-addon -ir' + opts='class component directive enum module pipe route service --generate -d --dry-run --verbose -v --pod -p --classic -c --dummy -dum -id --in-repo --in-repo-addon -ir' + ;; + + gh-pages:deploy | github-pages:deploy ) + opts='--environment --gh-token --gh-username --skip-build --user-page --message' ;; h | help | -h | --help) @@ -45,7 +45,7 @@ _ng_completion () { ;; s | serve | server ) - opts='--environment --host --insecure-proxy --inspr --live-reload --live-reload-host --live-reload-port --output-path --port --proxy --ssl --ssl-cert --ssl-key --watcher -H -dev -e -lr -lrbu -lrh -lrp -op -out -p -pr -prod -pxy -w' + opts='--environment --host --insecure-proxy --inspr --live-reload --live-reload-base-url --live-reload-host --live-reload-live-css --live-reload-port --output-path --port --proxy --ssl --ssl-cert --ssl-key --target --watcher -H -dev -e -lr -lrbu -lrh -lrp -op -out -p -pr -prod -pxy -t -w' ;; set ) @@ -60,9 +60,13 @@ _ng_completion () { opts='--verbose' ;; - ng | *) + ng ) opts=$ng_opts ;; + + * ) + opts='' + ;; esac setopt shwordsplit From 34bc556bd3500da316e020fb2cec3ba8dc6115ab Mon Sep 17 00:00:00 2001 From: Carlo Dapor Date: Mon, 15 Aug 2016 15:27:38 +0200 Subject: [PATCH 15/19] Added README.md --- plugins/ng/README.md | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 plugins/ng/README.md diff --git a/plugins/ng/README.md b/plugins/ng/README.md new file mode 100644 index 00000000..86ad6404 --- /dev/null +++ b/plugins/ng/README.md @@ -0,0 +1,37 @@ +## NG Plugin + +This [ng plugin](https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins/ng) + adds completion support for Angular's CLI (named ng). + +Ng is hosted on [ng home](https://github.com/catull/angular-cli) + +It is used to generate Angular 2 app "stubs", build those apps, configure them, +test them, lint them etc. + +Ahem, "stubs" is not what Angular engineers refer to the items ng can generate +for you. + +"Stubs" can be any one of: +- class +- component +- directive +- enum +- module +- pipe +- route +- service + +At the moment, `ng completion` creates a very rough completion for Zsh and +Bash. + +It is missing most of the options and a few arguments. +In future, this plugin may be shortened to simply being + +```zsh +eval `ng completion` +``` + +There is hope this materialises in the 21st century. + +### CONTRIBUTOR + - Carlo Dapor ([catull](https://github.com/catull)) From 904d0ccef9a3508df61f9b0bb784d8b59d5e8bb2 Mon Sep 17 00:00:00 2001 From: Shang Yehua Date: Tue, 6 Sep 2016 11:10:42 +0800 Subject: [PATCH 16/19] Add some prompts for "install:install-file" (#5376) Add "-DgroupId= -DartifactId= -Dversion= -Dpackaging=jar -Dfile=" to options for "install:install-file" for when you need install a local jar file. Closes #5376. --- plugins/mvn/mvn.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/mvn/mvn.plugin.zsh b/plugins/mvn/mvn.plugin.zsh index d290c98e..625aad94 100644 --- a/plugins/mvn/mvn.plugin.zsh +++ b/plugins/mvn/mvn.plugin.zsh @@ -172,7 +172,7 @@ 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 # 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 + -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 From 0d897cca7499a4dd46536acbd999723fd0ca2b5d Mon Sep 17 00:00:00 2001 From: Gravemind Date: Thu, 22 Sep 2016 00:30:35 +0200 Subject: [PATCH 17/19] Fix hyphen and underscore filename completion MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This deletes the previous hack that allowed completing files with the extension: e.g. `abcd.z` to `abcdefg.z`. It is still possible to use `abcd[TAB].z`, and hyphens or underscores are very much more important than this other trick. Source: https://github.com/robbyrussell/oh-my-zsh/issues/1398#issuecomment-169163149 Signed-off-by: Marc Cornellà --- lib/completion.zsh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/completion.zsh b/lib/completion.zsh index f5b29247..85c89216 100644 --- a/lib/completion.zsh +++ b/lib/completion.zsh @@ -12,14 +12,14 @@ zmodload -i zsh/complist ## case-insensitive (all),partial-word and then substring completion if [ "x$CASE_SENSITIVE" = "xtrue" ]; then - zstyle ':completion:*' matcher-list 'r:|[._-]=* r:|=*' 'l:|=* r:|=*' + zstyle ':completion:*' matcher-list 'r:|=*' 'l:|=* r:|=*' unset CASE_SENSITIVE else if [ "x$HYPHEN_INSENSITIVE" = "xtrue" ]; then - zstyle ':completion:*' matcher-list 'm:{a-zA-Z-_}={A-Za-z_-}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*' + zstyle ':completion:*' matcher-list 'm:{a-zA-Z-_}={A-Za-z_-}' 'r:|=*' 'l:|=* r:|=*' unset HYPHEN_INSENSITIVE else - zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*' + zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|=*' 'l:|=* r:|=*' fi fi From 4e12024b0b883f31ab80a749d7ad6fadcee96904 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Thu, 22 Sep 2016 00:40:00 +0200 Subject: [PATCH 18/19] Fix styling of lib/completion.zsh --- lib/completion.zsh | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/lib/completion.zsh b/lib/completion.zsh index 85c89216..bbd02165 100644 --- a/lib/completion.zsh +++ b/lib/completion.zsh @@ -1,4 +1,7 @@ # fixme - the load process here seems a bit bizarre +zmodload -i zsh/complist + +WORDCHARS='' unsetopt menu_complete # do not autoselect the first completion entry unsetopt flowcontrol @@ -6,32 +9,26 @@ setopt auto_menu # show completion menu on succesive tab press setopt complete_in_word setopt always_to_end -WORDCHARS='' +# should this be in keybindings? +bindkey -M menuselect '^o' accept-and-infer-next-history +zstyle ':completion:*:*:*:*:*' menu select -zmodload -i zsh/complist - -## case-insensitive (all),partial-word and then substring completion -if [ "x$CASE_SENSITIVE" = "xtrue" ]; then +# case insensitive (all), partial-word and substring completion +if [[ "$CASE_SENSITIVE" = true ]]; then zstyle ':completion:*' matcher-list 'r:|=*' 'l:|=* r:|=*' - unset CASE_SENSITIVE else - if [ "x$HYPHEN_INSENSITIVE" = "xtrue" ]; then + if [[ "$HYPHEN_INSENSITIVE" = true ]]; then zstyle ':completion:*' matcher-list 'm:{a-zA-Z-_}={A-Za-z_-}' 'r:|=*' 'l:|=* r:|=*' - unset HYPHEN_INSENSITIVE else zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|=*' 'l:|=* r:|=*' fi fi +unset CASE_SENSITIVE HYPHEN_INSENSITIVE zstyle ':completion:*' list-colors '' - -# should this be in keybindings? -bindkey -M menuselect '^o' accept-and-infer-next-history - -zstyle ':completion:*:*:*:*:*' menu select zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01' -if [ "$OSTYPE[0,7]" = "solaris" ] -then + +if [[ "$OSTYPE" = solaris* ]]; then zstyle ':completion:*:*:*:*:processes' command "ps -u $USER -o pid,user,comm" else zstyle ':completion:*:*:*:*:processes' command "ps -u $USER -o pid,user,comm -w -w" From 1b7fc2f3aca32ba8713be0e27305c5cf578033f6 Mon Sep 17 00:00:00 2001 From: Brad Urani Date: Thu, 22 Sep 2016 10:41:30 -0700 Subject: [PATCH 19/19] Add copybuffer function and keybinding (#5431) * Add copybuffer function and keybinding: binds ctrl-o to copy the command line buffer to the system clipboard. * Add README --- plugins/copybuffer/README.md | 11 +++++++++++ plugins/copybuffer/copybuffer.plugin.zsh | 14 ++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 plugins/copybuffer/README.md create mode 100644 plugins/copybuffer/copybuffer.plugin.zsh diff --git a/plugins/copybuffer/README.md b/plugins/copybuffer/README.md new file mode 100644 index 00000000..da138bdb --- /dev/null +++ b/plugins/copybuffer/README.md @@ -0,0 +1,11 @@ +# `copybuffer` plugin + +This plugin binds the ctrl-o keyboard shortcut to a command that copies the text +that is currently typed in the command line ($BUFFER) to the system clipboard. + +This is useful if you type a command - and before you hit enter to execute it - want +to copy it maybe so you can paste it into a script, gist or whatnot. + +```zsh +plugins=(... copybuffer) +``` diff --git a/plugins/copybuffer/copybuffer.plugin.zsh b/plugins/copybuffer/copybuffer.plugin.zsh new file mode 100644 index 00000000..cc205d40 --- /dev/null +++ b/plugins/copybuffer/copybuffer.plugin.zsh @@ -0,0 +1,14 @@ +# copy the active line from the command line buffer +# onto the system clipboard (requires clipcopy plugin) + +copybuffer () { + if which clipcopy &>/dev/null; then + echo $BUFFER | clipcopy + else + echo "clipcopy function not found. Please make sure you have Oh My Zsh installed correctly." + fi +} + +zle -N copybuffer + +bindkey "^O" copybuffer