544eccb5ddf2f650df5906bc4600731dc3e980b4

Author
Robby Russell <robby@planetargon.com>
Committer
Robby Russell <robby@planetargon.com>
Date

Message

Fixing conflict in rails plugin merge with rake test shortcut

Diff

This diff is truncated to protect this page.

  1diff --git a/plugins/osx/osx.plugin.zsh b/plugins/osx/osx.plugin.zsh
  2index 390960fdcc162c6701fe0c066772f32d75460bb8..2cbb95977af17c2bc88a731b8e1e711e2139c860 100644
  3--- a/plugins/osx/osx.plugin.zsh
  4+++ b/plugins/osx/osx.plugin.zsh
  5@@ -5,29 +5,35 @@
  6 #       VERSION:  1.1.0
  7 # ------------------------------------------------------------------------------
  8 
  9-function tab() {
 10-  local command="cd \\\"$PWD\\\"; clear"
 11-  (( $# > 0 )) && command="${command}; $*"
 12-
 13-  the_app=$(
 14+function _omz_osx_get_frontmost_app() {
 15+  local the_app=$(
 16     osascript 2>/dev/null <<EOF
 17       tell application "System Events"
 18         name of first item of (every process whose frontmost is true)
 19       end tell
 20 EOF
 21   )
 22+  echo "$the_app"
 23+}
 24 
 25-  [[ "$the_app" == 'Terminal' ]] && {
 26-    osascript 2>/dev/null <<EOF
 27+function tab() {
 28+  # Must not have trailing semicolon, for iTerm compatibility
 29+  local command="cd \\\"$PWD\\\"; clear"
 30+  (( $# > 0 )) && command="${command}; $*"
 31+
 32+  local the_app=$(_omz_osx_get_frontmost_app)
 33+
 34+  if [[ "$the_app" == 'Terminal' ]]; then
 35+    # Discarding stdout to quash "tab N of window id XXX" output
 36+    osascript >/dev/null <<EOF
 37       tell application "System Events"
 38         tell process "Terminal" to keystroke "t" using command down
 39-        tell application "Terminal" to do script "${command}" in front window
 40       end tell
 41+      tell application "Terminal" to do script "${command}" in front window
 42 EOF
 43-  }
 44 
 45-  [[ "$the_app" == 'iTerm' ]] && {
 46-    osascript 2>/dev/null <<EOF
 47+  elif [[ "$the_app" == 'iTerm' ]]; then
 48+    osascript <<EOF
 49       tell application "iTerm"
 50         set current_terminal to current terminal
 51         tell current_terminal
 52@@ -35,29 +41,27 @@ EOF
 53           set current_session to current session
 54           tell current_session
 55             write text "${command}"
 56-            keystroke return
 57           end tell
 58         end tell
 59       end tell
 60 EOF
 61-  }
 62+
 63+  else
 64+    echo "tab: unsupported terminal app: $the_app"
 65+    false
 66+
 67+  fi
 68 }
 69 
 70 function vsplit_tab() {
 71-  local command="cd \\\"$PWD\\\""
 72+  local command="cd \\\"$PWD\\\"; clear"
 73   (( $# > 0 )) && command="${command}; $*"
 74 
 75-  the_app=$(
 76-    osascript 2>/dev/null <<EOF
 77-      tell application "System Events"
 78-        name of first item of (every process whose frontmost is true)
 79-      end tell
 80-EOF
 81-  )
 82+  local the_app=$(_omz_osx_get_frontmost_app)
 83 
 84-  [[ "$the_app" == 'iTerm' ]] && {
 85-    osascript 2>/dev/null <<EOF
 86-      tell application "iTerm" to activate
 87+  if [[ "$the_app" == 'iTerm' ]]; then
 88+    osascript <<EOF
 89+      -- tell application "iTerm" to activate
 90 
 91       tell application "System Events"
 92         tell process "iTerm"
 93@@ -65,26 +69,24 @@ EOF
 94             click
 95           end tell
 96         end tell
 97-        keystroke "${command}; clear;"
 98-        keystroke return
 99+        keystroke "${command} \n"
100       end tell
101 EOF
102-  }
103+
104+  else
105diff --git a/plugins/rails/rails.plugin.zsh b/plugins/rails/rails.plugin.zsh
106index 4c250369bab6c36d711a719c3ccfcb6f456cc163..39e38849450aac75951e0ceaffbc685cdb9bfaba 100644
107--- a/plugins/rails/rails.plugin.zsh
108+++ b/plugins/rails/rails.plugin.zsh
109@@ -54,12 +54,13 @@ alias rdrs='rake db:reset'
110 alias rdtc='rake db:test:clone'
111 alias rdtp='rake db:test:prepare'
112 alias rdmtc='rake db:migrate db:test:clone'
113-
114 alias rlc='rake log:clear'
115 alias rn='rake notes'
116 alias rr='rake routes'
117+alias rrg='rake routes | grep'
118 alias rt='rake test'
119 
120+
121 # legacy stuff
122 alias sstat='thin --stats "/thin/stats" start'
123 alias sg='ruby script/generate'
124diff --git a/plugins/scw/README.md b/plugins/scw/README.md
125new file mode 100644
126index 0000000000000000000000000000000000000000..d2312c2e5cba0ead32f1459ed5ed574b81e14bc5
127--- /dev/null
128+++ b/plugins/scw/README.md
129@@ -0,0 +1,7 @@
130+## Scaleway CLI autocomplete plugin
131+
132+[scw](https://github.com/scaleway/scaleway-cli): Manage Bare Metal servers from Command Line (as easily as with Docker)
133+
134+- Adds autocomplete options for all `scw` commands.
135+
136+Maintainer : Manfred Touron ([@moul](https://github.com/moul))
137diff --git a/plugins/scw/_scw b/plugins/scw/_scw
138new file mode 100644
139index 0000000000000000000000000000000000000000..f9fdf916e761728b398f7ed04f0399457d419026
140--- /dev/null
141+++ b/plugins/scw/_scw
142@@ -0,0 +1,333 @@
143+#compdef scw
144+#
145+# zsh completion for scw (http://scaleway.com)
146+#
147+# Inspired by https://github.com/felixr/docker-zsh-completion
148+
149+__scw_get_servers() {
150+    local expl
151+    declare -a servers
152+    servers=(${(f)"$(_call_program commands scw _completion servers-names)"})
153+    _describe -t servers "servers" servers
154+}
155+
156+__scw_stoppedservers() {
157+    __scw_get_servers
158+}
159+
160+__scw_runningservers() {
161+    __scw_get_servers
162+}
163+
164+__scw_servers () {
165+    __scw_get_servers
166+}
167+
168+__scw_images () {
169+    local expl
170+    declare -a images
171+    images=(${(f)"$(_call_program commands scw _completion images-names)"})
172+    _describe -t images "images" images
173+}
174+
175+__scw_images_and_snapshots () {
176+    __scw_images
177+    __scw_snapshots
178+}
179+
180+__scw_snapshots () {
181+    local expl
182+    declare -a snapshots
183+    snapshots=(${(f)"$(_call_program commands scw _completion --prefix snapshots-names)"})
184+    _describe -t snapshots "snapshots" snapshots
185+}
186+
187+__scw_bootscripts () {
188+    local expl
189+    declare -a bootscripts
190+    bootscripts=(${(f)"$(_call_program commands scw _completion bootscripts-names)"})
191+    _describe -t bootscripts "bootscripts" bootscripts
192+}
193+
194+__scw_tags() {
195+    __scw_images
196+}
197+
198+__scw_repositories_with_tags() {
199+    __scw_images
200+}
201+
202+__scw_search() {
203+    # declare -a scwsearch
204+    local cache_policy
205+    zstyle -s ":completion:${curcontext}:" cache-policy cache_policy
206+    if [[ -z "$cache_policy" ]]; then
207+        zstyle ":completion:${curcontext}:" cache-policy __scw_caching_policy
208+    fi
209+
210+    local searchterm cachename
211+    searchterm="${words[$CURRENT]%/}"
212+    cachename=_scw-search-$searchterm
213+
214+    local expl
215+    local -a result
216+    if ( [[ ${(P)+cachename} -eq 0 ]] || _cache_invalid ${cachename#_} ) \
217+        && ! _retrieve_cache ${cachename#_}; then
218+        _message "Searching for ${searchterm}..."
219+        result=(${${${(f)"$(_call_program commands scw search ${searchterm})"}%% *}[2,-1]})
220+        _store_cache ${cachename#_} result
221+    fi
222+    _wanted scwsearch expl 'available images' compadd -a result
223+}
224+
225+__scw_caching_policy()
226+{
227+  oldp=( "$1"(Nmh+1) )     # 1 hour
228+  (( $#oldp ))
229+}
230+
231+
232+__scw_repositories () {
233+    __scw_images
234+}
235+
236+__scw_commands () {
237+    # local -a  _scw_subcommands
238+    local cache_policy
239+
240+    zstyle -s ":completion:${curcontext}:" cache-policy cache_policy
241+    if [[ -z "$cache_policy" ]]; then
242diff --git a/themes/gnzh.zsh-theme b/themes/gnzh.zsh-theme
243index ab154c1e5cbc8a5cdbd014a11c2967449d591530..04b0450a8c0f86ec09d379f58cfd904be5c3f101 100644
244--- a/themes/gnzh.zsh-theme
245+++ b/themes/gnzh.zsh-theme
246@@ -1,53 +1,50 @@
247 # ZSH Theme - Preview: http://dl.dropbox.com/u/4109351/pics/gnzh-zsh-theme.png
248 # Based on bira theme
249 
250-# load some modules
251-autoload -U zsh/terminfo # Used in the colour alias below
252 setopt prompt_subst
253 
254-# make some aliases for the colours: (could use normal escape sequences too)
255-for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE; do
256-  eval PR_$color='%{$fg[${(L)color}]%}'
257-done
258-eval PR_NO_COLOR="%{$terminfo[sgr0]%}"
259-eval PR_BOLD="%{$terminfo[bold]%}"
260+() {
261+
262+local PR_USER PR_USER_OP PR_PROMPT PR_HOST
263 
264 # Check the UID
265 if [[ $UID -ne 0 ]]; then # normal user
266-  eval PR_USER='${PR_GREEN}%n${PR_NO_COLOR}'
267-  eval PR_USER_OP='${PR_GREEN}%#${PR_NO_COLOR}'
268-  local PR_PROMPT='$PR_NO_COLOR➤ $PR_NO_COLOR'
269+  PR_USER='%F{green}%n%f'
270+  PR_USER_OP='%F{green}%#%f'
271+  PR_PROMPT='%f➤ %f'
272 else # root
273-  eval PR_USER='${PR_RED}%n${PR_NO_COLOR}'
274-  eval PR_USER_OP='${PR_RED}%#${PR_NO_COLOR}'
275-  local PR_PROMPT='$PR_RED➤ $PR_NO_COLOR'
276+  PR_USER='%F{red}%n%f'
277+  PR_USER_OP='%F{red}%#%f'
278+  PR_PROMPT='%F{red}➤ %f'
279 fi
280 
281 # Check if we are on SSH or not
282 if [[ -n "$SSH_CLIENT"  ||  -n "$SSH2_CLIENT" ]]; then
283-  eval PR_HOST='${PR_YELLOW}%M${PR_NO_COLOR}' #SSH
284+  PR_HOST='%F{red}%M%f' # SSH
285 else
286-  eval PR_HOST='${PR_GREEN}%M${PR_NO_COLOR}' # no SSH
287+  PR_HOST='%F{green}%M%f' # no SSH
288 fi
289 
290-local return_code="%(?..%{$PR_RED%}%? ↵%{$PR_NO_COLOR%})"
291 
292-local user_host='${PR_USER}${PR_CYAN}@${PR_HOST}'
293-local current_dir='%{$PR_BOLD$PR_BLUE%}%~%{$PR_NO_COLOR%}'
294+local return_code="%(?..%F{red}%? ↵%f)"
295+
296+local user_host="${PR_USER}%F{cyan}@${PR_HOST}"
297+local current_dir="%B%F{blue}%~%f%b"
298 local rvm_ruby=''
299-if ${HOME}/.rvm/bin/rvm-prompt &> /dev/null; then # detect local user rvm installation
300-  rvm_ruby='%{$PR_RED%}‹$(${HOME}/.rvm/bin/rvm-prompt i v g s)›%{$PR_NO_COLOR%}'
301-elif which rvm-prompt &> /dev/null; then # detect sysem-wide rvm installation
302-  rvm_ruby='%{$PR_RED%}‹$(rvm-prompt i v g s)›%{$PR_NO_COLOR%}'
303-elif which rbenv &> /dev/null; then # detect Simple Ruby Version management
304-  rvm_ruby='%{$PR_RED%}‹$(rbenv version | sed -e "s/ (set.*$//")›%{$PR_NO_COLOR%}'
305+if ${HOME}/.rvm/bin/rvm-prompt &> /dev/null; then # detect user-local rvm installation
306+  rvm_ruby='%F{red}‹$(${HOME}/.rvm/bin/rvm-prompt i v g s)›%f'
307+elif which rvm-prompt &> /dev/null; then # detect system-wide rvm installation
308+  rvm_ruby='%F{red}‹$(rvm-prompt i v g s)›%f'
309+elif which rbenv &> /dev/null; then # detect Simple Ruby Version Management
310+  rvm_ruby='%F{red}‹$(rbenv version | sed -e "s/ (set.*$//")›%f'
311 fi
312-local git_branch='$(git_prompt_info)%{$PR_NO_COLOR%}'
313+local git_branch='$(git_prompt_info)'
314 
315-#PROMPT="${user_host} ${current_dir} ${rvm_ruby} ${git_branch}$PR_PROMPT "
316 PROMPT="╭─${user_host} ${current_dir} ${rvm_ruby} ${git_branch}
317 ╰─$PR_PROMPT "
318-RPS1="${return_code}"
319+RPROMPT="${return_code}"
320+
321+ZSH_THEME_GIT_PROMPT_PREFIX="%F{yellow}‹"
322+ZSH_THEME_GIT_PROMPT_SUFFIX="› %f"
323 
324-ZSH_THEME_GIT_PROMPT_PREFIX="%{$PR_YELLOW%}‹"
325-ZSH_THEME_GIT_PROMPT_SUFFIX="› %{$PR_NO_COLOR%}"
326+}
327diff --git a/themes/michelebologna.zsh-theme b/themes/michelebologna.zsh-theme
328index fec2438734af2f0fcd5a03bd882ffce52598e471..110e3f203518c28ca6780d874c877b9ef8b2b62a 100644
329--- a/themes/michelebologna.zsh-theme
330+++ b/themes/michelebologna.zsh-theme
331@@ -59,16 +59,17 @@ ZSH_THEME_GIT_PROMPT_PREFIX=""
332 ZSH_THEME_GIT_PROMPT_SUFFIX=""
333 ZSH_THEME_GIT_PROMPT_DIRTY=""
334 ZSH_THEME_GIT_PROMPT_CLEAN=""
335-ZSH_THEME_GIT_PROMPT_UNTRACKED="%%"
336-ZSH_THEME_GIT_PROMPT_MODIFIED="*"
337-ZSH_THEME_GIT_PROMPT_ADDED="+"
338-ZSH_THEME_GIT_PROMPT_STASHED="$"
339-ZSH_THEME_GIT_PROMPT_EQUAL_REMOTE="="
340+ZSH_THEME_GIT_PROMPT_UNTRACKED="$blue%%"
341+ZSH_THEME_GIT_PROMPT_MODIFIED="$red*"
342+ZSH_THEME_GIT_PROMPT_ADDED="$green+"
343+ZSH_THEME_GIT_PROMPT_STASHED="$blue$"
344+ZSH_THEME_GIT_PROMPT_EQUAL_REMOTE="$green="
345 ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE=">"
346 ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE="<"
347-ZSH_THEME_GIT_PROMPT_DIVERGED_REMOTE="<>"
348+ZSH_THEME_GIT_PROMPT_DIVERGED_REMOTE="$red<>"
349 
350 PROMPT='$username_output$hostname_output:$current_dir_output%1(j. [$jobs_bg].)'
351-PROMPT+='$(__git_ps1)'
352+GIT_PROMPT='$(out=$(git_prompt_info)$(git_prompt_status)$(git_remote_status);if [[ -n $out ]]; then printf %s " $white($green$out$white)$reset";fi)'
353+PROMPT+="$GIT_PROMPT"
354 PROMPT+=" $last_command_output%#$reset "
355 RPROMPT=''