From 84449fc8e0923b611d1314813b8bfe4d96072b2c Mon Sep 17 00:00:00 2001 From: Joshua McKinney Date: Sat, 17 Sep 2016 04:43:40 -0500 Subject: Deprecating brew cask plugin (#5191) The good completion is now part of Homebrew so this one will always be outdated. See https://github.com/Homebrew/brew/pull/407 and https://github.com/Homebrew/brew/pull/936. --- plugins/brew-cask/brew-cask.plugin.zsh | 84 ---------------------------------- 1 file changed, 84 deletions(-) delete mode 100644 plugins/brew-cask/brew-cask.plugin.zsh diff --git a/plugins/brew-cask/brew-cask.plugin.zsh b/plugins/brew-cask/brew-cask.plugin.zsh deleted file mode 100644 index 91ce0f498..000000000 --- a/plugins/brew-cask/brew-cask.plugin.zsh +++ /dev/null @@ -1,84 +0,0 @@ -# Autocompletion for homebrew-cask. -# -# This script intercepts calls to the brew plugin and adds autocompletion -# for the cask subcommand. -# -# Author: https://github.com/pstadler - -compdef _brew-cask brew - -_brew-cask() -{ - local curcontext="$curcontext" state line - typeset -A opt_args - - _arguments -C \ - ':command:->command' \ - ':subcmd:->subcmd' \ - '*::options:->options' - - case $state in - (command) - __call_original_brew - cask_commands=( - 'cask:manage casks' - ) - _describe -t commands 'brew cask command' cask_commands ;; - - (subcmd) - case "$line[1]" in - cask) - if (( CURRENT == 3 )); then - local -a subcommands - subcommands=( - "alfred:used to modify Alfred's scope to include the Caskroom" - 'audit:verifies installability of casks' - 'checklinks:checks for bad cask links' - 'cleanup:cleans up cached downloads' - 'create:creates a cask of the given name and opens it in an editor' - 'doctor:checks for configuration issues' - 'edit:edits the cask of the given name' - 'fetch:downloads Cask resources to local cache' - 'home:opens the homepage of the cask of the given name' - 'info:displays information about the cask of the given name' - 'install:installs the cask of the given name' - 'list:with no args, lists installed casks; given installed casks, lists installed files' - 'search:searches all known casks' - 'uninstall:uninstalls the cask of the given name' - "update:a synonym for 'brew update'" - ) - _describe -t commands "brew cask subcommand" subcommands - fi ;; - - *) - __call_original_brew ;; - esac ;; - - (options) - local -a casks installed_casks - local expl - case "$line[2]" in - list|uninstall) - __brew_installed_casks - _wanted installed_casks expl 'installed casks' compadd -a installed_casks ;; - audit|edit|home|info|install) - __brew_all_casks - _wanted casks expl 'all casks' compadd -a casks ;; - esac ;; - esac -} - -__brew_all_casks() { - casks=(`brew cask search`) -} - -__brew_installed_casks() { - installed_casks=(`brew cask list`) -} - -__call_original_brew() -{ - local ret=1 - _call_function ret _brew - compdef _brew-cask brew -} -- cgit v1.2.3-70-g09d2 From 5cf9263907b74d33ac0c85a8cb99f736bb63982e Mon Sep 17 00:00:00 2001 From: Joshua McKinney Date: Mon, 27 Jun 2016 15:19:19 -0500 Subject: Remove _brew zsh completion (#5190) Removing as this is now installed as part of homebrew automatically and this version is out of date. See https://github.com/Homebrew/brew/blob/master/share/zsh/site-functions/_brew --- plugins/brew/_brew | 174 ----------------------------------------------------- 1 file changed, 174 deletions(-) delete mode 100644 plugins/brew/_brew diff --git a/plugins/brew/_brew b/plugins/brew/_brew deleted file mode 100644 index 19cfb22cb..000000000 --- a/plugins/brew/_brew +++ /dev/null @@ -1,174 +0,0 @@ -#compdef brew -#autoload - -# imported from https://github.com/Homebrew/homebrew/blob/29f73d2212c2b202fe25f69dcbf440d8391fa4c9/Library/Contributions/brew_zsh_completion.zsh - -# Brew ZSH completion function -# Drop this somewhere in your $fpath (like /usr/share/zsh/site-functions) -# and rename it _brew -# -# altered from _fink - -_brew_all_formulae() { - formulae=(`brew search`) -} - -_brew_installed_formulae() { - installed_formulae=(`brew list`) -} - -_brew_installed_taps() { - installed_taps=(`brew tap`) -} - -_brew_official_taps() { - official_taps=(`brew tap --list-official`) -} - -_brew_pinned_taps() { - pinned_taps=(`brew tap --list-pinned`) -} - -_brew_outdated_formulae() { - outdated_formulae=(`brew outdated`) -} - -_brew_installed_services() { - installed_services=(`brew services list | awk '{print $1}' | tail -n+2`) -} - -local -a _1st_arguments -_1st_arguments=( - 'audit:check formulae for Homebrew coding style' - 'cat:display formula file for a formula' - 'cleanup:uninstall unused and old versions of packages' - 'commands:show a list of commands' - 'config:show homebrew and system configuration' - 'create:create a new formula' - 'deps:list dependencies and dependants of a formula' - 'desc:display a description of a formula' - 'doctor:audits your installation for common issues' - 'edit:edit a formula' - 'fetch:download formula resources to the cache' - 'gist-logs:generate a gist of the full build logs' - 'home:visit the homepage of a formula or the brew project' - 'info:information about a formula' - 'install:install a formula' - 'reinstall:install a formula anew; re-using its current options' - 'leaves:show installed formulae that are not dependencies of another installed formula' - 'link:link a formula' - 'linkapps:symlink .app bundles provided by formulae into /Applications' - 'list:list files in a formula or not-installed formulae' - 'log:git commit log for a formula' - 'missing:check all installed formuale for missing dependencies.' - 'migrate:migrate renamed formula to new name' - 'outdated:list formulae for which a newer version is available' - 'pin:pin specified formulae' - 'postinstall:perform post_install for a given formula' - 'prune:remove dead links' - 'remove:remove a formula' - 'search:search for a formula (/regex/ or string)' - 'services:manage services' - 'switch:switch between different versions of a formula' - 'tap:tap a new formula repository from GitHub, or list existing taps' - 'tap-info:information about a tap' - 'tap-pin:pin a tap' - 'tap-unpin:unpin a tap' - 'test-bot:test a formula and build a bottle' - 'uninstall:uninstall a formula' - 'unlink:unlink a formula' - 'unlinkapps:remove symlinked .app bundles provided by formulae from /Applications' - 'unpin:unpin specified formulae' - 'untap:remove a tapped repository' - 'update:fetch latest version of Homebrew and all formulae' - 'upgrade:upgrade outdated formulae' - 'uses:show formulae which depend on a formula' - `brew commands --quiet --include-aliases` -) - -local expl -local -a formulae installed_formulae installed_taps official_taps outdated_formulae installed_services - -_arguments \ - '(-v)-v[verbose]' \ - '(--cellar)--cellar[brew cellar]' \ - '(--env)--env[brew environment]' \ - '(--repository)--repository[brew repository]' \ - '(--version)--version[version information]' \ - '(--prefix)--prefix[where brew lives on this system]' \ - '(--cache)--cache[brew cache]' \ - '*:: :->subcmds' && return 0 - -if (( CURRENT == 1 )); then - _describe -t commands "brew subcommand" _1st_arguments - return -fi - -case "$words[1]" in - install|reinstall|audit|home|homepage|log|info|abv|uses|cat|deps|desc|edit|options|switch) - _brew_all_formulae - _wanted formulae expl 'all formulae' compadd -a formulae ;; - linkapps|unlinkapps) - _arguments \ - '(--local)--local[operate on ~/Applications instead of /Applications]' \ - '1: :->forms' && return 0 - - if [[ "$state" == forms ]]; then - _brew_installed_formulae - _wanted installed_formulae expl 'installed formulae' compadd -a installed_formulae - fi ;; - list|ls) - _arguments \ - '(--unbrewed)--unbrewed[files in brew --prefix not controlled by brew]' \ - '(--pinned)--pinned[list all versions of pinned formulae]' \ - '(--versions)--versions[list all installed versions of a formula]' \ - '1: :->forms' && return 0 - - if [[ "$state" == forms ]]; then - _brew_installed_formulae - _wanted installed_formulae expl 'installed formulae' compadd -a installed_formulae - fi ;; - remove|rm|uninstall|unlink|cleanup|link|ln|pin|unpin) - _brew_installed_formulae - _wanted installed_formulae expl 'installed formulae' compadd -a installed_formulae ;; - search|-S) - _arguments \ - '(--macports)--macports[search the macports repository]' \ - '(--fink)--fink[search the fink repository]' ;; - untap|tap-info|tap-pin) - _brew_installed_taps - _wanted installed_taps expl 'installed taps' compadd -a installed_taps ;; - tap) - _brew_official_taps - _wanted official_taps expl 'official taps' compadd -a official_taps ;; - tap-unpin) - _brew_pinned_taps - _wanted pinned_taps expl 'pinned taps' compadd -a pinned_taps ;; - upgrade) - _brew_outdated_formulae - _wanted outdated_formulae expl 'outdated formulae' compadd -a outdated_formulae ;; - services) - _arguments -C \ - '1: :->command' \ - '2: :->service' && return 0 - - local -a commands - - commands=( - 'cleanup:Get rid of stale services and unused plists' - 'list:List all services managed by brew services' - 'restart:Gracefully restart selected service' - 'start:Start selected service' - 'stop:Stop selected service' - ) - - case $state in - command) - _describe -t commands 'Action' commands - ;; - service) - _brew_installed_services - _describe -t subcommands 'Services' installed_services - ;; - esac -esac -- cgit v1.2.3-70-g09d2 From 5bd9500bf4e68bf185db77ad4ecbb728a5b81c01 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Sat, 17 Sep 2016 13:01:10 +0200 Subject: ssh-agent: check ssh-agent process w/ ps again The alternative is using tools that aren't available everywhere. The latest report is that cygwin/msys2 doesn't have pgrep. Fixes #5418. --- plugins/ssh-agent/ssh-agent.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/ssh-agent/ssh-agent.plugin.zsh b/plugins/ssh-agent/ssh-agent.plugin.zsh index b668fa3b2..20f97c6f1 100644 --- a/plugins/ssh-agent/ssh-agent.plugin.zsh +++ b/plugins/ssh-agent/ssh-agent.plugin.zsh @@ -30,7 +30,7 @@ if [[ $_agent_forwarding == "yes" && -n "$SSH_AUTH_SOCK" ]]; then elif [[ -f "$_ssh_env_cache" ]]; then # Source SSH settings, if applicable . $_ssh_env_cache > /dev/null - pgrep ssh-agent | grep -q $SSH_AGENT_PID || { + ps x | grep ssh-agent | grep -q $SSH_AGENT_PID || { _start_agent } else -- cgit v1.2.3-70-g09d2 From abe834d28ddb6c5d0d98addf7a77551b3e007cd5 Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Mon, 19 Sep 2016 19:40:38 -0700 Subject: Adding a link to Planet Argon who manages the site/project/shop --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 5f152e4df..581625fe4 100644 --- a/README.md +++ b/README.md @@ -211,3 +211,9 @@ We have [stickers](http://shop.planetargon.com/products/ohmyzsh-stickers-set-of- ## License 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) + +Oh My Zsh 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). -- cgit v1.2.3-70-g09d2 From 89048668bdf4231b27e8249352087d1ccb46d447 Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Mon, 19 Sep 2016 19:41:59 -0700 Subject: Forgot a word in the footer --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 581625fe4..aab1af9fd 100644 --- a/README.md +++ b/README.md @@ -216,4 +216,4 @@ Oh My Zsh is released under the [MIT license](LICENSE.txt). ![Planet Argon](http://pa-github-assets.s3.amazonaws.com/PARGON_logo_digital_COL-small.jpg) -Oh My Zsh started by the team at [Planet Argon](https://www.planetargon.com/?utm_source=github), a [Ruby on Rails development agency](https://www.planetargon.com/skills/ruby-on-rails-development?utm_source=github). +Oh My Zsh was started by the team at [Planet Argon](https://www.planetargon.com/?utm_source=github), a [Ruby on Rails development agency](https://www.planetargon.com/skills/ruby-on-rails-development?utm_source=github). -- cgit v1.2.3-70-g09d2 From e9793fc1995254172338bc53082d704b22d31a0d Mon Sep 17 00:00:00 2001 From: Luis Ferrer-Labarca Date: Mon, 19 Sep 2016 22:50:16 -0400 Subject: 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 6197c234b..25da03509 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' -- cgit v1.2.3-70-g09d2 From 836fe3138552defff447ebd50271225d29bae91c Mon Sep 17 00:00:00 2001 From: Mohnish G J Date: Tue, 20 Sep 2016 08:21:50 +0530 Subject: 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 e532639b5..c8974b5f4 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' -- cgit v1.2.3-70-g09d2 From 63d300edb04e1c2c2eea888f3085836bc9b580f7 Mon Sep 17 00:00:00 2001 From: Mohammad Mahdi Rahimi Date: Tue, 20 Sep 2016 07:26:12 +0430 Subject: 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 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.| diff --git a/plugins/osx/osx.plugin.zsh b/plugins/osx/osx.plugin.zsh index a3e550972..aa6a256c1 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" -- cgit v1.2.3-70-g09d2 From cb60cfc7bdc7745dd48afe265df3a13f9cd3e54d Mon Sep 17 00:00:00 2001 From: Ariel Rivas Date: Mon, 19 Sep 2016 23:57:51 -0300 Subject: 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 81f56d577..7cdebab7f 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" -- cgit v1.2.3-70-g09d2 From 83765bf3f7c5e92c9141a03d9791638f7eb68277 Mon Sep 17 00:00:00 2001 From: Fabián Ríos Date: Tue, 20 Sep 2016 04:58:45 +0200 Subject: 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 02e4f3e93..43aedc36d 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" -- cgit v1.2.3-70-g09d2 From fb8953d525ddd3ed01db02a266b284bd9fa5fbd2 Mon Sep 17 00:00:00 2001 From: Matt Nichols Date: Mon, 19 Sep 2016 21:00:16 -0600 Subject: 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 9dc58294a..b6dfa6870 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%}' -- cgit v1.2.3-70-g09d2 From d1ce70f68540bdf6a7f27ab9879e8222d0e7a604 Mon Sep 17 00:00:00 2001 From: grindhold Date: Tue, 20 Sep 2016 05:00:42 +0200 Subject: 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 da1f9b6e6..e1a294ee8 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 } -- cgit v1.2.3-70-g09d2 From 9d91e92f26e3cb2d89eb43065ad960e4a344d52c Mon Sep 17 00:00:00 2001 From: Brian Goff Date: Tue, 20 Sep 2016 14:40:07 -0400 Subject: 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 66dfeea9e..554379246 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]" \ -- cgit v1.2.3-70-g09d2 From f39dcfda8d287bdfeda2bc1e0a7ab3785c6e4a73 Mon Sep 17 00:00:00 2001 From: Zach Himsel Date: Tue, 20 Sep 2016 10:40:54 -0600 Subject: 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 554379246..1366fd61b 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]" \ -- cgit v1.2.3-70-g09d2 From 973c92cd91d595fde37a4dbd5a6389072654252f Mon Sep 17 00:00:00 2001 From: Ash Furrow Date: Wed, 21 Sep 2016 11:55:58 -0400 Subject: 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 15e657859..c12ce047f 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 0a2fa0839..f711c39fb 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]}" -- cgit v1.2.3-70-g09d2