codelation-cli 0.0.18 → 0.0.19
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/codelation.rb +1 -0
- data/lib/codelation/development.rb +6 -0
- data/lib/codelation/development/psequel.rb +15 -0
- data/lib/codelation/version.rb +1 -1
- data/resources/dot_files/.git-completion.bash +2151 -2065
- data/resources/dot_files/.git-prompt.sh +111 -24
- metadata +3 -2
@@ -60,11 +60,16 @@
|
|
60
60
|
# of values:
|
61
61
|
#
|
62
62
|
# verbose show number of commits ahead/behind (+/-) upstream
|
63
|
+
# name if verbose, then also show the upstream abbrev name
|
63
64
|
# legacy don't use the '--count' option available in recent
|
64
65
|
# versions of git-rev-list
|
65
66
|
# git always compare HEAD to @{upstream}
|
66
67
|
# svn always compare HEAD to your SVN upstream
|
67
68
|
#
|
69
|
+
# You can change the separator between the branch name and the above
|
70
|
+
# state symbols by setting GIT_PS1_STATESEPARATOR. The default separator
|
71
|
+
# is SP.
|
72
|
+
#
|
68
73
|
# By default, __git_ps1 will compare HEAD to your SVN upstream if it can
|
69
74
|
# find one, or @{upstream} otherwise. Once you have set
|
70
75
|
# GIT_PS1_SHOWUPSTREAM, you can override it on a per-repository basis by
|
@@ -83,6 +88,15 @@
|
|
83
88
|
# GIT_PS1_SHOWCOLORHINTS to a nonempty value. The colors are based on
|
84
89
|
# the colored output of "git status -sb" and are available only when
|
85
90
|
# using __git_ps1 for PROMPT_COMMAND or precmd.
|
91
|
+
#
|
92
|
+
# If you would like __git_ps1 to do nothing in the case when the current
|
93
|
+
# directory is set up to be ignored by git, then set
|
94
|
+
# GIT_PS1_HIDE_IF_PWD_IGNORED to a nonempty value. Override this on the
|
95
|
+
# repository level by setting bash.hideIfPwdIgnored to "false".
|
96
|
+
|
97
|
+
# check whether printf supports -v
|
98
|
+
__git_printf_supports_v=
|
99
|
+
printf -v __git_printf_supports_v -- '%s' yes >/dev/null 2>&1
|
86
100
|
|
87
101
|
# stores the divergence from upstream in $p
|
88
102
|
# used by GIT_PS1_SHOWUPSTREAM
|
@@ -90,7 +104,7 @@ __git_ps1_show_upstream ()
|
|
90
104
|
{
|
91
105
|
local key value
|
92
106
|
local svn_remote svn_url_pattern count n
|
93
|
-
local upstream=git legacy="" verbose=""
|
107
|
+
local upstream=git legacy="" verbose="" name=""
|
94
108
|
|
95
109
|
svn_remote=()
|
96
110
|
# get some config options from git-config
|
@@ -106,7 +120,7 @@ __git_ps1_show_upstream ()
|
|
106
120
|
;;
|
107
121
|
svn-remote.*.url)
|
108
122
|
svn_remote[$((${#svn_remote[@]} + 1))]="$value"
|
109
|
-
svn_url_pattern
|
123
|
+
svn_url_pattern="$svn_url_pattern\\|$value"
|
110
124
|
upstream=svn+git # default upstream is SVN if available, else git
|
111
125
|
;;
|
112
126
|
esac
|
@@ -118,6 +132,7 @@ __git_ps1_show_upstream ()
|
|
118
132
|
git|svn) upstream="$option" ;;
|
119
133
|
verbose) verbose=1 ;;
|
120
134
|
legacy) legacy=1 ;;
|
135
|
+
name) name=1 ;;
|
121
136
|
esac
|
122
137
|
done
|
123
138
|
|
@@ -200,6 +215,18 @@ __git_ps1_show_upstream ()
|
|
200
215
|
*) # diverged from upstream
|
201
216
|
p=" u+${count#* }-${count% *}" ;;
|
202
217
|
esac
|
218
|
+
if [[ -n "$count" && -n "$name" ]]; then
|
219
|
+
__git_ps1_upstream_name=$(git rev-parse \
|
220
|
+
--abbrev-ref "$upstream" 2>/dev/null)
|
221
|
+
if [ $pcmode = yes ] && [ $ps1_expanded = yes ]; then
|
222
|
+
p="$p \${__git_ps1_upstream_name}"
|
223
|
+
else
|
224
|
+
p="$p ${__git_ps1_upstream_name}"
|
225
|
+
# not needed anymore; keep user's
|
226
|
+
# environment clean
|
227
|
+
unset __git_ps1_upstream_name
|
228
|
+
fi
|
229
|
+
fi
|
203
230
|
fi
|
204
231
|
|
205
232
|
}
|
@@ -250,6 +277,13 @@ __git_ps1_colorize_gitstring ()
|
|
250
277
|
r="$c_clear$r"
|
251
278
|
}
|
252
279
|
|
280
|
+
__git_eread ()
|
281
|
+
{
|
282
|
+
local f="$1"
|
283
|
+
shift
|
284
|
+
test -r "$f" && read "$@" <"$f"
|
285
|
+
}
|
286
|
+
|
253
287
|
# __git_ps1 accepts 0 or 1 arguments (i.e., format string)
|
254
288
|
# when called from PS1 using command substitution
|
255
289
|
# in this mode it prints text to add to bash PS1 prompt (includes branch name)
|
@@ -263,6 +297,8 @@ __git_ps1_colorize_gitstring ()
|
|
263
297
|
# In this mode you can request colored hints using GIT_PS1_SHOWCOLORHINTS=true
|
264
298
|
__git_ps1 ()
|
265
299
|
{
|
300
|
+
# preserve exit status
|
301
|
+
local exit=$?
|
266
302
|
local pcmode=no
|
267
303
|
local detached=no
|
268
304
|
local ps1pc_start='\u@\h:\w '
|
@@ -274,13 +310,54 @@ __git_ps1 ()
|
|
274
310
|
ps1pc_start="$1"
|
275
311
|
ps1pc_end="$2"
|
276
312
|
printf_format="${3:-$printf_format}"
|
313
|
+
# set PS1 to a plain prompt so that we can
|
314
|
+
# simply return early if the prompt should not
|
315
|
+
# be decorated
|
316
|
+
PS1="$ps1pc_start$ps1pc_end"
|
277
317
|
;;
|
278
318
|
0|1) printf_format="${1:-$printf_format}"
|
279
319
|
;;
|
280
|
-
*) return
|
320
|
+
*) return $exit
|
281
321
|
;;
|
282
322
|
esac
|
283
323
|
|
324
|
+
# ps1_expanded: This variable is set to 'yes' if the shell
|
325
|
+
# subjects the value of PS1 to parameter expansion:
|
326
|
+
#
|
327
|
+
# * bash does unless the promptvars option is disabled
|
328
|
+
# * zsh does not unless the PROMPT_SUBST option is set
|
329
|
+
# * POSIX shells always do
|
330
|
+
#
|
331
|
+
# If the shell would expand the contents of PS1 when drawing
|
332
|
+
# the prompt, a raw ref name must not be included in PS1.
|
333
|
+
# This protects the user from arbitrary code execution via
|
334
|
+
# specially crafted ref names. For example, a ref named
|
335
|
+
# 'refs/heads/$(IFS=_;cmd=sudo_rm_-rf_/;$cmd)' might cause the
|
336
|
+
# shell to execute 'sudo rm -rf /' when the prompt is drawn.
|
337
|
+
#
|
338
|
+
# Instead, the ref name should be placed in a separate global
|
339
|
+
# variable (in the __git_ps1_* namespace to avoid colliding
|
340
|
+
# with the user's environment) and that variable should be
|
341
|
+
# referenced from PS1. For example:
|
342
|
+
#
|
343
|
+
# __git_ps1_foo=$(do_something_to_get_ref_name)
|
344
|
+
# PS1="...stuff...\${__git_ps1_foo}...stuff..."
|
345
|
+
#
|
346
|
+
# If the shell does not expand the contents of PS1, the raw
|
347
|
+
# ref name must be included in PS1.
|
348
|
+
#
|
349
|
+
# The value of this variable is only relevant when in pcmode.
|
350
|
+
#
|
351
|
+
# Assume that the shell follows the POSIX specification and
|
352
|
+
# expands PS1 unless determined otherwise. (This is more
|
353
|
+
# likely to be correct if the user has a non-bash, non-zsh
|
354
|
+
# shell and safer than the alternative if the assumption is
|
355
|
+
# incorrect.)
|
356
|
+
#
|
357
|
+
local ps1_expanded=yes
|
358
|
+
[ -z "$ZSH_VERSION" ] || [[ -o PROMPT_SUBST ]] || ps1_expanded=no
|
359
|
+
[ -z "$BASH_VERSION" ] || shopt -q promptvars || ps1_expanded=no
|
360
|
+
|
284
361
|
local repo_info rev_parse_exit_code
|
285
362
|
repo_info="$(git rev-parse --git-dir --is-inside-git-dir \
|
286
363
|
--is-bare-repository --is-inside-work-tree \
|
@@ -288,11 +365,7 @@ __git_ps1 ()
|
|
288
365
|
rev_parse_exit_code="$?"
|
289
366
|
|
290
367
|
if [ -z "$repo_info" ]; then
|
291
|
-
|
292
|
-
#In PC mode PS1 always needs to be set
|
293
|
-
PS1="$ps1pc_start$ps1pc_end"
|
294
|
-
fi
|
295
|
-
return
|
368
|
+
return $exit
|
296
369
|
fi
|
297
370
|
|
298
371
|
local short_sha
|
@@ -307,14 +380,22 @@ __git_ps1 ()
|
|
307
380
|
local inside_gitdir="${repo_info##*$'\n'}"
|
308
381
|
local g="${repo_info%$'\n'*}"
|
309
382
|
|
383
|
+
if [ "true" = "$inside_worktree" ] &&
|
384
|
+
[ -n "${GIT_PS1_HIDE_IF_PWD_IGNORED-}" ] &&
|
385
|
+
[ "$(git config --bool bash.hideIfPwdIgnored)" != "false" ] &&
|
386
|
+
git check-ignore -q .
|
387
|
+
then
|
388
|
+
return $exit
|
389
|
+
fi
|
390
|
+
|
310
391
|
local r=""
|
311
392
|
local b=""
|
312
393
|
local step=""
|
313
394
|
local total=""
|
314
395
|
if [ -d "$g/rebase-merge" ]; then
|
315
|
-
|
316
|
-
|
317
|
-
|
396
|
+
__git_eread "$g/rebase-merge/head-name" b
|
397
|
+
__git_eread "$g/rebase-merge/msgnum" step
|
398
|
+
__git_eread "$g/rebase-merge/end" total
|
318
399
|
if [ -f "$g/rebase-merge/interactive" ]; then
|
319
400
|
r="|REBASE-i"
|
320
401
|
else
|
@@ -322,10 +403,10 @@ __git_ps1 ()
|
|
322
403
|
fi
|
323
404
|
else
|
324
405
|
if [ -d "$g/rebase-apply" ]; then
|
325
|
-
|
326
|
-
|
406
|
+
__git_eread "$g/rebase-apply/next" step
|
407
|
+
__git_eread "$g/rebase-apply/last" total
|
327
408
|
if [ -f "$g/rebase-apply/rebasing" ]; then
|
328
|
-
|
409
|
+
__git_eread "$g/rebase-apply/head-name" b
|
329
410
|
r="|REBASE"
|
330
411
|
elif [ -f "$g/rebase-apply/applying" ]; then
|
331
412
|
r="|AM"
|
@@ -349,11 +430,8 @@ __git_ps1 ()
|
|
349
430
|
b="$(git symbolic-ref HEAD 2>/dev/null)"
|
350
431
|
else
|
351
432
|
local head=""
|
352
|
-
if !
|
353
|
-
|
354
|
-
PS1="$ps1pc_start$ps1pc_end"
|
355
|
-
fi
|
356
|
-
return
|
433
|
+
if ! __git_eread "$g/HEAD" head; then
|
434
|
+
return $exit
|
357
435
|
fi
|
358
436
|
# is it a symbolic ref?
|
359
437
|
b="${head#ref: }"
|
@@ -406,13 +484,14 @@ __git_ps1 ()
|
|
406
484
|
fi
|
407
485
|
fi
|
408
486
|
if [ -n "${GIT_PS1_SHOWSTASHSTATE-}" ] &&
|
409
|
-
|
487
|
+
git rev-parse --verify --quiet refs/stash >/dev/null
|
488
|
+
then
|
410
489
|
s="$"
|
411
490
|
fi
|
412
491
|
|
413
492
|
if [ -n "${GIT_PS1_SHOWUNTRACKEDFILES-}" ] &&
|
414
493
|
[ "$(git config --bool bash.showUntrackedFiles)" != "false" ] &&
|
415
|
-
git ls-files --others --exclude-standard --error-unmatch -- '
|
494
|
+
git ls-files --others --exclude-standard --directory --no-empty-directory --error-unmatch -- ':/*' >/dev/null 2>/dev/null
|
416
495
|
then
|
417
496
|
u="%${ZSH_VERSION+%}"
|
418
497
|
fi
|
@@ -429,11 +508,17 @@ __git_ps1 ()
|
|
429
508
|
__git_ps1_colorize_gitstring
|
430
509
|
fi
|
431
510
|
|
511
|
+
b=${b##refs/heads/}
|
512
|
+
if [ $pcmode = yes ] && [ $ps1_expanded = yes ]; then
|
513
|
+
__git_ps1_branch_name=$b
|
514
|
+
b="\${__git_ps1_branch_name}"
|
515
|
+
fi
|
516
|
+
|
432
517
|
local f="$w$i$s$u"
|
433
|
-
local gitstring="$c$
|
518
|
+
local gitstring="$c$b${f:+$z$f}$r$p"
|
434
519
|
|
435
520
|
if [ $pcmode = yes ]; then
|
436
|
-
if [
|
521
|
+
if [ "${__git_printf_supports_v-}" != yes ]; then
|
437
522
|
gitstring=$(printf -- "$printf_format" "$gitstring")
|
438
523
|
else
|
439
524
|
printf -v gitstring -- "$printf_format" "$gitstring"
|
@@ -442,4 +527,6 @@ __git_ps1 ()
|
|
442
527
|
else
|
443
528
|
printf -- "$printf_format" "$gitstring"
|
444
529
|
fi
|
445
|
-
|
530
|
+
|
531
|
+
return $exit
|
532
|
+
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: codelation-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.19
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Pattison
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-08-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: open_uri_redirections
|
@@ -90,6 +90,7 @@ files:
|
|
90
90
|
- lib/codelation/development/dot_files.rb
|
91
91
|
- lib/codelation/development/install_methods.rb
|
92
92
|
- lib/codelation/development/postgres.rb
|
93
|
+
- lib/codelation/development/psequel.rb
|
93
94
|
- lib/codelation/development/ruby.rb
|
94
95
|
- lib/codelation/development/sequel_pro.rb
|
95
96
|
- lib/codelation/version.rb
|