0 | 3 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,68 @@ |
0 |
+# Archlinux zsh aliases and functions for zsh |
|
1 |
+ |
|
2 |
+# Aliases ################################################################### |
|
3 |
+ |
|
4 |
+# Look for yaourt, and add some useful functions if we have it. |
|
5 |
+if [[ -x `which yaourt` ]]; then |
|
6 |
+ upgrade () { |
|
7 |
+ yaourt -Syu -C |
|
8 |
+ } |
|
9 |
+ # Pacman - https://wiki.archlinux.org/index.php/Pacman_Tips |
|
10 |
+ alias yaupg='sudo yaourt -Syu' # Synchronize with repositories before upgrading packages that are out of date on the local system. |
|
11 |
+ alias yain='sudo yaourt -S' # Install specific package(s) from the repositories |
|
12 |
+ alias yains='sudo yaourt -U' # Install specific package not from the repositories but from a file |
|
13 |
+ alias yare='sudo yaourt -R' # Remove the specified package(s), retaining its configuration(s) and required dependencies |
|
14 |
+ alias yarem='sudo yaourt -Rns' # Remove the specified package(s), its configuration(s) and unneeded dependencies |
|
15 |
+ alias yarep='yaourt -Si' # Display information about a given package in the repositories |
|
16 |
+ alias yareps='yaourt -Ss' # Search for package(s) in the repositories |
|
17 |
+ alias yaloc='yaourt -Qi' # Display information about a given package in the local database |
|
18 |
+ alias yalocs='yaourt -Qs' # Search for package(s) in the local database |
|
19 |
+ # Additional yaourt alias examples |
|
20 |
+ alias yaupd='sudo yaourt -Sy && sudo abs' # Update and refresh the local package and ABS databases against repositories |
|
21 |
+ alias yainsd='sudo yaourt -S --asdeps' # Install given package(s) as dependencies of another package |
|
22 |
+ alias yamir='sudo yaourt -Syy' # Force refresh of all package lists after updating /etc/pacman.d/mirrorlist |
|
23 |
+else |
|
24 |
+ upgrade() { |
|
25 |
+ sudo pacman -Syu |
|
26 |
+ } |
|
27 |
+fi |
|
28 |
+ |
|
29 |
+# Pacman - https://wiki.archlinux.org/index.php/Pacman_Tips |
|
30 |
+alias pacupg='sudo pacman -Syu' # Synchronize with repositories before upgrading packages that are out of date on the local system. |
|
31 |
+alias pacin='sudo pacman -S' # Install specific package(s) from the repositories |
|
32 |
+alias pacins='sudo pacman -U' # Install specific package not from the repositories but from a file |
|
33 |
+alias pacre='sudo pacman -R' # Remove the specified package(s), retaining its configuration(s) and required dependencies |
|
34 |
+alias pacrem='sudo pacman -Rns' # Remove the specified package(s), its configuration(s) and unneeded dependencies |
|
35 |
+alias pacrep='pacman -Si' # Display information about a given package in the repositories |
|
36 |
+alias pacreps='pacman -Ss' # Search for package(s) in the repositories |
|
37 |
+alias pacloc='pacman -Qi' # Display information about a given package in the local database |
|
38 |
+alias paclocs='pacman -Qs' # Search for package(s) in the local database |
|
39 |
+# Additional pacman alias examples |
|
40 |
+alias pacupd='sudo pacman -Sy && sudo abs' # Update and refresh the local package and ABS databases against repositories |
|
41 |
+alias pacinsd='sudo pacman -S --asdeps' # Install given package(s) as dependencies of another package |
|
42 |
+alias pacmir='sudo pacman -Syy' # Force refresh of all package lists after updating /etc/pacman.d/mirrorlist |
|
43 |
+ |
|
44 |
+# https://bbs.archlinux.org/viewtopic.php?id=93683 |
|
45 |
+paclist() { |
|
46 |
+ sudo pacman -Qei $(pacman -Qu|cut -d" " -f 1)|awk ' BEGIN {FS=":"}/^Name/{printf("\033[1;36m%s\033[1;37m", $2)}/^Description/{print $2}' |
|
47 |
+} |
|
48 |
+ |
|
49 |
+alias paclsorphans='sudo pacman -Qdt' |
|
50 |
+alias pacrmorphans='sudo pacman -Rs $(pacman -Qtdq)' |
|
51 |
+ |
|
52 |
+pacdisowned() { |
|
53 |
+ tmp=${TMPDIR-/tmp}/pacman-disowned-$UID-$$ |
|
54 |
+ db=$tmp/db |
|
55 |
+ fs=$tmp/fs |
|
56 |
+ |
|
57 |
+ mkdir "$tmp" |
|
58 |
+ trap 'rm -rf "$tmp"' EXIT |
|
59 |
+ |
|
60 |
+ pacman -Qlq | sort -u > "$db" |
|
61 |
+ |
|
62 |
+ find /bin /etc /lib /sbin /usr \ |
|
63 |
+ ! -name lost+found \ |
|
64 |
+ \( -type d -printf '%p/\n' -o -print \) | sort > "$fs" |
|
65 |
+ |
|
66 |
+ comm -23 "$fs" "$db" |
|
67 |
+} |
... | ... |
@@ -1,3 +1,36 @@ |
1 | 1 |
alias be="bundle exec" |
2 | 2 |
alias bi="bundle install" |
3 |
+alias bl="bundle list" |
|
3 | 4 |
alias bu="bundle update" |
5 |
+ |
|
6 |
+# The following is based on https://github.com/gma/bundler-exec |
|
7 |
+ |
|
8 |
+bundled_commands=(cap capify cucumber heroku rackup rails rake rspec ruby shotgun spec spork thin unicorn unicorn_rails) |
|
9 |
+ |
|
10 |
+## Functions |
|
11 |
+ |
|
12 |
+_bundler-installed() { |
|
13 |
+ which bundle > /dev/null 2>&1 |
|
14 |
+} |
|
15 |
+ |
|
16 |
+_within-bundled-project() { |
|
17 |
+ local check_dir=$PWD |
|
18 |
+ while [ "$(dirname $check_dir)" != "/" ]; do |
|
19 |
+ [ -f "$check_dir/Gemfile" ] && return |
|
20 |
+ check_dir="$(dirname $check_dir)" |
|
21 |
+ done |
|
22 |
+ false |
|
23 |
+} |
|
24 |
+ |
|
25 |
+_run-with-bundler() { |
|
26 |
+ if _bundler-installed && _within-bundled-project; then |
|
27 |
+ bundle exec $@ |
|
28 |
+ else |
|
29 |
+ $@ |
|
30 |
+ fi |
|
31 |
+} |
|
32 |
+ |
|
33 |
+## Main program |
|
34 |
+for cmd in $bundled_commands; do |
|
35 |
+ alias $cmd="_run-with-bundler $cmd" |
|
36 |
+done |
4 | 37 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,32 @@ |
0 |
+# Set this to 1 if you want to cache the tasks |
|
1 |
+cache_task_list=1 |
|
2 |
+ |
|
3 |
+# Cache filename |
|
4 |
+cache_file='.cake_task_cache' |
|
5 |
+ |
|
6 |
+_cake_does_target_list_need_generating () { |
|
7 |
+ |
|
8 |
+ if [ $cache_task_list -eq 0 ]; then |
|
9 |
+ return 1; |
|
10 |
+ fi |
|
11 |
+ |
|
12 |
+ if [ ! -f $cache_file ]; then return 0; |
|
13 |
+ else |
|
14 |
+ accurate=$(stat -f%m $cache_file) |
|
15 |
+ changed=$(stat -f%m Cakefile) |
|
16 |
+ return $(expr $accurate '>=' $changed) |
|
17 |
+ fi |
|
18 |
+} |
|
19 |
+ |
|
20 |
+_cake () { |
|
21 |
+ if [ -f Cakefile ]; then |
|
22 |
+ if _cake_does_target_list_need_generating; then |
|
23 |
+ cake | sed -e "s/cake \([^ ]*\) .*/\1/" | grep -v '^$' > $cache_file |
|
24 |
+ compadd `cat $cache_file` |
|
25 |
+ else |
|
26 |
+ compadd `cake | sed -e "s/cake \([^ ]*\) .*/\1/" | grep -v '^$'` |
|
27 |
+ fi |
|
28 |
+ fi |
|
29 |
+} |
|
30 |
+ |
|
31 |
+compdef _cake cake |
0 | 2 |
new file mode 100755 |
... | ... |
@@ -0,0 +1,60 @@ |
0 |
+#!/usr/bin/env ruby |
|
1 |
+# |
|
2 |
+# cloudapp |
|
3 |
+# Zach Holman / @holman |
|
4 |
+# |
|
5 |
+# Uploads a file from the command line to CloudApp, drops it into your |
|
6 |
+# clipboard (on a Mac, at least). |
|
7 |
+# |
|
8 |
+# Example: |
|
9 |
+# |
|
10 |
+# cloudapp drunk-blake.png |
|
11 |
+# |
|
12 |
+# This requires Aaron Russell's cloudapp_api gem: |
|
13 |
+# |
|
14 |
+# gem install cloudapp_api |
|
15 |
+# |
|
16 |
+# Requires you set your CloudApp credentials in ~/.cloudapp as a simple file of: |
|
17 |
+# |
|
18 |
|
|
19 |
+# password |
|
20 |
+ |
|
21 |
+require 'rubygems' |
|
22 |
+begin |
|
23 |
+ require 'cloudapp_api' |
|
24 |
+rescue LoadError |
|
25 |
+ puts "You need to install cloudapp_api: gem install cloudapp_api" |
|
26 |
+ exit!(1) |
|
27 |
+end |
|
28 |
+ |
|
29 |
+config_file = "#{ENV['HOME']}/.cloudapp" |
|
30 |
+unless File.exist?(config_file) |
|
31 |
+ puts "You need to type your email and password (one per line) into "+ |
|
32 |
+ "`~/.cloudapp`" |
|
33 |
+ exit!(1) |
|
34 |
+end |
|
35 |
+ |
|
36 |
+email,password = File.read(config_file).split("\n") |
|
37 |
+ |
|
38 |
+class HTTParty::Response |
|
39 |
+ # Apparently HTTPOK.ok? IS NOT OKAY WTFFFFFFFFFFUUUUUUUUUUUUUU |
|
40 |
+ # LETS MONKEY PATCH IT I FEEL OKAY ABOUT IT |
|
41 |
+ def ok? ; true end |
|
42 |
+end |
|
43 |
+ |
|
44 |
+if ARGV[0].nil? |
|
45 |
+ puts "You need to specify a file to upload." |
|
46 |
+ exit!(1) |
|
47 |
+end |
|
48 |
+ |
|
49 |
+CloudApp.authenticate(email,password) |
|
50 |
+url = CloudApp::Item.create(:upload, {:file => ARGV[0]}).url |
|
51 |
+ |
|
52 |
+# Say it for good measure. |
|
53 |
+puts "Uploaded to #{url}." |
|
54 |
+ |
|
55 |
+# Get the embed link. |
|
56 |
+url = "#{url}/#{ARGV[0].split('/').last}" |
|
57 |
+ |
|
58 |
+# Copy it to your (Mac's) clipboard. |
|
59 |
+`echo '#{url}' | tr -d "\n" | pbcopy` |
0 | 60 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,222 @@ |
0 |
+#compdef manage.py |
|
1 |
+ |
|
2 |
+typeset -ga nul_args |
|
3 |
+nul_args=( |
|
4 |
+ '--settings=-[the Python path to a settings module.]:file:_files' |
|
5 |
+ '--pythonpath=-[a directory to add to the Python path.]::directory:_directories' |
|
6 |
+ '--traceback[print traceback on exception.]' |
|
7 |
+ "--version[show program's version number and exit.]" |
|
8 |
+ {-h,--help}'[show this help message and exit.]' |
|
9 |
+) |
|
10 |
+ |
|
11 |
+_managepy-adminindex(){ |
|
12 |
+ _arguments -s : \ |
|
13 |
+ $nul_args \ |
|
14 |
+ '*::directory:_directories' && ret=0 |
|
15 |
+} |
|
16 |
+ |
|
17 |
+_managepy-createcachetable(){ |
|
18 |
+ _arguments -s : \ |
|
19 |
+ $nul_args && ret=0 |
|
20 |
+} |
|
21 |
+ |
|
22 |
+_managepy-dbshell(){ |
|
23 |
+ _arguments -s : \ |
|
24 |
+ $nul_args && ret=0 |
|
25 |
+} |
|
26 |
+ |
|
27 |
+_managepy-diffsettings(){ |
|
28 |
+ _arguments -s : \ |
|
29 |
+ $nul_args && ret=0 |
|
30 |
+} |
|
31 |
+ |
|
32 |
+_managepy-dumpdata(){ |
|
33 |
+ _arguments -s : \ |
|
34 |
+ '--format=-[specifies the output serialization format for fixtures.]:format:(json yaml xml)' \ |
|
35 |
+ '--indent=-[specifies the indent level to use when pretty-printing output.]:' \ |
|
36 |
+ $nul_args \ |
|
37 |
+ '*::appname:_applist' && ret=0 |
|
38 |
+} |
|
39 |
+ |
|
40 |
+_managepy-flush(){ |
|
41 |
+ _arguments -s : \ |
|
42 |
+ '--verbosity=-[verbosity level; 0=minimal output, 1=normal output, 2=all output.]:Verbosity:((0\:minimal 1\:normal 2\:all))' \ |
|
43 |
+ '--noinput[tells Django to NOT prompt the user for input of any kind.]' \ |
|
44 |
+ $nul_args && ret=0 |
|
45 |
+} |
|
46 |
+ |
|
47 |
+_managepy-help(){ |
|
48 |
+ _arguments -s : \ |
|
49 |
+ '*:command:_managepy_cmds' \ |
|
50 |
+ $nul_args && ret=0 |
|
51 |
+} |
|
52 |
+ |
|
53 |
+_managepy_cmds(){ |
|
54 |
+ local line |
|
55 |
+ local -a cmd |
|
56 |
+ _call_program help-command ./manage.py help \ |
|
57 |
+ |& sed -n '/^ /s/[(), ]/ /gp' \ |
|
58 |
+ | while read -A line; do cmd=($line $cmd) done |
|
59 |
+ _describe -t managepy-command 'manage.py command' cmd |
|
60 |
+} |
|
61 |
+ |
|
62 |
+_managepy-inspectdb(){ |
|
63 |
+ _arguments -s : \ |
|
64 |
+ $nul_args && ret=0 |
|
65 |
+} |
|
66 |
+ |
|
67 |
+_managepy-loaddata(){ |
|
68 |
+ _arguments -s : \ |
|
69 |
+ '--verbosity=-[verbosity level; 0=minimal output, 1=normal output, 2=all output.]:Verbosity:((0\:minimal 1\:normal 2\:all))' \ |
|
70 |
+ '*::file:_files' \ |
|
71 |
+ $nul_args && ret=0 |
|
72 |
+} |
|
73 |
+ |
|
74 |
+_managepy-reset(){ |
|
75 |
+ _arguments -s : \ |
|
76 |
+ '--noinput[tells Django to NOT prompt the user for input of any kind.]' \ |
|
77 |
+ '*::appname:_applist' \ |
|
78 |
+ $nul_args && ret=0 |
|
79 |
+} |
|
80 |
+ |
|
81 |
+_managepy-runfcgi(){ |
|
82 |
+ local state |
|
83 |
+ |
|
84 |
+ local fcgi_opts |
|
85 |
+ fcgi_opts=( |
|
86 |
+ 'protocol[fcgi, scgi, ajp, ... (default fcgi)]:protocol:(fcgi scgi ajp)' |
|
87 |
+ 'host[hostname to listen on..]:' |
|
88 |
+ 'port[port to listen on.]:' |
|
89 |
+ 'socket[UNIX socket to listen on.]::file:_files' |
|
90 |
+ 'method[prefork or threaded (default prefork)]:method:(prefork threaded)' |
|
91 |
+ 'maxrequests[number of requests a child handles before it is killed and a new child is forked (0 = no limit).]:' |
|
92 |
+ 'maxspare[max number of spare processes / threads.]:' |
|
93 |
+ 'minspare[min number of spare processes / threads.]:' |
|
94 |
+ 'maxchildren[hard limit number of processes / threads.]:' |
|
95 |
+ 'daemonize[whether to detach from terminal.]:boolean:(False True)' |
|
96 |
+ 'pidfile[write the spawned process-id to this file.]:file:_files' |
|
97 |
+ 'workdir[change to this directory when daemonizing.]:directory:_files' |
|
98 |
+ 'outlog[write stdout to this file.]:file:_files' |
|
99 |
+ 'errlog[write stderr to this file.]:file:_files' |
|
100 |
+ ) |
|
101 |
+ |
|
102 |
+ _arguments -s : \ |
|
103 |
+ $nul_args \ |
|
104 |
+ '*: :_values "FCGI Setting" $fcgi_opts' && ret=0 |
|
105 |
+} |
|
106 |
+ |
|
107 |
+_managepy-runserver(){ |
|
108 |
+ _arguments -s : \ |
|
109 |
+ '--noreload[tells Django to NOT use the auto-reloader.]' \ |
|
110 |
+ '--adminmedia[specifies the directory from which to serve admin media.]:directory:_files' \ |
|
111 |
+ $nul_args && ret=0 |
|
112 |
+} |
|
113 |
+ |
|
114 |
+_managepy-shell(){ |
|
115 |
+ _arguments -s : \ |
|
116 |
+ '--plain[tells Django to use plain Python, not IPython.]' \ |
|
117 |
+ $nul_args && ret=0 |
|
118 |
+} |
|
119 |
+ |
|
120 |
+_managepy-sql(){} |
|
121 |
+_managepy-sqlall(){} |
|
122 |
+_managepy-sqlclear(){} |
|
123 |
+_managepy-sqlcustom(){} |
|
124 |
+_managepy-sqlflush(){} |
|
125 |
+_managepy-sqlindexes(){} |
|
126 |
+_managepy-sqlinitialdata(){} |
|
127 |
+_managepy-sqlreset(){} |
|
128 |
+_managepy-sqlsequencereset(){} |
|
129 |
+_managepy-startapp(){} |
|
130 |
+ |
|
131 |
+_managepy-syncdb() { |
|
132 |
+ _arguments -s : \ |
|
133 |
+ '--verbosity=-[verbosity level; 0=minimal output, 1=normal output, 2=all output.]:Verbosity:((0\:minimal 1\:normal 2\:all))' \ |
|
134 |
+ '--noinput[tells Django to NOT prompt the user for input of any kind.]' \ |
|
135 |
+ $nul_args && ret=0 |
|
136 |
+} |
|
137 |
+ |
|
138 |
+_managepy-test() { |
|
139 |
+ _arguments -s : \ |
|
140 |
+ '--verbosity=-[verbosity level; 0=minimal output, 1=normal output, 2=all output.]:Verbosity:((0\:minimal 1\:normal 2\:all))' \ |
|
141 |
+ '--noinput[tells Django to NOT prompt the user for input of any kind.]' \ |
|
142 |
+ '*::appname:_applist' \ |
|
143 |
+ $nul_args && ret=0 |
|
144 |
+} |
|
145 |
+ |
|
146 |
+_managepy-testserver() { |
|
147 |
+ _arguments -s : \ |
|
148 |
+ '--verbosity=-[verbosity level; 0=minimal output, 1=normal output, 2=all output.]:Verbosity:((0\:minimal 1\:normal 2\:all))' \ |
|
149 |
+ '--addrport=-[port number or ipaddr:port to run the server on.]' \ |
|
150 |
+ '*::fixture:_files' \ |
|
151 |
+ $nul_args && ret=0 |
|
152 |
+} |
|
153 |
+ |
|
154 |
+_managepy-validate() { |
|
155 |
+ _arguments -s : \ |
|
156 |
+ $nul_args && ret=0 |
|
157 |
+} |
|
158 |
+ |
|
159 |
+_managepy-commands() { |
|
160 |
+ local -a commands |
|
161 |
+ |
|
162 |
+ commands=( |
|
163 |
+ 'adminindex:prints the admin-index template snippet for the given app name(s).' |
|
164 |
+ 'createcachetable:creates the table needed to use the SQL cache backend.' |
|
165 |
+ 'dbshell:runs the command-line client for the current DATABASE_ENGINE.' |
|
166 |
+ "diffsettings:displays differences between the current settings.py and Django's default settings." |
|
167 |
+ 'dumpdata:Output the contents of the database as a fixture of the given format.' |
|
168 |
+ 'flush:Executes ``sqlflush`` on the current database.' |
|
169 |
+ 'help:manage.py help.' |
|
170 |
+ 'inspectdb:Introspects the database tables in the given database and outputs a Django model module.' |
|
171 |
+ 'loaddata:Installs the named fixture(s) in the database.' |
|
172 |
+ 'reset:Executes ``sqlreset`` for the given app(s) in the current database.' |
|
173 |
+ 'runfcgi:Run this project as a fastcgi (or some other protocol supported by flup) application,' |
|
174 |
+ 'runserver:Starts a lightweight Web server for development.' |
|
175 |
+ 'shell:Runs a Python interactive interpreter.' |
|
176 |
+ 'sql:Prints the CREATE TABLE SQL statements for the given app name(s).' |
|
177 |
+ 'sqlall:Prints the CREATE TABLE, custom SQL and CREATE INDEX SQL statements for the given model module name(s).' |
|
178 |
+ 'sqlclear:Prints the DROP TABLE SQL statements for the given app name(s).' |
|
179 |
+ 'sqlcustom:Prints the custom table modifying SQL statements for the given app name(s).' |
|
180 |
+ 'sqlflush:Returns a list of the SQL statements required to return all tables in the database to the state they were in just after they were installed.' |
|
181 |
+ 'sqlindexes:Prints the CREATE INDEX SQL statements for the given model module name(s).' |
|
182 |
+ "sqlinitialdata:RENAMED: see 'sqlcustom'" |
|
183 |
+ 'sqlreset:Prints the DROP TABLE SQL, then the CREATE TABLE SQL, for the given app name(s).' |
|
184 |
+ 'sqlsequencereset:Prints the SQL statements for resetting sequences for the given app name(s).' |
|
185 |
+ "startapp:Creates a Django app directory structure for the given app name in this project's directory." |
|
186 |
+ "syncdb:Create the database tables for all apps in INSTALLED_APPS whose tables haven't already been created." |
|
187 |
+ 'test:Runs the test suite for the specified applications, or the entire site if no apps are specified.' |
|
188 |
+ 'testserver:Runs a development server with data from the given fixture(s).' |
|
189 |
+ 'validate:Validates all installed models.' |
|
190 |
+ ) |
|
191 |
+ |
|
192 |
+ _describe -t commands 'manage.py command' commands && ret=0 |
|
193 |
+} |
|
194 |
+ |
|
195 |
+_applist() { |
|
196 |
+ local line |
|
197 |
+ local -a apps |
|
198 |
+ _call_program help-command "python -c \"import os.path as op, re, django.conf, sys;\\ |
|
199 |
+ bn=op.basename(op.abspath(op.curdir));[sys\\ |
|
200 |
+ .stdout.write(str(re.sub(r'^%s\.(.*?)$' % |
|
201 |
+ bn, r'\1', i)) + '\n') for i in django.conf.settings.\\ |
|
202 |
+ INSTALLED_APPS if re.match(r'^%s' % bn, i)]\"" \ |
|
203 |
+ | while read -A line; do apps=($line $apps) done |
|
204 |
+ _values 'Application' $apps && ret=0 |
|
205 |
+} |
|
206 |
+ |
|
207 |
+_managepy() { |
|
208 |
+ local curcontext=$curcontext ret=1 |
|
209 |
+ |
|
210 |
+ if ((CURRENT == 2)); then |
|
211 |
+ _managepy-commands |
|
212 |
+ else |
|
213 |
+ shift words |
|
214 |
+ (( CURRENT -- )) |
|
215 |
+ curcontext="${curcontext%:*:*}:managepy-$words[1]:" |
|
216 |
+ _call_function ret _managepy-$words[1] |
|
217 |
+ fi |
|
218 |
+} |
|
219 |
+ |
|
220 |
+compdef _managepy manage.py |
|
221 |
+compdef _managepy django |
0 | 222 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,174 @@ |
0 |
+#compdef knife |
|
1 |
+ |
|
2 |
+# These flags should be available everywhere according to man knife |
|
3 |
+knife_general_flags=( --help --server-url --key --config --editor --format --log_level --logfile --no-editor --user --print-after --version --yes ) |
|
4 |
+ |
|
5 |
+# knife has a very special syntax, some example calls are: |
|
6 |
+# knife status |
|
7 |
+# knife cookbook list |
|
8 |
+# knife role show ROLENAME |
|
9 |
+# knife data bag show DATABAGNAME |
|
10 |
+# knife role show ROLENAME --attribute ATTRIBUTENAME |
|
11 |
+# knife cookbook show COOKBOOKNAME COOKBOOKVERSION recipes |
|
12 |
+ |
|
13 |
+# The -Q switch in compadd allow for completions of things like "data bag" without having to go through two rounds of completion and avoids zsh inserting a \ for escaping spaces |
|
14 |
+_knife() { |
|
15 |
+ local curcontext="$curcontext" state line |
|
16 |
+ typeset -A opt_args |
|
17 |
+ cloudproviders=(bluebox ec2 rackspace slicehost terremark) |
|
18 |
+ _arguments \ |
|
19 |
+ '1: :->knifecmd'\ |
|
20 |
+ '2: :->knifesubcmd'\ |
|
21 |
+ '3: :->knifesubcmd2' \ |
|
22 |
+ '4: :->knifesubcmd3' \ |
|
23 |
+ '5: :->knifesubcmd4' \ |
|
24 |
+ '6: :->knifesubcmd5' |
|
25 |
+ |
|
26 |
+ case $state in |
|
27 |
+ knifecmd) |
|
28 |
+ compadd -Q "$@" bootstrap client configure cookbook "cookbook site" "data bag" exec index node recipe role search ssh status windows $cloudproviders |
|
29 |
+ ;; |
|
30 |
+ knifesubcmd) |
|
31 |
+ case $words[2] in |
|
32 |
+ (bluebox|ec2|rackspace|slicehost|terremark) |
|
33 |
+ compadd "$@" server images |
|
34 |
+ ;; |
|
35 |
+ client) |
|
36 |
+ compadd -Q "$@" "bulk delete" list create show delete edit reregister |
|
37 |
+ ;; |
|
38 |
+ configure) |
|
39 |
+ compadd "$@" client |
|
40 |
+ ;; |
|
41 |
+ cookbook) |
|
42 |
+ compadd -Q "$@" test list create download delete "metadata from" show "bulk delete" metadata upload |
|
43 |
+ ;; |
|
44 |
+ node) |
|
45 |
+ compadd -Q "$@" "from file" create show edit delete list run_list "bulk delete" |
|
46 |
+ ;; |
|
47 |
+ recipe) |
|
48 |
+ compadd "$@" list |
|
49 |
+ ;; |
|
50 |
+ role) |
|
51 |
+ compadd -Q "$@" "bulk delete" create delete edit "from file" list show |
|
52 |
+ ;; |
|
53 |
+ windows) |
|
54 |
+ compadd "$@" bootstrap |
|
55 |
+ ;; |
|
56 |
+ *) |
|
57 |
+ _arguments '2:Subsubcommands:($(_knife_options1))' |
|
58 |
+ esac |
|
59 |
+ ;; |
|
60 |
+ knifesubcmd2) |
|
61 |
+ case $words[3] in |
|
62 |
+ server) |
|
63 |
+ compadd "$@" list create delete |
|
64 |
+ ;; |
|
65 |
+ images) |
|
66 |
+ compadd "$@" list |
|
67 |
+ ;; |
|
68 |
+ site) |
|
69 |
+ compadd "$@" vendor show share search download list unshare |
|
70 |
+ ;; |
|
71 |
+ (show|delete|edit) |
|
72 |
+ _arguments '3:Subsubcommands:($(_chef_$words[2]s_remote))' |
|
73 |
+ ;; |
|
74 |
+ (upload|test) |
|
75 |
+ _arguments '3:Subsubcommands:($(_chef_$words[2]s_local) --all)' |
|
76 |
+ ;; |
|
77 |
+ list) |
|
78 |
+ compadd -a "$@" knife_general_flags |
|
79 |
+ ;; |
|
80 |
+ bag) |
|
81 |
+ compadd -Q "$@" show edit list "from file" create delete |
|
82 |
+ ;; |
|
83 |
+ *) |
|
84 |
+ _arguments '3:Subsubcommands:($(_knife_options2))' |
|
85 |
+ esac |
|
86 |
+ ;; |
|
87 |
+ knifesubcmd3) |
|
88 |
+ case $words[3] in |
|
89 |
+ show) |
|
90 |
+ case $words[2] in |
|
91 |
+ cookbook) |
|
92 |
+ versioncomp=1 |
|
93 |
+ _arguments '4:Cookbookversions:($(_cookbook_versions) latest)' |
|
94 |
+ ;; |
|
95 |
+ (node|client|role) |
|
96 |
+ compadd "$@" --attribute |
|
97 |
+ esac |
|
98 |
+ esac |
|
99 |
+ case $words[4] in |
|
100 |
+ (show|edit) |
|
101 |
+ _arguments '4:Subsubsubcommands:($(_chef_$words[2]_$words[3]s_remote))' |
|
102 |
+ ;; |
|
103 |
+ file) |
|
104 |
+ _arguments '*:file or directory:_files -g "*.(rb|json)"' |
|
105 |
+ ;; |
|
106 |
+ list) |
|
107 |
+ compadd -a "$@" knife_general_flags |
|
108 |
+ ;; |
|
109 |
+ *) |
|
110 |
+ _arguments '*:Subsubcommands:($(_knife_options3))' |
|
111 |
+ esac |
|
112 |
+ ;; |
|
113 |
+ knifesubcmd4) |
|
114 |
+ if (( versioncomp > 0 )); then |
|
115 |
+ compadd "$@" attributes definitions files libraries providers recipes resources templates |
|
116 |
+ else |
|
117 |
+ _arguments '*:Subsubcommands:($(_knife_options2))' |
|
118 |
+ fi |
|
119 |
+ ;; |
|
120 |
+ knifesubcmd5) |
|
121 |
+ _arguments '*:Subsubcommands:($(_knife_options3))' |
|
122 |
+ esac |
|
123 |
+} |
|
124 |
+ |
|
125 |
+# Helper functions to provide the argument completion for several depths of commands |
|
126 |
+_knife_options1() { |
|
127 |
+ ( for line in $( knife $words[2] --help | grep -v "^knife" ); do echo $line | grep "\-\-"; done ) |
|
128 |
+} |
|
129 |
+ |
|
130 |
+_knife_options2() { |
|
131 |
+ ( for line in $( knife $words[2] $words[3] --help | grep -v "^knife" ); do echo $line | grep "\-\-"; done ) |
|
132 |
+} |
|
133 |
+ |
|
134 |
+_knife_options3() { |
|
135 |
+ ( for line in $( knife $words[2] $words[3] $words[4] --help | grep -v "^knife" ); do echo $line | grep "\-\-"; done ) |
|
136 |
+} |
|
137 |
+ |
|
138 |
+# The chef_x_remote functions use knife to get a list of objects of type x on the server |
|
139 |
+_chef_roles_remote() { |
|
140 |
+ (knife role list | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}') |
|
141 |
+} |
|
142 |
+ |
|
143 |
+_chef_clients_remote() { |
|
144 |
+ (knife client list | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}') |
|
145 |
+} |
|
146 |
+ |
|
147 |
+_chef_nodes_remote() { |
|
148 |
+ (knife node list | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}') |
|
149 |
+} |
|
150 |
+ |
|
151 |
+_chef_cookbooks_remote() { |
|
152 |
+ (knife cookbook list | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}') |
|
153 |
+} |
|
154 |
+ |
|
155 |
+_chef_sitecookbooks_remote() { |
|
156 |
+ (knife cookbook site list | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}') |
|
157 |
+} |
|
158 |
+ |
|
159 |
+_chef_data_bags_remote() { |
|
160 |
+ (knife data bag list | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}') |
|
161 |
+} |
|
162 |
+ |
|
163 |
+# The chef_x_local functions use the knife config to find the paths of relevant objects x to be uploaded to the server |
|
164 |
+_chef_cookbooks_local() { |
|
165 |
+ (for i in $( grep cookbook_path $HOME/.chef/knife.rb | awk 'BEGIN {FS = "[" }; {print $2}' | sed 's/\,//g' | sed "s/'//g" | sed 's/\(.*\)]/\1/' ); do ls $i; done) |
|
166 |
+} |
|
167 |
+ |
|
168 |
+# This function extracts the available cookbook versions on the chef server |
|
169 |
+_cookbook_versions() { |
|
170 |
+ (knife cookbook show $words[4] | grep -v $words[4] | grep -v -E '\]|\[|\{|\}' | sed 's/ //g' | sed 's/"//g') |
|
171 |
+} |
|
172 |
+ |
|
173 |
+_knife "$@" |
... | ... |
@@ -1,13 +1,5 @@ |
1 | 1 |
# Rails 3 aliases, backwards-compatible with Rails 2. |
2 | 2 |
|
3 |
-function _bundle_command { |
|
4 |
- if command -v bundle && [ -e "Gemfile" ]; then |
|
5 |
- bundle exec $@ |
|
6 |
- else |
|
7 |
- $@ |
|
8 |
- fi |
|
9 |
-} |
|
10 |
- |
|
11 | 3 |
function _rails_command () { |
12 | 4 |
if [ -e "script/server" ]; then |
13 | 5 |
ruby script/$@ |
... | ... |
@@ -25,6 +17,3 @@ alias rp='_rails_command plugin' |
25 | 25 |
alias rs='_rails_command server' |
26 | 26 |
alias rsd='_rails_command server --debugger' |
27 | 27 |
alias devlog='tail -f log/development.log' |
28 |
- |
|
29 |
-alias rspec='_bundle_command rspec' |
|
30 |
-alias cuke='_bundle_command cucumber' |
... | ... |
@@ -51,7 +51,7 @@ _1st_arguments=( |
51 | 51 |
'keys:find all keys matching the given pattern' |
52 | 52 |
'lastsave:get the UNIX timestamp of the last successful save to disk' |
53 | 53 |
'lindex:get an element from a list by its index' |
54 |
- 'linset:insert an element before or after another element in a list' |
|
54 |
+ 'linsert:insert an element before or after another element in a list' |
|
55 | 55 |
'llen:get the length of a list' |
56 | 56 |
'lpop:remove and get the first element in a list' |
57 | 57 |
'lpush:prepend a value to a list' |
... | ... |
@@ -1,23 +1,62 @@ |
1 |
-# Based on code from Joseph M. Reagle |
|
2 |
-# http://www.cygwin.com/ml/cygwin/2001-06/msg00537.html |
|
1 |
+# |
|
2 |
+# INSTRUCTIONS |
|
3 |
+# |
|
4 |
+# To enabled agent forwarding support add the following to |
|
5 |
+# your .zshrc file: |
|
6 |
+# |
|
7 |
+# zstyle :omz:plugins:ssh-agent agent-forwarding on |
|
8 |
+# |
|
9 |
+# To load multiple identies use the identities style, For |
|
10 |
+# example: |
|
11 |
+# |
|
12 |
+# zstyle :omz:plugins:ssh-agent id_rsa id_rsa2 id_github |
|
13 |
+# |
|
14 |
+# |
|
15 |
+# CREDITS |
|
16 |
+# |
|
17 |
+# Based on code from Joseph M. Reagle |
|
18 |
+# http://www.cygwin.com/ml/cygwin/2001-06/msg00537.html |
|
19 |
+# |
|
20 |
+# Agent forwarding support based on ideas from |
|
21 |
+# Florent Thoumie and Jonas Pfenniger |
|
22 |
+# |
|
3 | 23 |
|
4 |
-local SSH_ENV=$HOME/.ssh/environment-$HOST |
|
24 |
+local _plugin__ssh_env=$HOME/.ssh/environment-$HOST |
|
25 |
+local _plugin__forwarding |
|
5 | 26 |
|
6 |
-function start_agent { |
|
7 |
- /usr/bin/env ssh-agent | sed 's/^echo/#echo/' > ${SSH_ENV} |
|
8 |
- chmod 600 ${SSH_ENV} |
|
9 |
- . ${SSH_ENV} > /dev/null |
|
10 |
- /usr/bin/ssh-add; |
|
27 |
+function _plugin__start_agent() |
|
28 |
+{ |
|
29 |
+ local -a identities |
|
30 |
+ |
|
31 |
+ # start ssh-agent and setup environment |
|
32 |
+ /usr/bin/env ssh-agent | sed 's/^echo/#echo/' > ${_plugin__ssh_env} |
|
33 |
+ chmod 600 ${_plugin__ssh_env} |
|
34 |
+ . ${_plugin__ssh_env} > /dev/null |
|
35 |
+ |
|
36 |
+ # load identies |
|
37 |
+ zstyle -a :omz:plugins:ssh-agent identities identities |
|
38 |
+ echo starting... |
|
39 |
+ /usr/bin/ssh-add $HOME/.ssh/${^identities} |
|
11 | 40 |
} |
12 | 41 |
|
13 |
-# Source SSH settings, if applicable |
|
42 |
+# test if agent-forwarding is enabled |
|
43 |
+zstyle -b :omz:plugins:ssh-agent agent-forwarding _plugin__forwarding |
|
44 |
+if [[ ${_plugin__forwarding} == "yes" && -n "$SSH_AUTH_SOCK" ]]; then |
|
45 |
+ # Add a nifty symlink for screen/tmux if agent forwarding |
|
46 |
+ [[ -L $SSH_AUTH_SOCK ]] || ln -sf "$SSH_AUTH_SOCK" /tmp/ssh-agent-$USER-screen |
|
14 | 47 |
|
15 |
-if [ -f "${SSH_ENV}" ]; then |
|
16 |
- . ${SSH_ENV} > /dev/null |
|
48 |
+elif [ -f "${_plugin__ssh_env}" ]; then |
|
49 |
+ # Source SSH settings, if applicable |
|
50 |
+ . ${_plugin__ssh_env} > /dev/null |
|
17 | 51 |
ps -ef | grep ${SSH_AGENT_PID} | grep ssh-agent$ > /dev/null || { |
18 |
- start_agent; |
|
52 |
+ _plugin__start_agent; |
|
19 | 53 |
} |
20 | 54 |
else |
21 |
- start_agent; |
|
55 |
+ _plugin__start_agent; |
|
22 | 56 |
fi |
23 | 57 |
|
58 |
+# tidy up after ourselves |
|
59 |
+unfunction _plugin__start_agent |
|
60 |
+unset _plugin__forwarding |
|
61 |
+unset _plugin__ssh_env |
|
62 |
+ |
24 | 63 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,280 @@ |
0 |
+#compdef task |
|
1 |
+# |
|
2 |
+# zsh completion for taskwarrior |
|
3 |
+# |
|
4 |
+# Copyright 2010 - 2011 Johannes Schlatow |
|
5 |
+# Copyright 2009 P.C. Shyamshankar |
|
6 |
+# All rights reserved. |
|
7 |
+# |
|
8 |
+# This script is part of the taskwarrior project. |
|
9 |
+# |
|
10 |
+# This program is free software; you can redistribute it and/or modify it under |
|
11 |
+# the terms of the GNU General Public License as published by the Free Software |
|
12 |
+# Foundation; either version 2 of the License, or (at your option) any later |
|
13 |
+# version. |
|
14 |
+# |
|
15 |
+# This program is distributed in the hope that it will be useful, but WITHOUT |
|
16 |
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
|
17 |
+# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
|
18 |
+# details. |
|
19 |
+# |
|
20 |
+# You should have received a copy of the GNU General Public License along with |
|
21 |
+# this program; if not, write to the |
|
22 |
+# |
|
23 |
+# Free Software Foundation, Inc., |
|
24 |
+# 51 Franklin Street, Fifth Floor, |
|
25 |
+# Boston, MA |
|
26 |
+# 02110-1301 |
|
27 |
+# USA |
|
28 |
+# |
|
29 |
+typeset -g _task_cmds _task_projects _task_tags _task_config _task_modifiers |
|
30 |
+_task_projects=($(task _projects)) |
|
31 |
+_task_tags=($(task _tags)) |
|
32 |
+_task_ids=($(task _ids)) |
|
33 |
+_task_config=($(task _config)) |
|
34 |
+_task_modifiers=( |
|
35 |
+ 'before' \ |
|
36 |
+ 'after' \ |
|
37 |
+ 'none' \ |
|
38 |
+ 'any' \ |
|
39 |
+ 'is' \ |
|
40 |
+ 'isnt' \ |
|
41 |
+ 'has' \ |
|
42 |
+ 'hasnt' \ |
|
43 |
+ 'startswith' \ |
|
44 |
+ 'endswith' \ |
|
45 |
+ 'word' \ |
|
46 |
+ 'noword' |
|
47 |
+) |
|
48 |
+_task_cmds=($(task _commands)) |
|
49 |
+_task_zshcmds=( ${(f)"$(task _zshcommands)"} ) |
|
50 |
+ |
|
51 |
+ |
|
52 |
+_task_idCmds=( |
|
53 |
+ 'append' \ |
|
54 |
+ 'prepend' \ |
|
55 |
+ 'annotate' \ |
|
56 |
+ 'denotate' \ |
|
57 |
+ 'edit' \ |
|
58 |
+ 'duplicate' \ |
|
59 |
+ 'info' \ |
|
60 |
+ 'start' \ |
|
61 |
+ 'stop' \ |
|
62 |
+ 'done' |
|
63 |
+) |
|
64 |
+ |
|
65 |
+_task_idCmdsDesc=( |
|
66 |
+ 'append:Appends more description to an existing task.' \ |
|
67 |
+ 'prepend:Prepends more description to an existing task.' \ |
|
68 |
+ 'annotate:Adds an annotation to an existing task.' \ |
|
69 |
+ 'denotate:Deletes an annotation of an existing task.' \ |
|
70 |
+ 'edit:Launches an editor to let you modify a task directly.' \ |
|
71 |
+ 'duplicate:Duplicates the specified task, and allows modifications.' \ |
|
72 |
+ 'info:Shows all data, metadata for specified task.' \ |
|
73 |
+ 'start:Marks specified task as started.' \ |
|
74 |
+ 'stop:Removes the start time from a task.' \ |
|
75 |
+ 'done:Marks the specified task as completed.' |
|
76 |
+) |
|
77 |
+ |
|
78 |
+_task() { |
|
79 |
+ _arguments -s -S \ |
|
80 |
+ "*::task command:_task_commands" |
|
81 |
+ return 0 |
|
82 |
+} |
|
83 |
+ |
|
84 |
+local -a reply args word |
|
85 |
+word=$'[^\0]#\0' |
|
86 |
+ |
|
87 |
+# priorities |
|
88 |
+local -a task_priorities |
|
89 |
+_regex_words values 'task priorities' \ |
|
90 |
+ 'H:High' \ |
|
91 |
+ 'M:Middle' \ |
|
92 |
+ 'L:Low' |
|
93 |
+task_priorities=("$reply[@]") |
|
94 |
+ |
|
95 |
+# projects |
|
96 |
+local -a task_projects |
|
97 |
+task_projects=( |
|
98 |
+ /"$word"/ |
|
99 |
+ ":values:task projects:compadd -a _task_projects" |
|
100 |
+) |
|
101 |
+ |
|
102 |
+local -a _task_dates |
|
103 |
+_regex_words values 'task dates' \ |
|
104 |
+ 'tod*ay:Today' \ |
|
105 |
+ 'yes*terday:Yesterday' \ |
|
106 |
+ 'tom*orrow:Tomorrow' \ |
|
107 |
+ 'sow:Start of week' \ |
|
108 |
+ 'soww:Start of work week' \ |
|
109 |
+ 'socw:Start of calendar week' \ |
|
110 |
+ 'som:Start of month' \ |
|
111 |
+ 'soy:Start of year' \ |
|
112 |
+ 'eow:End of week' \ |
|
113 |
+ 'eoww:End of work week' \ |
|
114 |
+ 'eocw:End of calendar week' \ |
|
115 |
+ 'eom:End of month' \ |
|
116 |
+ 'eoy:End of year' \ |
|
117 |
+ 'mon:Monday' \ |
|
118 |
+ 'tue:Tuesday'\ |
|
119 |
+ 'wed:Wednesday' \ |
|
120 |
+ 'thu:Thursday' \ |
|
121 |
+ 'fri:Friday' \ |
|
122 |
+ 'sat:Saturday' \ |
|
123 |
+ 'sun:Sunday' |
|
124 |
+_task_dates=("$reply[@]") |
|
125 |
+ |
|
126 |
+local -a _task_reldates |
|
127 |
+_regex_words values 'task reldates' \ |
|
128 |
+ 'hrs:n hours' \ |
|
129 |
+ 'day:n days' \ |
|
130 |
+ '1st:first' \ |
|
131 |
+ '2nd:second' \ |
|
132 |
+ '3rd:third' \ |
|
133 |
+ 'th:4th, 5th, etc.' \ |
|
134 |
+ 'wks:weeks' |
|
135 |
+_task_reldates=("$reply[@]") |
|
136 |
+ |
|
137 |
+task_dates=( |
|
138 |
+ \( "$_task_dates[@]" \| |
|
139 |
+ \( /$'[0-9][0-9]#'/- \( "$_task_reldates[@]" \) \) |
|
140 |
+ \) |
|
141 |
+) |
|
142 |
+ |
|
143 |
+_regex_words values 'task frequencies' \ |
|
144 |
+ 'daily:Every day' \ |
|
145 |
+ 'day:Every day' \ |
|
146 |
+ 'weekdays:Every day skipping weekend days' \ |
|
147 |
+ 'weekly:Every week' \ |
|
148 |
+ 'biweekly:Every two weeks' \ |
|
149 |
+ 'fortnight:Every two weeks' \ |
|
150 |
+ 'quarterly:Every three months' \ |
|
151 |
+ 'semiannual:Every six months' \ |
|
152 |
+ 'annual:Every year' \ |
|
153 |
+ 'yearly:Every year' \ |
|
154 |
+ 'biannual:Every two years' \ |
|
155 |
+ 'biyearly:Every two years' |
|
156 |
+_task_freqs=("$reply[@]") |
|
157 |
+ |
|
158 |
+local -a _task_frequencies |
|
159 |
+_regex_words values 'task frequencies' \ |
|
160 |
+ 'd:days' \ |
|
161 |
+ 'w:weeks' \ |
|
162 |
+ 'q:quarters' \ |
|
163 |
+ 'y:years' |
|
164 |
+_task_frequencies=("$reply[@]") |
|
165 |
+ |
|
166 |
+task_freqs=( |
|
167 |
+ \( "$_task_freqs[@]" \| |
|
168 |
+ \( /$'[0-9][0-9]#'/- \( "$_task_frequencies[@]" \) \) |
|
169 |
+ \) |
|
170 |
+) |
|
171 |
+ |
|
172 |
+# attributes |
|
173 |
+local -a task_attributes |
|
174 |
+_regex_words -t ':' default 'task attributes' \ |
|
175 |
+ 'pro*ject:Project name:$task_projects' \ |
|
176 |
+ 'du*e:Due date:$task_dates' \ |
|
177 |
+ 'wa*it:Date until task becomes pending:$task_dates' \ |
|
178 |
+ 're*cur:Recurrence frequency:$task_freqs' \ |
|
179 |
+ 'pri*ority:priority:$task_priorities' \ |
|
180 |
+ 'un*til:Recurrence end date:$task_dates' \ |
|
181 |
+ 'fg:Foreground color' \ |
|
182 |
+ 'bg:Background color' \ |
|
183 |
+ 'li*mit:Desired number of rows in report' |
|
184 |
+task_attributes=("$reply[@]") |
|
185 |
+ |
|
186 |
+args=( |
|
187 |
+ \( "$task_attributes[@]" \| |
|
188 |
+ \( /'(project|due|wait|recur|priority|until|fg|bg|limit).'/- \( /$'[^:]#:'/ ":default:modifiers:compadd -S ':' -a _task_modifiers" \) \) \| |
|
189 |
+ \( /'(rc).'/- \( /$'[^:]#:'/ ":arguments:config:compadd -S ':' -a _task_config" \) \) \| |
|
190 |
+ \( /'(+|-)'/- \( /"$word"/ ":values:remove tag:compadd -a _task_tags" \) \) \| |
|
191 |
+ \( /"$word"/ \) |
|
192 |
+ \) \# |
|
193 |
+) |
|
194 |
+_regex_arguments _task_attributes "${args[@]}" |
|
195 |
+ |
|
196 |
+## task commands |
|
197 |
+ |
|
198 |
+# default completion |
|
199 |
+(( $+functions[_task_default] )) || |
|
200 |
+_task_default() { |
|
201 |
+ _task_attributes "$@" |
|
202 |
+} |
|
203 |
+ |
|
204 |
+# commands expecting an ID |
|
205 |
+(( $+functions[_task_id] )) || |
|
206 |
+_task_id() { |
|
207 |
+ if (( CURRENT < 3 )); then |
|
208 |
+ # update IDs |
|
209 |
+ _task_zshids=( ${(f)"$(task _zshids)"} ) |
|
210 |
+ _describe -t values 'task IDs' _task_zshids |
|
211 |
+ else |
|
212 |
+ _task_attributes "$@" |
|
213 |
+ fi |
|
214 |
+} |
|
215 |
+ |
|
216 |
+# merge completion |
|
217 |
+(( $+functions[_task_merge] )) || |
|
218 |
+_task_merge() { |
|
219 |
+ # TODO match URIs in .taskrc |
|
220 |
+ _files |
|
221 |
+} |
|
222 |
+ |
|
223 |
+# push completion |
|
224 |
+(( $+functions[_task_push] )) || |
|
225 |
+_task_push() { |
|
226 |
+ # TODO match URIs in .taskrc |
|
227 |
+ _files |
|
228 |
+} |
|
229 |
+ |
|
230 |
+# pull completion |
|
231 |
+(( $+functions[_task_pull] )) || |
|
232 |
+_task_pull() { |
|
233 |
+ # TODO match URIs in .taskrc |
|
234 |
+ _files |
|
235 |
+} |
|
236 |
+ |
|
237 |
+ |
|
238 |
+# modify (task [0-9]* ...) completion |
|
239 |
+(( $+functions[_task_modify] )) || |
|
240 |
+_task_modify() { |
|
241 |
+ _describe -t commands 'task command' _task_idCmdsDesc |
|
242 |
+ _task_attributes "$@" |
|
243 |
+} |
|
244 |
+ |
|
245 |
+## first level completion => task sub-command completion |
|
246 |
+(( $+functions[_task_commands] )) || |
|
247 |
+_task_commands() { |
|
248 |
+ local cmd ret=1 |
|
249 |
+ if (( CURRENT == 1 )); then |
|
250 |
+ # update IDs |
|
251 |
+ _task_zshids=( ${(f)"$(task _zshids)"} ) |
|
252 |
+ |
|
253 |
+ _describe -t commands 'task command' _task_zshcmds |
|
254 |
+ _describe -t values 'task IDs' _task_zshids |
|
255 |
+ # TODO match more than one ID |
|
256 |
+ elif [[ $words[1] =~ ^[0-9]*$ ]] then |
|
257 |
+ _call_function ret _task_modify |
|
258 |
+ return ret |
|
259 |
+ else |
|
260 |
+# local curcontext="${curcontext}" |
|
261 |
+# cmd="${_task_cmds[(r)$words[1]:*]%%:*}" |
|
262 |
+ cmd="${_task_cmds[(r)$words[1]]}" |
|
263 |
+ idCmd="${(M)_task_idCmds[@]:#$words[1]}" |
|
264 |
+ if (( $#cmd )); then |
|
265 |
+# curcontext="${curcontext%:*:*}:task-${cmd}" |
|
266 |
+ |
|
267 |
+ if (( $#idCmd )); then |
|
268 |
+ _call_function ret _task_id |
|
269 |
+ else |
|
270 |
+ _call_function ret _task_${cmd} || |
|
271 |
+ _call_function ret _task_default || |
|
272 |
+ _message "No command remaining." |
|
273 |
+ fi |
|
274 |
+ else |
|
275 |
+ _message "Unknown subcommand ${cmd}" |
|
276 |
+ fi |
|
277 |
+ return ret |
|
278 |
+ fi |
|
279 |
+} |
0 | 280 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,21 @@ |
0 |
+################################################################################ |
|
1 |
+# Author: Pete Clark |
|
2 |
+# Email: pete[dot]clark[at]gmail[dot]com |
|
3 |
+# Version: 0.1 (05/24/2011) |
|
4 |
+# License: WTFPL<http://sam.zoy.org/wtfpl/> |
|
5 |
+# |
|
6 |
+# This oh-my-zsh plugin adds smart tab completion for |
|
7 |
+# TaskWarrior<http://taskwarrior.org/>. It uses the zsh tab completion |
|
8 |
+# script (_task) distributed with TaskWarrior for the completion definitions. |
|
9 |
+# |
|
10 |
+# Typing task[tabtab] will give you a list of current tasks, task 66[tabtab] |
|
11 |
+# gives a list of available modifications for that task, etc. |
|
12 |
+################################################################################ |
|
13 |
+ |
|
14 |
+zstyle ':completion:*:*:task:*' verbose yes |
|
15 |
+zstyle ':completion:*:*:task:*:descriptions' format '%U%B%d%b%u' |
|
16 |
+ |
|
17 |
+zstyle ':completion:*:*:task:*' group-name '' |
|
18 |
+ |
|
19 |
+alias t=task |
|
20 |
+compdef _task t=task |
0 | 21 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,20 @@ |
0 |
+# https://github.com/blinks zsh theme |
|
1 |
+ |
|
2 |
+function _prompt_char() { |
|
3 |
+ if $(git rev-parse --is-inside-work-tree >/dev/null 2>&1); then |
|
4 |
+ echo "%{%F{blue}%}±%{%f%k%b%}" |
|
5 |
+ else |
|
6 |
+ echo ' ' |
|
7 |
+ fi |
|
8 |
+} |
|
9 |
+ |
|
10 |
+ZSH_THEME_GIT_PROMPT_PREFIX=" [%{%B%F{blue}%}" |
|
11 |
+ZSH_THEME_GIT_PROMPT_SUFFIX="%{%f%k%b%K{black}%B%F{green}%}]" |
|
12 |
+ZSH_THEME_GIT_PROMPT_DIRTY=" %{%F{red}%}*%{%f%k%b%}" |
|
13 |
+ZSH_THEME_GIT_PROMPT_CLEAN="" |
|
14 |
+ |
|
15 |
+PROMPT='%{%f%k%b%} |
|
16 |
+%{%K{black}%B%F{green}%}%n%{%B%F{blue}%}@%{%B%F{cyan}%}%m%{%B%F{green}%} %{%b%F{yellow}%K{black}%}%~%{%B%F{green}%}$(git_prompt_info)%E%{%f%k%b%} |
|
17 |
+%{%K{black}%}$(_prompt_char)%{%K{black}%} %#%{%f%k%b%} ' |
|
18 |
+ |
|
19 |
+RPROMPT='!%{%B%F{cyan}%}%!%{%f%k%b%}' |
... | ... |
@@ -7,8 +7,8 @@ RPROMPT='[%*]' |
7 | 7 |
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}(%{$fg_no_bold[red]%}%B" |
8 | 8 |
ZSH_THEME_GIT_PROMPT_SUFFIX="%b%{$fg_bold[blue]%})%{$reset_color%} " |
9 | 9 |
ZSH_THEME_GIT_PROMPT_CLEAN="" |
10 |
-ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg_bold[red]%}" |
|
10 |
+ZSH_THEME_GIT_PROMPT_DIRTY="*" |
|
11 | 11 |
|
12 | 12 |
# LS colors, made with http://geoff.greer.fm/lscolors/ |
13 | 13 |
export LSCOLORS="Gxfxcxdxbxegedabagacad" |
14 |
-export LS_COLORS='no=00:fi=00:di=01;34:ln=00;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=41;33;01:ex=00;32:*.cmd=00;32:*.exe=01;32:*.com=01;32:*.bat=01;32:*.btm=01;32:*.dll=01;32:*.tar=00;31:*.tbz=00;31:*.tgz=00;31:*.rpm=00;31:*.deb=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.lzma=00;31:*.zip=00;31:*.zoo=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.tb2=00;31:*.tz2=00;31:*.tbz2=00;31:*.avi=01;35:*.bmp=01;35:*.fli=01;35:*.gif=01;35:*.jpg=01;35:*.jpeg=01;35:*.mng=01;35:*.mov=01;35:*.mpg=01;35:*.pcx=01;35:*.pbm=01;35:*.pgm=01;35:*.png=01;35:*.ppm=01;35:*.tga=01;35:*.tif=01;35:*.xbm=01;35:*.xpm=01;35:*.dl=01;35:*.gl=01;35:*.wmv=01;35:*.aiff=00;32:*.au=00;32:*.mid=00;32:*.mp3=00;32:*.ogg=00;32:*.voc=00;32:*.wav=00;32:' |
|
14 |
+export LS_COLORS='no=00:fi=00:di=01;34:ln=00;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=41;33;01:ex=00;32:*.cmd=00;32:*.exe=01;32:*.com=01;32:*.bat=01;32:*.btm=01;32:*.dll=01;32:*.tar=00;31:*.tbz=00;31:*.tgz=00;31:*.rpm=00;31:*.deb=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.lzma=00;31:*.zip=00;31:*.zoo=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.tb2=00;31:*.tz2=00;31:*.tbz2=00;31:*.avi=01;35:*.bmp=01;35:*.fli=01;35:*.gif=01;35:*.jpg=01;35:*.jpeg=01;35:*.mng=01;35:*.mov=01;35:*.mpg=01;35:*.pcx=01;35:*.pbm=01;35:*.pgm=01;35:*.png=01;35:*.ppm=01;35:*.tga=01;35:*.tif=01;35:*.xbm=01;35:*.xpm=01;35:*.dl=01;35:*.gl=01;35:*.wmv=01;35:*.aiff=00;32:*.au=00;32:*.mid=00;32:*.mp3=00;32:*.ogg=00;32:*.voc=00;32:*.wav=00;32:*.patch=00;34:*.o=00;32:*.so=01;35:*.ko=01;31:*.la=00;33' |
15 | 15 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,96 @@ |
0 |
+#------------------------------------------------------------------------------- |
|
1 |
+# Sunrise theme for oh-my-zsh by Adam Lindberg (eproxus@gmail.com) |
|
2 |
+# Intended to be used with Solarized: http://ethanschoonover.com/solarized |
|
3 |
+# (Needs Git plugin for current_branch method) |
|
4 |
+#------------------------------------------------------------------------------- |
|
5 |
+ |
|
6 |
+# Color shortcuts |
|
7 |
+R=$fg[red] |
|
8 |
+G=$fg[green] |
|
9 |
+M=$fg[magenta] |
|
10 |
+RB=$fg_bold[red] |
|
11 |
+YB=$fg_bold[yellow] |
|
12 |
+BB=$fg_bold[blue] |
|
13 |
+RESET=$reset_color |
|
14 |
+ |
|
15 |
+if [ "$(whoami)" = "root" ]; then |
|
16 |
+ PROMPTCOLOR="%{$RB%}" PREFIX="-!-"; |
|
17 |
+else |
|
18 |
+ PROMPTCOLOR="" PREFIX="---"; |
|
19 |
+fi |
|
20 |
+ |
|
21 |
+local return_code="%(?..%{$R%}%? ↵%{$RESET%})" |
|
22 |
+ |
|
23 |
+# Get the status of the working tree (copied and modified from git.zsh) |
|
24 |
+custom_git_prompt_status() { |
|
25 |
+ INDEX=$(git status --porcelain 2> /dev/null) |
|
26 |
+ STATUS="" |
|
27 |
+ # Non-staged |
|
28 |
+ if $(echo "$INDEX" | grep '^?? ' &> /dev/null); then |
|
29 |
+ STATUS="$ZSH_THEME_GIT_PROMPT_UNTRACKED$STATUS" |
|
30 |
+ fi |
|
31 |
+ if $(echo "$INDEX" | grep '^UU ' &> /dev/null); then |
|
32 |
+ STATUS="$ZSH_THEME_GIT_PROMPT_UNMERGED$STATUS" |
|
33 |
+ fi |
|
34 |
+ if $(echo "$INDEX" | grep '^ D ' &> /dev/null); then |
|
35 |
+ STATUS="$ZSH_THEME_GIT_PROMPT_DELETED$STATUS" |
|
36 |
+ fi |
|
37 |
+ if $(echo "$INDEX" | grep '^.M ' &> /dev/null); then |
|
38 |
+ STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS" |
|
39 |
+ elif $(echo "$INDEX" | grep '^AM ' &> /dev/null); then |
|
40 |
+ STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS" |
|
41 |
+ elif $(echo "$INDEX" | grep '^ T ' &> /dev/null); then |
|
42 |
+ STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS" |
|
43 |
+ fi |
|
44 |
+ # Staged |
|
45 |
+ if $(echo "$INDEX" | grep '^D ' &> /dev/null); then |
|
46 |
+ STATUS="$ZSH_THEME_GIT_PROMPT_STAGED_DELETED$STATUS" |
|
47 |
+ fi |
|
48 |
+ if $(echo "$INDEX" | grep '^R' &> /dev/null); then |
|
49 |
+ STATUS="$ZSH_THEME_GIT_PROMPT_STAGED_RENAMED$STATUS" |
|
50 |
+ fi |
|
51 |
+ if $(echo "$INDEX" | grep '^M' &> /dev/null); then |
|
52 |
+ STATUS="$ZSH_THEME_GIT_PROMPT_STAGED_MODIFIED$STATUS" |
|
53 |
+ fi |
|
54 |
+ if $(echo "$INDEX" | grep '^A' &> /dev/null); then |
|
55 |
+ STATUS="$ZSH_THEME_GIT_PROMPT_STAGED_ADDED$STATUS" |
|
56 |
+ fi |
|
57 |
+ |
|
58 |
+ if $(echo -n "$STATUS" | grep '.*' &> /dev/null); then |
|
59 |
+ STATUS="$ZSH_THEME_GIT_STATUS_PREFIX$STATUS" |
|
60 |
+ fi |
|
61 |
+ |
|
62 |
+ echo $STATUS |
|
63 |
+} |
|
64 |
+ |
|
65 |
+# get the name of the branch we are on (copied and modified from git.zsh) |
|
66 |
+function custom_git_prompt() { |
|
67 |
+ ref=$(git symbolic-ref HEAD 2> /dev/null) || return |
|
68 |
+ echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$(parse_git_dirty)$(git_prompt_ahead)$(custom_git_prompt_status)$ZSH_THEME_GIT_PROMPT_SUFFIX" |
|
69 |
+} |
|
70 |
+ |
|
71 |
+# %B sets bold text |
|
72 |
+PROMPT='%B$PREFIX %2~ $(custom_git_prompt)%{$M%}%B»%b%{$RESET%} ' |
|
73 |
+RPS1="${return_code}" |
|
74 |
+ |
|
75 |
+ZSH_THEME_GIT_PROMPT_PREFIX="%{$YB%}‹" |
|
76 |
+ZSH_THEME_GIT_PROMPT_SUFFIX="%{$YB%}›%{$RESET%} " |
|
77 |
+ |
|
78 |
+ZSH_THEME_GIT_PROMPT_DIRTY="%{$R%}*" |
|
79 |
+ZSH_THEME_GIT_PROMPT_CLEAN="" |
|
80 |
+ |
|
81 |
+ZSH_THEME_GIT_PROMPT_AHEAD="%{$BB%}➔" |
|
82 |
+ |
|
83 |
+ZSH_THEME_GIT_STATUS_PREFIX=" " |
|
84 |
+ |
|
85 |
+# Staged |
|
86 |
+ZSH_THEME_GIT_PROMPT_STAGED_ADDED="%{$G%}A" |
|
87 |
+ZSH_THEME_GIT_PROMPT_STAGED_MODIFIED="%{$G%}M" |
|
88 |
+ZSH_THEME_GIT_PROMPT_STAGED_RENAMED="%{$G%}R" |
|
89 |
+ZSH_THEME_GIT_PROMPT_STAGED_DELETED="%{$G%}D" |
|
90 |
+ |
|
91 |
+# Not-staged |
|
92 |
+ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$R%}⁇" |
|
93 |
+ZSH_THEME_GIT_PROMPT_MODIFIED="%{$R%}M" |
|
94 |
+ZSH_THEME_GIT_PROMPT_DELETED="%{$R%}D" |
|
95 |
+ZSH_THEME_GIT_PROMPT_UNMERGED="%{$R%}UU" |
... | ... |
@@ -9,4 +9,4 @@ echo "\033[0;32m"'\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ '"\033[0m |
9 | 9 |
echo "\033[0;32m"' /____/ '"\033[0m" |
10 | 10 |
echo "\033[0;34mHooray! Oh My Zsh has been updated and/or is at the current version.\033[0m" |
11 | 11 |
echo "\033[0;34mTo keep up on the latest, be sure to follow Oh My Zsh on twitter: \033[1mhttp://twitter.com/ohmyzsh\033[0m" |
12 |
-cd $current_path |
|
12 |
+cd "$current_path" |