-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
401 lines (370 loc) · 18.2 KB
/
Copy pathindex.html
File metadata and controls
401 lines (370 loc) · 18.2 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="powerbash is a powerline-style bash prompt in pure bash. One script, no dependencies, no patched fonts. Runs on Linux, macOS, and WSL.">
<meta name="color-scheme" content="light dark">
<meta name="theme-color" content="#fbfaf8" media="(prefers-color-scheme: light)">
<meta name="theme-color" content="#131519" media="(prefers-color-scheme: dark)">
<title>powerbash — a powerline-style bash prompt in pure bash</title>
<link rel="canonical" href="https://powerbash.org/">
<meta property="og:type" content="website">
<meta property="og:site_name" content="powerbash">
<meta property="og:title" content="powerbash — a powerline-style bash prompt in pure bash">
<meta property="og:description" content="One script, no dependencies, no patched fonts. Branch, dirty state, and last return code right where you are already looking. Linux, macOS, and WSL.">
<meta property="og:url" content="https://powerbash.org/">
<meta property="og:image" content="https://powerbash.org/og.png">
<meta property="og:image:type" content="image/png">
<meta property="og:image:width" content="1200">
<meta property="og:image:height" content="630">
<meta property="og:image:alt" content="The powerbash prompt: napalm, webapp, a blue git segment reading main + 1 ahead, and a green dollar sign.">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:title" content="powerbash — a powerline-style bash prompt in pure bash">
<meta name="twitter:description" content="One script, no dependencies, no patched fonts. Branch, dirty state, and last return code right where you are already looking.">
<meta name="twitter:image" content="https://powerbash.org/og.png">
<link rel="icon" href="favicon.ico">
<link rel="stylesheet" href="css/main.css">
<!-- Data, not behaviour: application/ld+json is never executed. The page still
runs no script and makes no external request. -->
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@graph": [
{
"@type": "WebSite",
"@id": "https://powerbash.org/#website",
"url": "https://powerbash.org/",
"name": "powerbash",
"description": "A powerline-style bash prompt in pure bash.",
"inLanguage": "en"
},
{
"@type": "SoftwareApplication",
"@id": "https://powerbash.org/#software",
"name": "powerbash",
"url": "https://powerbash.org/",
"description": "A powerline-style bash prompt in pure bash. One script sourced into your shell, showing the git branch and its state, the path, the return code of the last command, and more. No dependencies, no daemon, no patched fonts, no root.",
"applicationCategory": "DeveloperApplication",
"applicationSubCategory": "Command line tool",
"operatingSystem": "Linux, macOS, Windows (WSL)",
"softwareRequirements": "bash 3.2 or newer, a UTF-8 locale",
"image": "https://powerbash.org/og.png",
"license": "https://opensource.org/licenses/MIT",
"codeRepository": "https://github.com/napalm255/powerbash",
"downloadUrl": "https://download.powerbash.org/powerbash.sh",
"installUrl": "https://powerbash.org/#install",
"softwareHelp": "https://powerbash.org/docs/",
"isAccessibleForFree": true,
"offers": {
"@type": "Offer",
"price": "0",
"priceCurrency": "USD"
},
"author": {
"@type": "Person",
"name": "napalm255",
"url": "https://github.com/napalm255"
}
}
]
}
</script>
</head>
<body>
<a class="skip" href="#main">Skip to content</a>
<header class="masthead">
<div class="wrap">
<a class="brand" href="/">powerbash</a>
<nav aria-label="Main">
<a href="#install">Install</a>
<a href="#build">Build a prompt</a>
<a href="/docs/">Docs</a>
<a href="https://github.com/napalm255/powerbash">GitHub</a>
</nav>
</div>
</header>
<main id="main">
<section class="hero">
<div class="wrap">
<p class="eyebrow">one file, sourced into your shell</p>
<h1>Your shell already knows all this.</h1>
<p class="lede">powerbash puts the branch you are on, whether it is dirty, how far
ahead of the remote you are, and what the last command returned right where you
are already looking. Pure bash — no dependencies, no patched fonts.</p>
<div class="terminal hero-terminal">
<p class="prompt">
<span class="seg seg-user">napalm</span><span class="seg seg-path">webapp</span><span class="seg seg-git">»feature/prompt-redesign + ⇡1</span><span class="seg seg-symbol">$</span><span class="caret">git push</span>
</p>
</div>
<div class="hero-actions">
<a class="button" href="#install">Install it</a>
<a class="button button-quiet" href="/docs/">Read the docs</a>
</div>
</div>
</section>
<section id="install" class="sunken">
<div class="wrap">
<div class="section-head">
<p class="eyebrow">install</p>
<h2>Into your own account.</h2>
<p class="lede">powerbash needs no privileges and touches nothing outside your
home directory. Use Homebrew if you have it — upgrades then come along with
everything else. The other two are for machines that do not.</p>
</div>
<div class="methods">
<article class="method">
<div class="method-text">
<h3>Homebrew <span class="tag">recommended</span></h3>
<p>macOS or Linux. Upgrades along with everything else you have installed.</p>
</div>
<pre>brew install powerbash/powerbash/powerbash</pre>
</article>
<article class="method">
<div class="method-text">
<h3>Install script</h3>
<p>For machines without Homebrew. Downloads the script and wires it into
your shell startup file. Run it again any time to upgrade, or pass
<code>uninstall</code> to remove it.</p>
</div>
<pre>curl -s https://get.powerbash.org | bash</pre>
</article>
<article class="method">
<div class="method-text">
<h3>By hand</h3>
<p>One file and one line. Use <code>~/.bash_profile</code> on macOS, where
terminals start login shells.</p>
</div>
<pre>curl -Ls https://download.powerbash.org/powerbash.sh -o ~/powerbash.sh
echo 'source ~/powerbash.sh' >> ~/.bashrc</pre>
</article>
</div>
<p class="note">Start a new shell afterwards, or run <code>exec bash</code>.
Installing for every account on a machine is possible but discouraged — see
<a href="/docs/#global">multi-user installs</a> for what it costs you.</p>
</div>
</section>
<section id="build">
<div class="wrap">
<div class="section-head">
<p class="eyebrow">every segment, every mode</p>
<h2>Build a prompt.</h2>
<p class="lede">Turn segments on and off, and pick how the ones with modes
render. The prompt updates, and so does the list of commands that would get
you there — the same ones you would type into a shell, all of them
tab-completable. Nothing listed means you are on the defaults already.</p>
</div>
<!-- There is no script on this page. These controls are checkboxes and
radios, and the rules in main.css key off :checked. They have to be
direct siblings of .config: the ~ combinator cannot reach out of a
wrapper, so they are hidden individually rather than as a group.
Every control starts on the value powerbash actually ships with, so
the command list below means exactly one thing: the diff from the
defaults. That is why `py virtualenv on`, `host auto` and `path
working` are absent from it -- picking a default emits nothing.
Keep multi-valued settings as radios. host was a checkbox once, which
left `auto` unrepresentable and `powerbash host on` missing from the
list entirely, so the section quietly lied about what you would
type. -->
<input class="config-input" type="radio" name="venvmode" id="v-off">
<input class="config-input" type="radio" name="venvmode" id="v-on" checked>
<input class="config-input" type="radio" name="venvmode" id="v-short">
<input class="config-input" type="radio" name="venvmode" id="v-icon">
<input class="config-input" type="checkbox" id="c-user" checked>
<input class="config-input" type="radio" name="hostmode" id="h-off">
<input class="config-input" type="radio" name="hostmode" id="h-auto" checked>
<input class="config-input" type="radio" name="hostmode" id="h-on">
<input class="config-input" type="radio" name="pathmode" id="p-off">
<input class="config-input" type="radio" name="pathmode" id="p-full">
<input class="config-input" type="radio" name="pathmode" id="p-working" checked>
<input class="config-input" type="radio" name="pathmode" id="p-parted">
<input class="config-input" type="radio" name="pathmode" id="p-short">
<input class="config-input" type="radio" name="pathmode" id="p-mini">
<input class="config-input" type="checkbox" id="c-git" checked>
<input class="config-input" type="checkbox" id="c-jobs" checked>
<input class="config-input" type="checkbox" id="c-symbol" checked>
<input class="config-input" type="checkbox" id="c-rc" checked>
<div class="config">
<div class="config-preview">
<div class="terminal">
<p class="prompt">
<span class="seg seg-venv venv-on">▶ webapp-3.12</span><span
class="seg seg-venv venv-short">▶ webap</span><span
class="seg seg-venv venv-icon">▶</span><span
class="seg seg-user">napalm</span><span
class="seg seg-host">@build-01</span><span
class="seg seg-path path-full">/home/napalm/src/webapp/src/components/widgets</span><span
class="seg seg-path path-working">widgets</span><span
class="seg seg-path path-parted">/home/.../components/widgets</span><span
class="seg seg-path path-short">..c/components/widgets</span><span
class="seg seg-path path-mini">/h/n/s/w/s/c/widgets</span><span
class="seg seg-git">»main + ⇡1</span><span
class="seg seg-jobs">2</span><span
class="seg seg-symbol">$</span><span
class="seg seg-rc">127</span>
</p>
</div>
<pre class="commands"><span class="hint"># type these to keep what you picked</span><span class="cmd cmd-v-off">powerbash py virtualenv off</span><span class="cmd cmd-v-short">powerbash py virtualenv short</span><span class="cmd cmd-v-icon">powerbash py virtualenv icon</span><span class="cmd cmd-user-off">powerbash user off</span><span class="cmd cmd-h-off">powerbash host off</span><span class="cmd cmd-h-on">powerbash host on</span><span class="cmd cmd-p-off">powerbash path off</span><span class="cmd cmd-p-full">powerbash path full</span><span class="cmd cmd-p-parted">powerbash path parted</span><span class="cmd cmd-p-short">powerbash path short</span><span class="cmd cmd-p-mini">powerbash path mini</span><span class="cmd cmd-git-off">powerbash git off</span><span class="cmd cmd-jobs-off">powerbash jobs off</span><span class="cmd cmd-symbol-off">powerbash symbol off</span><span class="cmd cmd-rc-off">powerbash rc off</span><span class="cmd cmd-save">powerbash config save</span></pre>
</div>
<div class="controls">
<h3>Segments</h3>
<p>Starting from the defaults powerbash ships with.</p>
<div class="control-group">
<span class="group-label">Show</span>
<div class="control-list">
<label class="lbl-user" for="c-user">user</label>
<label class="lbl-git" for="c-git">git</label>
<label class="lbl-jobs" for="c-jobs">jobs</label>
<label class="lbl-symbol" for="c-symbol">symbol</label>
<label class="lbl-rc" for="c-rc">return code</label>
</div>
</div>
<div class="control-group">
<span class="group-label">Virtualenv</span>
<div class="control-list">
<label class="lbl-v-off" for="v-off">off</label>
<label class="lbl-v-on" for="v-on">on</label>
<label class="lbl-v-short" for="v-short">short</label>
<label class="lbl-v-icon" for="v-icon">icon</label>
</div>
<p class="control-note">The segment appears only while an environment is
active. <code>short</code> keeps the first five characters of its name.</p>
</div>
<div class="control-group">
<span class="group-label">Host</span>
<div class="control-list">
<label class="lbl-h-off" for="h-off">off</label>
<label class="lbl-h-auto" for="h-auto">auto</label>
<label class="lbl-h-on" for="h-on">on</label>
</div>
<p class="control-note"><code>auto</code> shows the host only over SSH, and
the preview is a local shell — so it looks like <code>off</code> here. The
command below is the difference.</p>
</div>
<div class="control-group">
<span class="group-label">Path</span>
<div class="control-list">
<label class="lbl-p-off" for="p-off">off</label>
<label class="lbl-p-full" for="p-full">full</label>
<label class="lbl-p-working" for="p-working">working</label>
<label class="lbl-p-parted" for="p-parted">parted</label>
<label class="lbl-p-short" for="p-short">short</label>
<label class="lbl-p-mini" for="p-mini">mini</label>
</div>
</div>
</div>
</div>
</div>
</section>
<section id="segments" class="sunken">
<div class="wrap">
<div class="section-head">
<p class="eyebrow">what the colors mean</p>
<h2>Reading a prompt.</h2>
</div>
<div class="scroller">
<table class="segment-table">
<thead>
<tr>
<th scope="col">Segment</th>
<th scope="col">Looks like</th>
<th scope="col">Tells you</th>
</tr>
</thead>
<tbody>
<tr>
<td data-label="Segment">virtualenv</td>
<td data-label="Looks like"><span class="chip seg-venv">▶ webapp-3.12</span></td>
<td data-label="Tells you">A Python or Conda environment is active. <code>short</code> trims the
name to five characters; <code>icon</code> drops the name entirely.</td>
</tr>
<tr>
<td data-label="Segment">user</td>
<td data-label="Looks like"><span class="chip seg-user">napalm</span></td>
<td data-label="Tells you">Who you are. Turns yellow under <code>sudo</code> and over SSH.</td>
</tr>
<tr>
<td data-label="Segment">host</td>
<td data-label="Looks like"><span class="chip seg-host">@build-01</span></td>
<td data-label="Tells you">Which machine. Hidden until you are over SSH, so it takes up room
only when that is a thing you might forget.</td>
</tr>
<tr>
<td data-label="Segment">path</td>
<td data-label="Looks like"><span class="chip seg-path">widgets</span></td>
<td data-label="Tells you">Where you are, in one of five widths. Always <code>~</code> at home.</td>
</tr>
<tr>
<td data-label="Segment">git</td>
<td data-label="Looks like"><span class="chip seg-git">»main + ⇡2 ⇣1</span></td>
<td data-label="Tells you">Branch — or a tag or short SHA when the head is detached.
<code>+</code> means uncommitted changes; <code>⇡</code> and
<code>⇣</code> count commits ahead of and behind the remote.</td>
</tr>
<tr>
<td data-label="Segment">jobs</td>
<td data-label="Looks like"><span class="chip seg-jobs">2</span></td>
<td data-label="Tells you">Background jobs in this shell. Appears only when there are some.</td>
</tr>
<tr>
<td data-label="Segment">symbol</td>
<td data-label="Looks like"><span class="chip seg-symbol">$</span></td>
<td data-label="Tells you">Where your command goes. <code>#</code> and red when you are root.</td>
</tr>
<tr>
<td data-label="Segment">return code</td>
<td data-label="Looks like"><span class="chip seg-rc">127</span></td>
<td data-label="Tells you">What the last command exited with. Appears only when it was not zero.</td>
</tr>
</tbody>
</table>
</div>
</div>
</section>
<section id="why">
<div class="wrap">
<div class="section-head">
<p class="eyebrow">why it stays out of the way</p>
<h2>One file. Nothing else.</h2>
</div>
<div class="facts">
<div class="fact">
<h3>No dependencies</h3>
<p>No Python, no Go, no daemon, no font patching. Bash, plus <code>tput</code>
and <code>git</code> if you have them. Without those it still renders, just
plainer.</p>
</div>
<div class="fact">
<h3>bash 3.2 and up</h3>
<p>Including the <code>/bin/bash</code> macOS still ships. Every change is
tested against that, against current bash, and on Linux and macOS.</p>
</div>
<div class="fact">
<h3>No fork per prompt</h3>
<p>Segments write straight into <code>PS1</code> rather than running
subshells, and git state comes from one call. On slow filesystems you can
time it out or skip whole paths.</p>
</div>
<div class="fact">
<h3>Nothing gets executed</h3>
<p>A branch or directory named <code>$(rm -rf ~)</code> is escaped before it
reaches <code>PS1</code>. Saved settings are read back through an
allowlist, never sourced.</p>
</div>
</div>
</div>
</section>
</main>
<footer>
<div class="wrap">
<p>powerbash — MIT licensed.</p>
<nav aria-label="Footer">
<a href="/docs/">Docs</a>
<a href="https://github.com/napalm255/powerbash">Source</a>
<a href="https://github.com/napalm255/powerbash/issues">Issues</a>
<a href="https://download.powerbash.org/powerbash.sh">Download</a>
</nav>
</div>
</footer>
</body>
</html>