forked from AndrewRayCode/Bash-Prompt-Builder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
801 lines (718 loc) · 37.1 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Bash Prompt Builder - AndrewRay.me</title>
<script src="https://ajax.googleapis.com/ajax/libs/mootools/1.3.2/mootools-yui-compressed.js" type="text/javascript"></script>
<script src="mootools-more-1.3.2.1.js" type="text/javascript"></script>
<script src="mootools.noisy.min.js" type="text/javascript"></script>
<script src="FunForms.js" type="text/javascript"></script>
<script src="MooDialog.js" type="text/javascript"></script>
<script src="ZeroClipboard.js" type="text/javascript"></script>
<link type="text/css" rel="stylesheet" href="FunForms.css" />
<script src="builder.js" type="text/javascript"></script>
<link type="text/css" rel="stylesheet" href="builder.css" />
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-12379271-3']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</head>
<body>
<div id="nojs">
Please enable JavaScript, you jerk
</div>
<script>document.getElementById('nojs').style.display = 'none';</script>
<div class="ribbon">
<a href="https://github.com/DelvarWorld/Bash-Prompt-Builder" rel="me" target="_blank">Fork me on GitHub!</a>
</div>
<div class="wrap">
<header>
<h1>Bash Prompt Builder</h1>
<p class="abstract">Create a function to show Git / Hg / Svn repository information in your prompt!</p>
</header>
<ul class="nav">
<li>Explore:</li>
<li><a href="#nav-options">Options</a></li>
<li><a href="#preview">Preview</a></li>
<li><a href="#nav-code">Code</a></li>
<li><a href="#what">What is this I don't even</a></li>
<li><a href="#contact">Contact and Contribute</a></li>
</ul>
<h2 id="nav-options">Options</h2>
<section id="options">
<div class="wtf">
<div id="placeholder">Hover over an option to see its description here</div>
<label id="wtf-label" for="wtf">What the merry-go-round does this option do?</label>
<div id="wtf"></div>
</div>
<div class="config config-git">
<div class="group master">
<input type="checkbox" value="git" id="git" data-toggle="git-prefix git-revno git-ahead git-modified git-conflicted git-bisect option-submodule git-ontag" checked="checked" />
<label for="git">Git</label>
<div class="color-picker color-yellow"></div>
</div>
<div class="options">
<div class="group">
<input type="checkbox" value="git-prefix" id="git-prefix" checked="checked" />
<label for="git-prefix">"git:"</label>
<div class="color-picker color-yellow"></div>
</div>
<div class="group">
<input type="checkbox" value="git-ahead" id="git-ahead" checked="checked" />
<label for="git-ahead">Ahead</label>
<div class="color-picker color-lightcyan"></div>
</div>
<div class="group">
<input type="checkbox" value="git-modified" id="git-modified" checked="checked" />
<label for="git-modified">Modified</label>
<div class="color-picker color-yellow"></div>
</div>
<div class="group">
<input type="checkbox" value="git-conflicted" id="git-conflicted" checked="checked" />
<label for="git-conflicted">Conflicted</label>
<div class="color-picker color-red"></div>
</div>
<div class="group">
<input type="checkbox" value="git-revno" id="git-revno" checked="checked" />
<label for="git-revno">Revision ID</label>
<div class="color-picker color-yellow"></div>
</div>
<div class="group">
<input type="checkbox" value="git-bisect" id="git-bisect" checked="checked" />
<label for="git-bisect">Bisecting</label>
<div class="color-picker color-magenta"></div>
</div>
<div class="group">
<input type="checkbox" value="option-submodule" id="option-submodule" checked="checked" />
<label for="option-submodule">In submodule</label>
<div class="color-picker color-magenta"></div>
</div>
<div class="group">
<input type="checkbox" value="git-ontag" id="git-ontag" checked="checked" />
<label for="git-ontag">Current tag</label>
<div class="color-picker color-yellow"></div>
</div>
</div>
</div>
<div class="config config-hg">
<div class="group master">
<input type="checkbox" value="hg" id="hg" data-toggle="hg-patches hg-prefix hg-revno hg-modified hg-conflicted hg-bisect" checked="checked" />
<label for="hg">Mercurial</label>
<div class="color-picker color-magenta"></div>
</div>
<div class="options">
<div class="group">
<input type="checkbox" value="hg-prefix" id="hg-prefix" checked="checked" />
<label for="hg-prefix">"hg:"</label>
<div class="color-picker color-magenta"></div>
</div>
<div class="group">
<input type="checkbox" value="hg-modified" id="hg-modified" checked="checked" />
<label for="hg-modified">Modified</label>
<div class="color-picker color-magenta"></div>
</div>
<div class="group">
<input type="checkbox" value="hg-conflicted" id="hg-conflicted" checked="checked" />
<label for="hg-conflicted">Conflicted</label>
<div class="color-picker color-red"></div>
</div>
<div class="group">
<input type="checkbox" value="hg-revno" id="hg-revno" checked="checked" />
<label for="hg-revno">Revision ID</label>
<div class="color-picker color-magenta"></div>
</div>
<div class="group">
<input type="checkbox" value="hg-bisect" id="hg-bisect" checked="checked" />
<label for="hg-bisect">Bisecting</label>
<div class="color-picker color-yellow"></div>
</div>
<div class="group">
<input type="checkbox" value="hg-patches" id="hg-patches" checked="checked" />
<label for="hg-patches">Patch List</label>
<div class="color-picker color-yellow"></div>
</div>
</div>
</div>
<div class="config config-svn">
<div class="group master">
<input type="checkbox" value="svn" id="svn" data-toggle="svn-revno svn-modified" checked="checked" />
<label for="svn">Subversion</label>
<div class="color-picker color-cyan"></div>
</div>
<div class="options">
<div class="group">
<input type="checkbox" value="svn-modified" id="svn-modified" checked="checked" />
<label for="svn-modified">Modified</label>
<div class="color-picker color-cyan"></div>
</div>
<div class="group">
<input type="checkbox" value="svn-revno" id="svn-revno" checked="checked" />
<label for="svn-revno">Revision ID</label>
<div class="color-picker color-cyan"></div>
</div>
</div>
<div class="group general">
<label class="header" id="general-options">General Options</label>
<div class="group">
<input type="checkbox" value="comments" id="comments" />
<label for="comments">Strip all comments</label>
</div>
<div class="group">
<input type="checkbox" value="no-colors" id="no-colors" />
<label for="no-colors">No colors!</label>
</div>
</div>
</div>
<div class="config characters">
<div class="group">
<input type="text" value="△" id="option-modified" />
<label for="option-modified">Modified Character</label>
</div>
<div class="group" id="group-conflict">
<input type="text" value="☢" id="option-conflict" />
<label for="option-conflict">Conflict Character</label>
<div class="color-picker color-yellow"></div>
</div>
<div class="group" id="group-max-conflict"> <!-- uh oh! work it out, team -->
<input type="text" value="2" id="max-conflicted-files" />
<label for="max-conflicted-files">Maximum Conflicted Files</label>
</div>
<div class="group long">
<input type="text" value="no branch!" id="option-nobranch" />
<label for="option-nobranch">No Branch Text</label>
<div class="color-picker color-red"></div>
</div>
<div class="group long">
<input type="text" value="bisecting" id="bisecting-text" />
<label for="bisecting-text">Bisecting Text</label>
</div>
<div class="group long">
<input type="text" value="[submodule] " id="submodule-text" />
<label for="submodule-text">Submodule Text</label>
</div>
</div>
<div class="group presets">
<label for="presets">Presets</label>
<select id="presets">
<option value="#git=1&color-git=3&git-prefix=1&color-git-prefix=3&git-ahead=1&color-git-ahead=6b&git-modified=1&color-git-modified=3&git-conflicted=1&color-git-conflicted=1&git-revno=1&color-git-revno=3&git-bisect=1&color-git-bisect=5&option-submodule=1&color-option-submodule=5&git-ontag=1&color-git-ontag=3&hg=1&color-hg=5&hg-prefix=1&color-hg-prefix=5&hg-modified=1&color-hg-modified=5&hg-conflicted=1&color-hg-conflicted=1&hg-revno=1&color-hg-revno=5&hg-bisect=1&color-hg-bisect=3&hg-patches=1&color-hg-patches=3&svn=1&color-svn=6&svn-modified=1&color-svn-modified=6&svn-revno=1&color-svn-revno=6&option-modified=%E2%96%B3&option-conflict=%E2%98%A2&color-option-conflict=3&max-conflicted-files=2&option-nobranch=no%20branch!&color-option-nobranch=1&bisecting-text=bisecting&submodule-text=%5Bsubmodule%5D%20">Zen Pizza (Make Me One With Everything)</option>
<option value="#git=1&color-git=3&color-git-prefix=3&git-ahead=1&color-git-ahead=6b&git-modified=1&color-git-modified=3&git-conflicted=1&color-git-conflicted=1&color-git-revno=3&git-bisect=1&color-git-bisect=3b&option-submodule=1&color-option-submodule=3b&git-ontag=1&color-git-ontag=3b&hg=1&color-hg=5&color-hg-prefix=5&hg-modified=1&color-hg-modified=5&hg-conflicted=1&color-hg-conflicted=1&color-hg-revno=5&hg-bisect=1&color-hg-bisect=5b&hg-patches=1&color-hg-patches=5b&svn=1&color-svn=6&svn-modified=1&color-svn-modified=6&svn-revno=1&color-svn-revno=6&option-modified=%E2%9C%8E&option-conflict=%E2%98%A2&color-option-conflict=3&max-conflicted-files=2&option-nobranch=no%20branch!&color-option-nobranch=1&bisecting-text=%CF%9F&submodule-text=%5Bsubmodule%5D%20">Andrew Ray's</option>
<option value="#git=1&color-git=3&color-git-prefix=3&color-git-ahead=6b&git-modified=1&color-git-modified=3&color-git-conflicted=1&color-git-revno=3&color-git-bisect=5&color-option-submodule=5&color-git-ontag=3&hg=1&color-hg=5&color-hg-prefix=5&hg-modified=1&color-hg-modified=5&color-hg-conflicted=1&color-hg-revno=5&color-hg-bisect=3&color-hg-patches=3&svn=1&color-svn=6&svn-modified=1&color-svn-modified=6&color-svn-revno=6&no-colors=1&option-modified=%E2%96%B3&option-conflict=%E2%98%A2&color-option-conflict=3&max-conflicted-files=2&option-nobranch=no%20branch!&color-option-nobranch=1&bisecting-text=bisecting&submodule-text=%5Bsubmodule%5D%20">Pretty Simple</option>
<option value="#git=1&color-git=3&color-git-prefix=3&git-ahead=1&color-git-ahead=3b&git-modified=1&color-git-modified=3b&git-conflicted=1&color-git-conflicted=1&color-git-revno=3b&git-bisect=1&color-git-bisect=3b&option-submodule=1&color-option-submodule=3b&git-ontag=1&color-git-ontag=3&hg=1&color-hg=3&color-hg-prefix=3b&hg-modified=1&color-hg-modified=3b&hg-conflicted=1&color-hg-conflicted=1&color-hg-revno=3b&hg-bisect=1&color-hg-bisect=3b&hg-patches=1&color-hg-patches=3b&svn=1&color-svn=3&svn-modified=1&color-svn-modified=3b&svn-revno=1&color-svn-revno=3b&option-modified=%E2%96%B3&option-conflict=%E2%98%A2&color-option-conflict=3b&max-conflicted-files=2&option-nobranch=no%20branch!&color-option-nobranch=3b&bisecting-text=bisecting&submodule-text=%5Bsubmodule%5D%20">One Color Sexmachine</option>
<option value="#git=1&color-git=3&color-git-prefix=3&color-git-ahead=6b&git-modified=1&color-git-modified=3&git-conflicted=1&color-git-conflicted=1&color-git-revno=3&git-bisect=1&color-git-bisect=2&option-submodule=1&color-option-submodule=2&color-git-ontag=3&hg=1&color-hg=5&color-hg-prefix=5&hg-modified=1&color-hg-modified=5&hg-conflicted=1&color-hg-conflicted=1&color-hg-revno=5&hg-bisect=1&color-hg-bisect=2&hg-patches=1&color-hg-patches=2&svn=1&color-svn=6&svn-modified=1&color-svn-modified=6&svn-revno=1&color-svn-revno=6&option-modified=%E2%9C%8E&option-conflict=%E2%98%A2&color-option-conflict=3&max-conflicted-files=2&option-nobranch=no%20branch&color-option-nobranch=1&bisecting-text=%E2%9C%84&submodule-text=submodule%20">The Pragmatic BashMaster</option>
</select>
</div>
</section>
<div class="form-buttons" id="config-buttons">
<button id="link">Save as Link</button>
<div id="config-flash-container">
<button id="copy-config">Copy Function to Clipboard</button>
</div>
<button id="float"><span>➦</span> Float</button>
<button id="dock"><span>➥</span> Dock</button>
</div>
<h2 id="preview">Preview</h2>
<section class="display">
<div class="group git">
<label for="git-display">Git</label>
<div id="git-display" class="screen">
<span class="git">(<span class="git-submodule"><span class="option-submodule">[submodule] </span></span><span class="git-prefix">git:</span>master<span class="git-revno">:f9302</span><span class="git-ontag"> "tag"</span><span class="option-delta git-modified"> △</span>)</span><span class="git-ahead"> +1</span><span class="git-conflicted"> (<span class="option-conflict">☢ </span><span class="conflicted-files">index.js, path/to/package.json</span>)</span> $
</div>
<div class="sub git-bisect">
<label for="git-bisecting-dsplay">Bisecting</label>
<div id="git-bisecting-display" class="screen">
<span class="git">(<span class="git-prefix">git:</span><span class="git-bisect"><span class="option-bisecting">bisecting</span>:91acf15</span>)</span> $
</div>
</div>
<div class="sub">
<label for="git-no-branch">No branch</label>
<div id="git-no-branch" class="screen">
<span class="git">(<span class="git-prefix">git:</span><span class="git-no-branch"><span class="option-nobranch">no branch!</span></span>)</span> $
</div>
</div>
</div>
<div class="group hg">
<label for="hg-display">Mercurial</label>
<div class="screen" id="hg-display">
<span class="hg">(<span class="hg-prefix">hg:</span>default<span class="hg-revno">:f9302</span><span class="option-delta hg-modified"> △</span><span class="hg-patches"> [patch1,patch2]</span>)</span><span class="hg-conflicted"> (<span class="option-conflict">☢ </span><span class="conflicted-files">index.js, path/to/package.json</span>)</span> $
</div>
<div class="sub hg-bisect">
<label for="hg-bisecting-dsplay">Bisecting</label>
<div id="hg-bisecting-display" class="screen">
<span class="hg">(<span class="hg-prefix">hg:</span>default<span class="hg-bisect">:<span class="option-bisecting">bisecting</span>:91acf15</span>)</span> $
</div>
</div>
</div>
<div class="group svn">
<label for="svn-display">Subversion</label>
<div class="screen" id="svn-display">
<span class="svn">(svn<span class="svn-revno">:9284</span><span class="option-delta svn-modified"> △</span>)</span> $
</div>
</div>
</section>
<h2 id="nav-code">Code</h2>
<section id="code">
<div id="function">
# This code was auto generated by with these options:
# #auto_url#
# :option-max-conflicted-files
MAX_CONFLICTED_FILES=2
# /option-max-conflicted-chars
# :option-delta
DELTA_CHAR="△"
# /option-delta
# :option-conflict
CONFLICT_CHAR="☢"
# /option-conflict
# :option-bisecting
BISECTING_TEXT="bisecting"
# /option-bisecting
# :option-nobranch
NOBRANCH_TEXT="no branch!"
# /option-nobranch
# :option-submodule
SUBMODULE_TEXT="[submodule] "
# /option-submodule
# :color-list
# Colors for prompt
COLOR_RED=$(tput sgr0 && tput setaf 1)
COLOR_GREEN=$(tput sgr0 && tput setaf 2)
COLOR_YELLOW=$(tput sgr0 && tput setaf 3)
COLOR_BLUE=$(tput sgr0 && tput setaf 4)
COLOR_MAGENTA=$(tput sgr0 && tput setaf 5)
COLOR_CYAN=$(tput sgr0 && tput setaf 6)
COLOR_GRAY=$(tput sgr0 && tput setaf 7)
COLOR_WHITE=$(tput sgr0 && tput setaf 7 && tput bold)
COLOR_LIGHTRED=$(tput sgr0 && tput setaf 1 && tput bold)
COLOR_LIGHTGREEN=$(tput sgr0 && tput setaf 2 && tput bold)
COLOR_LIGHTYELLOW=$(tput sgr0 && tput setaf 3 && tput bold)
COLOR_LIGHTBLUE=$(tput sgr0 && tput setaf 4 && tput bold)
COLOR_LIGHTMAGENTA=$(tput sgr0 && tput setaf 5 && tput bold)
COLOR_LIGHTCYAN=$(tput sgr0 && tput setaf 6 && tput bold)
COLOR_RESET=$(tput sgr0)
# /color-list
# :hg
if [ -z "`echo $(LC_ALL=C hg prompt \"abort\" 2>&1) | grep abort`" ]; then
echo "hg-prompt not installed. Suggest http://sjl.bitbucket.org/hg-prompt/installation/"
fi
_hg_dir=""
function _hg_check {
[ -d ".hg" ] && _hg_dir=`pwd`
base_dir="."
while [ -d "$base_dir/../.hg" ]; do base_dir="$base_dir/.."; done
if [ -d "$base_dir/.hg" ]; then
_hg_dir=`cd "$base_dir"; pwd`
return 0
else
return 1
fi
}
# /hg
# :svn
_svn_dir=""
function _svn_check {
parent=""
grandparent="."
while [ -d "$grandparent/.svn" ]; do
parent=$grandparent
grandparent="$parent/.."
done
if [ ! -z "$parent" ]; then
_svn_dir=`cd "$parent"; pwd`
return 0
else
return 1
fi
}
# /svn
# :git
_git_dir=""
_git_svn_dir=""
function _git_check {
_git_dir=`git rev-parse --show-toplevel 2> /dev/null`
if [[ "$_git_dir" == "" ]]; then
return 1
else
_gsvn_check=`cd "$_git_dir"; ls .git/svn/.metadata 2> /dev/null`
if [[ ! -z "$_gsvn_check" ]]; then
_git_svn_dir=$_git_dir
fi
return 0
fi
}
# /git
# :git-submodule
function is_submodule() {
local parent_git=`cd "$_git_dir/.." && git rev-parse --show-toplevel 2> /dev/null`
if [[ -n $parent_git ]]; then
local submodules=`cd "$parent_git" && git submodule --quiet foreach 'echo $path'`
for line in $submodules; do
cd "$parent_git/$line"
if [[ `pwd` = $_git_dir ]]; then return 0; fi
done
fi
return 1
}
# /git-submodule
dvcs_function="
# Figure out what repo we are in
# :git
_git_check \
# /git
# :hg
|| _hg_check \
# /hg
# :svn
|| _svn_check
# /svn
# Build the prompt!
prompt=\"\"
# :git
# If we are in git ...
if [ -n \"\$_git_dir\" ]; then
# find current branch
gitBranch=\$(git symbolic-ref HEAD 2> /dev/null)
gitStatus=\`git status\`
# Figure out current branch, or if we are bisecting, or lost in space
bisecting=\"\"
if [ -z \"\$gitBranch\" ]; then
# :git-bisect
bisect=\$(git rev-list --bisect 2> /dev/null | cut -c1-7)
if [ -z \"\$bisect\" ]; then
# /git-bisect
gitBranch=\"\\[\$color-option-nobranch\\]\$NOBRANCH_TEXT\\[\$color-git\\]\"
# :git-bisect
else
bisecting=\"\\[\$color-git-bisect\\]\$BISECTING_TEXT:\"\$bisect\"\\[\$color-git\\]\"
gitBranch=\"\"
fi
# /git-bisect
fi
gitBranch=\${gitBranch#refs/heads/}
#: git-svn
if [ -z \"\$bisect\" ]; then
if [ -n \"\$_git_svn_dir\" ]; then
gitBranch=\"\\[\$COLOR_DARK_BLUE\\]git-svn\\[\$COLOR_YELLOW\\] \$gitBranch\"
fi
fi
# /git-svn
# :git-modified
# changed *tracked* files in local directory?
gitChange=\$(echo \$gitStatus | ack 'modified:|deleted:|new file:')
if [ -n \"\$gitChange\" ]; then
gitChange=\"\\[\$color-git-modified\\] \\[`tput sc`\\] \\[`tput rc`\\]\\[\$DELTA_CHAR\\] \"
fi
# /git-modified
# :git-branch
# output the branch and changed character if present
prompt=\$prompt\"\\[\$color-git\\] (\"
# :git-submodule
if is_submodule; then
prompt=\$prompt\"\\[\$color-git-submodule\\]\$SUBMODULE_TEXT\\[\$color-git\\]\"
fi
# /git-submodule
# :git-prefix
prefix=\"\\[\$color-git-prefix\\]git:\\[\$color-git\\]\"
# /git-prefix
prompt=\$prompt\$prefix\$gitBranch\$bisecting
# /git-branch
# :git-revno
revNo=\$(git rev-parse HEAD 2> /dev/null | cut -c1-7) || return
# If bisecting don't output revno
if [ -z \"\$bisecting\" ] && [ -z \"\$noBranch\" ];then
prompt=\$prompt\":\$revNo\"
fi
# /git-revno
# :git-ontag
tag=\`git describe --tags --exact 2> /dev/null\`
if [ -n \"\$tag\" ]; then
prompt=\"\$prompt\\[\$color-git-ontag\\] \\\"\$tag\\\"\\[\$color-git\\]\"
fi
# /git-ontag
prompt=\$prompt\"\$gitChange\\[\$color-git\\])\\[\$COLOR_RESET\\]\"
# :git-ahead
# How many local commits do you have ahead of origin?
num=\$(echo \$gitStatus | grep \"Your branch is ahead of\" | awk '{split(\$0,a,\" \"); print a[13];}') || return
if [ -n \"\$num\" ]; then
prompt=\$prompt\"\\[\$color-git-ahead\\] +\$num\"
fi
# /git-ahead
# :git-conflicted
# any conflicts? (sed madness is to remove line breaks)
files=\$(git ls-files -u | cut -f 2 | sort -u | sed '$(($MAX_CONFLICTED_FILES+1)),1000d' | sed -e :a -e '\$!N;s/\\\n/, /;ta' -e 'P;D')
# /git-conflicted
fi
# /git
# :hg
# If we are in mercurial ...
if [ -n \"\$_hg_dir\" ]; then
hgBranch=\`[ -e \"\$_hg_dir/.hg/branch\" ] && cat \"\$_hg_dir/.hg/branch\" || echo \"default\"\`
hgPrompt=\"s\"
# :hg-modified
hgPrompt=\"\$hgPrompt{status|modified}\"
# /hg-modified
hgPrompt=\"\$hgPrompt n\"
# :hg-revno
hgPrompt=\"\$hgPrompt{node}\"
# /hg-revno
hgPrompt=\"\$hgPrompt p\"
# :hg-patches
hgPrompt=\"\$hgPrompt{patches|hide_unapplied|join(,)}\"
# /hg-patches
promptOptions=(\`hg prompt \"\$hgPrompt\" | tr -s ':' ' '\`)
# :hg-modified
hgm=\${promptOptions[0]:1}
if [ -n \"\$hgm\" ]; then
hgChange=\"\\[\$color-hg-modified\\] \\[`tput sc`\\] \\[`tput rc`\\]\\[\$DELTA_CHAR\\]\"
fi
# /hg-modified
# :hg-branch
# output branch and changed character if present
prompt=\$prompt\"\\[\$color-hg\\] (\"
# :hg-prefix
prefix=\"\\[\$color-hg-prefix\\]hg:\\[\$color-hg\\]\"
# /hg-prefix
prompt=\$prompt\"\${prefix}\${hgBranch}\"
# :hg-bisect
bisecting=\$(hg bisect 2> /dev/null | head -n 1)
bisecting=\${bisecting:20:7}
if [ -z \"\$bisecting\" ]; then
# /hg-bisect
prompt=\$prompt
# :hg-revno
prompt=\$prompt\":\${promptOptions[1]:1:7}\"
# /hg-revno
# :hg-bisect
else
prompt=\"\$prompt\\[\$color-hg-bisect\\]:\$BISECTING_TEXT:\"\$bisecting\"\\[\$color-hg\\]\"
fi
# /hg-bisect
prompt=\$prompt\"\$hgChange\"
# :hg-patches
patches=\${promptOptions[2]:1}
if [ -n \"\$patches\" ];then
prompt=\$prompt\"\\[\$color-hg-patches\\] [\$patches]\\[\$color-hg\\]\"
fi
# /hg-patches
prompt=\$prompt\")\"
# /hg-branch
# :hg-conflicted
# Conflicts?
files=\$(hg resolve -l | grep \"U \" | sed '$(($MAX_CONFLICTED_FILES+1)),1000d' | awk '{split(\$0,a,\" \"); print a[2];}') || return
# /hg-conflicted
fi
# /hg
# :svn
# If we are in subversion ...
if [ -n \"\$_svn_dir\" ]; then
# :svn-changed
# changed files in local directory? NOTE: This command is the slowest of the bunch
svnChange=\$(svn status | ack \"^M|^!\" | wc -l)
if [[ \"\$svnChange\" != \" 0\" ]]; then
svnChange=\"\\[\$color-svn-modified\\] \\[`tput sc`\\] \\[`tput rc`\\]\\[\$DELTA_CHAR\\] \"
else
svnChange=\"\"
fi
# /svn-changed
# revision number (instead of branch name, silly svn)
revNo=\`svnversion --no-newline\`
prompt=\$prompt\"\\[\$color-svn\\] (svn\"
# :svn-revno
prompt=\$prompt\"\\[\$color-svn-revno\\] :\$revNo\\[\$color-svn\\] \"
# /svn-revno
prompt=\$prompt\"\$svnChange)\\[\$COLOR_RESET\\]\"
fi
# /svn
# :conflicts
# Show conflicted files if any
if [ -n \"\$files\" ]; then
prompt=\$prompt\" \\[\$color-conflicted\\](\\[\$color-conflict-char\\]\"
prompt=\$prompt\"\\[`tput sc`\\] \\[`tput rc`\\]\\[\$color-conflict-char\\]\\[\$CONFLICT_CHAR\\] \"
prompt=\$prompt\"\\[\$color-conflicted\\] \${files})\"
fi
# /conflicts
echo -e \$prompt"
# End code auto generated by http://andrewray.me/bash-prompt-builder/index.html
PS1="\$(${dvcs_function})\[$COLOR_RESET\] \$ "
</div>
</section>
<div class="form-buttons" id="code-buttons">
<button id="expand">Expand</button>
<button id="despand">Despand</button>
<button id="copy-form">Copy Function to Clipboard</button>
</div>
<h2 id="what">What is this I don't even</h2>
<section class="what">
<p>This is a website for creating a function to put in your .bashrc file to show your Git / Hg / Subversion repository information in your bash prompt, if you do work in the prompt with version control.</p>
<h3>Requirements</h3>
<ul>
<li><a href="http://sjl.bitbucket.org/hg-prompt/installation/" target="_blank">hg-prompt</a> if you plan to use Mercurial.</li>
<li>ack. <code>sudo port install p5-app-ack</code> with MacPorts or <code>brew install ack</code> with HomeBrew or <a href="http://betterthangrep.com/" target="_blank">some other way</a>.
</ul>
<h3>How to use</h3>
<ol>
<li>Diddle with the options. Check boxes! Pick colors!</li>
<li>Use the preview pane to see what your prompt would look like in each repository.</li>
<li>Click the select button then press copy (CTRL-C Windows, Splat-C Mac).</li>
<li>Paste the output into your ~/.bashrc file. Make it if it doesn't exist.</li>
<li>Note how the function is used in the final PS1 line, and combine it with your own PS1 if you have one.</li>
</ol>
</section>
<h2 id="contact">Contact and Contribute</h2>
<section>
<h3>Contributing</h3>
<p>Do you have ideas for other VCS display options? Do you want to add support for a different VCS? All the rules for contributing can be found in the README of <a href="https://github.com/DelvarWorld/Bash-Prompt-Builder" rel="me" target="_blank">the GitHub page for this website</a>.</p>
<h3>Links</h3>
<ul>
<li>Check out the <a href="http://andrewray.me/">homepage</a>.</li>
<li>Visit my <a href="https://github.com/DelvarWorld">GitHub page</a>.</li>
<li>Follow me on <a href="http://twitter.com/andrewray">Twitter</a>.</li>
</ul>
<footer>
Page made by <a href="http://andrewray.me/">Andrew Ray</a> using only HTML and CSS, and <a href="http://mootools.net" target="_blank">MooTools</a>
</footer>
</div>
</div>
<div class="fun-picker" id="modified-picker">
<ul>
<li>✎</li>
<li>✏</li>
<li>✐</li>
<li>△</li>
<li>▲</li>
<li>⟁</li>
<li>༇</li>
<li>±</li>
<li>☢</li>
<li>☠</li>
<li>☣</li>
<li>✍</li>
<li>➲</li>
<li>⟠</li>
<li>𝄞</li>
<li>!</li>
<li>ʘ</li>
<li>Ѽ</li>
<li>Ѿ</li>
<li>✓</li>
<li>✔</li>
<li>§</li>
<li>✜</li>
<li>✻</li>
<li>❤</li>
<li>⚛</li>
<li>‽</li>
<li>*</li>
<li>#</li>
<li>௰</li>
</ul>
</div>
<div class="fun-picker" id="conflict-picker">
<ul>
<li>☢</li>
<li>☠</li>
<li>☣</li>
<li>Ѽ</li>
<li>Ѿ</li>
<li>௰</li>
<li>!</li>
<li>༇</li>
<li>△</li>
<li>±</li>
<li>✍</li>
<li>✎</li>
<li>✏</li>
<li>✐</li>
<li>➲</li>
<li>⟁</li>
<li>⟠</li>
<li>𝄞</li>
<li>ʘ</li>
<li>✓</li>
<li>✔</li>
<li>§</li>
<li>✜</li>
<li>✻</li>
<li>❤</li>
<li>⚛</li>
<li>x</li>
<li>*</li>
<li>+</li>
<li>‽</li>
</ul>
</div>
<div class="fun-picker" id="bisect-picker">
<ul>
<li>Ψ</li>
<li>ϕ</li>
<li>ϕ</li>
<li>ϟ</li>
<li>Ж</li>
<li>Ф</li>
<li>ே</li>
<li>ჱ</li>
<li>ᅡ</li>
<li>ᅥ</li>
<li>ᙟ</li>
<li>᚜</li>
<li>᚛</li>
<li>ᚋ</li>
<li>⊕</li>
<li>◧</li>
<li>◨</li>
<li>◭</li>
<li>◮</li>
<li>✄</li>
<li>‡</li>
</ul>
</div>
<div class="fun-picker" id="rebase-picker">
<ul>
<li>®</li>
<li>±</li>
<li>÷</li>
<li>~</li>
<li>µ</li>
<li>Ŕ</li>
<li>Ř</li>
<li>ř</li>
<li>ʀ</li>
<li>ʶ</li>
<li>ϟ</li>
<li>᚜</li>
<li>➦</li>
</ul>
</div>
<div class="fun-picker color-modal" id="color-picker">
<ul class="bright">
<li class="color-red"></li>
<li class="color-green"></li>
<li class="color-yellow"></li>
<li class="color-blue"></li>
<li class="color-magenta"></li>
<li class="color-cyan"></li>
<li class="color-gray"></li>
<li class="color-lightred"></li>
<li class="color-lightgreen"></li>
<li class="color-lightyellow"></li>
<li class="color-lightblue"></li>
<li class="color-lightmagenta"></li>
<li class="color-lightcyan"></li>
<li class="color-white"></li>
</ul>
</div>
<!-- Credits -->
<!-- Christopher Sexton: http://www.codeography.com/2009/05/26/speedy-bash-prompt-git-and-subversion-integration.html -->
<!-- Steve Losh: http://stevelosh.com/blog/2010/02/my-extravagant-zsh-prompt/ -->
<!-- simurai: http://lab.simurai.com/css/buttons/ -->
<!-- ColorZilla: http://www.colorzilla.com/gradient-editor/ -->
<!-- Miaka: http://www.colourlovers.com/palette/482416/Wasabi_Suicide -->
<!-- This guy: https://github.com/relevance/etc/blob/master/bash/bash_vcs.sh -->
<!-- Brodie Rao: https://bitbucket.org/brodie/dotfiles/src/1a3e7c8d25d2/.zsh/.zshrc#cl-201 -->
</body>
</html>