Skip to content

Commit 82e7a91

Browse files
authored
Make code examples executable (#1798)
Followup to #1684
1 parent 9eb39c1 commit 82e7a91

File tree

8 files changed

+64
-64
lines changed

8 files changed

+64
-64
lines changed

contributor-book/plugins.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -267,21 +267,21 @@ If you're already running `nu` during the installation process of your plugin, e
267267

268268
Once `nu` starts up, it will discover the plugin and add its commands to the scope.
269269

270-
```
271-
> nu
272-
> "hello" | len
273-
5
274-
> help len
275-
calculates the length of its input
276-
277-
Usage:
278-
> len
279-
280-
Flags:
281-
-h, --help - Display the help message for this command
282-
283-
Signatures:
284-
<string> | len -> <int>
270+
```nu
271+
nu
272+
"hello" | len
273+
# => 5
274+
help len
275+
# => calculates the length of its input
276+
# =>
277+
# => Usage:
278+
# => > len
279+
# =>
280+
# => Flags:
281+
# => -h, --help - Display the help message for this command
282+
# =>
283+
# => Signatures:
284+
# => <string> | len -> <int>
285285
```
286286

287287
Run `plugin list` to see all plugins currently registered and available to this Nu session, including whether or not they are running, and their process ID if so.

cookbook/jq_v_nushell.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -735,8 +735,8 @@ Note that if what you are after is computing a histogram, you can benefit from t
735735
This section provides the implementation of the custom commands used in this cookbook. Note that they are illustrative and in no way optimised for large inputs. If you are interested in that, [plugins](/book/plugins.html) will likely be the answer as they can be written in general purpose languages such as Rust or Python.
736736

737737
```nu
738-
> use toolbox.nu *
739-
> help commands | where command_type == "custom"
738+
use toolbox.nu *
739+
help commands | where command_type == "custom"
740740
```
741741

742742
```

de/book/custom_commands.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -270,14 +270,14 @@ def my-echo [] {
270270

271271
Wenn dieser neue Befehl nun in einer Pipeline aufgerufen wird, sieht die Ausgabe wie folgt aus:
272272

273-
```
274-
> echo foo bar | my-echo
275-
───┬─────
276-
0 │ foo
277-
1 │ --
278-
2 │ bar
279-
3 │ --
280-
───┴─────
273+
```nu
274+
echo foo bar | my-echo
275+
# => ───┬─────
276+
# => 0 │ foo
277+
# => 1 │ --
278+
# => 2 │ bar
279+
# => 3 │ --
280+
# => ───┴─────
281281
```
282282

283283
## Persistenz

de/book/custom_completions.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,13 @@ module commands {
8181
```
8282
Der Befehl `tier-name` gibt die entsprechende Liste der Namen zurück. Dies funktioniert, weil der Wert der `$context` Variablen, dem Text entspricht, der bis zu dem Zeitpunkt eingegeben wurde.
8383

84-
```
85-
>| my-command
86-
katze hund aal
87-
>| my-command hund
88-
Lulu Enzo
89-
>my-command hund enzo
90-
Als hund heisse ich Enzo
84+
```nu
85+
my-command
86+
# => katze hund aal
87+
my-command hund
88+
# => Lulu Enzo
89+
my-command hund enzo
90+
# => Als hund heisse ich Enzo
9191
```
9292

9393
Auf der zweiten Zeile wird, sobald die `<tab>` Taste gedrückt wurde, das Argument `"my-command hund"` dem `tier-namen` Kontext übergeben.

de/book/loading_data.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ Nu unterstützt aktuell die folgenden Formate um Daten direkt als Tabelle zu öf
4747

4848
Was aber passiert, wenn eine Text Datei geladen wird, die keinem der angegebenen Formate entspricht?
4949

50-
```
51-
# => open README.md
50+
```nu
51+
open README.md
5252
```
5353

5454
Die Datei wird wie gewohnt als Text ausgegeben.

de/book/overlays.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ Am Anfang sollte dort der die Standard-Überlagerung gelistet sein.
1515

1616
Um eine neue Überlagerung zu kreieren, wird zuerst ein Modul benötigt:
1717

18-
```
19-
> module spam {
18+
```nu
19+
module spam {
2020
export def foo [] {
2121
"foo"
2222
}
@@ -33,23 +33,23 @@ Dieses Modul wird im ganzen Kapitel verwendet, also wenn immer `overlay use spam
3333

3434
Um die Überlagerung zu generieren, wird [`overlay use`](/commands/docs/overlay_use.md) aufgerufen:
3535

36-
```
37-
> overlay use spam
36+
```nu
37+
overlay use spam
3838
39-
> foo
4039
foo
40+
# => foo
4141
42-
> bar
4342
bar
43+
# => bar
4444
45-
> $env.BAZ
46-
baz
45+
$env.BAZ
46+
# => baz
4747
48-
> overlay list
49-
───┬──────
50-
0 │ zero
51-
1 │ spam
52-
───┴──────
48+
overlay list
49+
# => ───┬──────
50+
# => 0 │ zero
51+
# => 1 │ spam
52+
# => ───┴──────
5353
```
5454

5555
Dies hat die Definition des Moduls in den aktuellen Gültigkeitsbereich gebracht und den [`export-env`](/commands/docs/export-env.md) Block ausgewertet.

ja/book/pipeline.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@ Nu は Bash のような他のシェルと同じように2つの外部コマ
3939
実質的にこのコマンドと
4040

4141
```nu
42-
> ls
42+
ls
4343
```
4444

4545
このパイプラインは
4646

4747
```nu
48-
> ls | autoview
48+
ls | autoview
4949
```
5050

5151
同じものです。

lang-guide/chapters/pipelines.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -50,21 +50,21 @@ Redirection to a file:
5050
Note that `e>|` and `o+e>|` only work with external command, if you pipe internal commands' output through `e>|` and `o+e>|`, you will get an error:
5151

5252
```nu
53-
ls e>| str length
54-
Error: × `e>|` only works with external streams
55-
╭─[entry #1:1:1]
56-
1 │ ls e>| str length
57-
· ─┬─
58-
· ╰── `e>|` only works on external streams
59-
╰────
60-
61-
ls e+o>| str length
62-
Error: × `o+e>|` only works with external streams
63-
╭─[entry #2:1:1]
64-
1 │ ls e+o>| str length
65-
· ──┬──
66-
· ╰── `o+e>|` only works on external streams
67-
╰────
53+
ls e>| str length
54+
# => Error: × `e>|` only works with external streams
55+
# => ╭─[entry #1:1:1]
56+
# => 1 │ ls e>| str length
57+
# => · ─┬─
58+
# => · ╰── `e>|` only works on external streams
59+
# => ╰────
60+
61+
ls e+o>| str length
62+
# => Error: × `o+e>|` only works with external streams
63+
# => ╭─[entry #2:1:1]
64+
# => 1 │ ls e+o>| str length
65+
# => · ──┬──
66+
# => · ╰── `o+e>|` only works on external streams
67+
# => ╰────
6868
```
6969

7070
You can also redirect `stdout` to a file, and pipe `stderr` to next command:

0 commit comments

Comments
 (0)