Skip to content

Commit e06d5d5

Browse files
committed
fix indentations
1 parent 89e929c commit e06d5d5

File tree

3 files changed

+73
-73
lines changed

3 files changed

+73
-73
lines changed

book/environment.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -238,9 +238,9 @@ The hiding is also scoped which both allows you to remove an environment variabl
238238
```nu
239239
$env.FOO = 'BAR'
240240
do {
241-
hide-env FOO
242-
# $env.FOO does not exist
243-
}
241+
hide-env FOO
242+
# $env.FOO does not exist
243+
}
244244
$env.FOO
245245
# => BAR
246246
```

book/navigating_structured_data.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -284,10 +284,10 @@ Example:
284284

285285
```nu
286286
let record_example = {
287-
"1": foo
288-
"2": baz
289-
"3": far
290-
}
287+
"1": foo
288+
"2": baz
289+
"3": far
290+
}
291291
292292
$record_example."1"
293293
# => foo

book/pipelines.md

Lines changed: 66 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -130,94 +130,94 @@ See: [Custom Commands -> Pipeline Input](custom_commands.html#pipeline-input)
130130
def echo_me [] {
131131
print $in
132132
}
133-
true | echo_me
133+
true | echo_me
134134
# => true
135135
```
136136

137-
- **_Rule 1.5:_** This is true throughout the current scope. Even on subsequent lines in a closure or block, `$in` is the same value when used in the first position of _any pipeline_ inside that scope.
137+
- **_Rule 1.5:_** This is true throughout the current scope. Even on subsequent lines in a closure or block, `$in` is the same value when used in the first position of _any pipeline_ inside that scope.
138138

139-
Example:
140-
141-
```nu
142-
[ a b c ] | each {
143-
print $in
144-
print $in
145-
$in
146-
}
147-
```
139+
Example:
148140

149-
All three of the `$in` values are the same on each iteration, so this outputs:
141+
```nu
142+
[ a b c ] | each {
143+
print $in
144+
print $in
145+
$in
146+
}
147+
```
150148

151-
```nu
152-
a
153-
a
154-
b
155-
b
156-
c
157-
c
158-
╭───┬───╮
159-
│ 0 │ a │
160-
│ 1 │ b │
161-
│ 2 │ c │
162-
╰───┴───╯
163-
```
149+
All three of the `$in` values are the same on each iteration, so this outputs:
150+
151+
```nu
152+
a
153+
a
154+
b
155+
b
156+
c
157+
c
158+
╭───┬───╮
159+
│ 0 │ a │
160+
│ 1 │ b │
161+
│ 2 │ c │
162+
╰───┴───╯
163+
```
164164

165-
* **_Rule 2:_** When used anywhere else in a pipeline (other than the first position), `$in` refers to the previous expression's result:
165+
- **_Rule 2:_** When used anywhere else in a pipeline (other than the first position), `$in` refers to the previous expression's result:
166166

167167
Example:
168168

169169
```nushell
170-
4 # Pipeline input
171-
| $in * $in # $in is 4 in this expression
172-
| $in / 2 # $in is now 16 in this expression
173-
| $in # $in is now 8
170+
4 # Pipeline input
171+
| $in * $in # $in is 4 in this expression
172+
| $in / 2 # $in is now 16 in this expression
173+
| $in # $in is now 8
174174
# => 8
175175
```
176176

177-
- **_Rule 2.5:_** Inside a closure or block, Rule 2 usage occurs inside a new scope (a sub-expression) where that "new" `$in` value is valid. This means that Rule 1 and Rule 2 usage can coexist in the same closure or block.
177+
- **_Rule 2.5:_** Inside a closure or block, Rule 2 usage occurs inside a new scope (a sub-expression) where that "new" `$in` value is valid. This means that Rule 1 and Rule 2 usage can coexist in the same closure or block.
178178

179-
Example:
179+
Example:
180180

181-
```nushell
182-
4 | do {
183-
print $in # closure-scope $in is 4
181+
```nushell
182+
4 | do {
183+
print $in # closure-scope $in is 4
184184
185-
let p = ( # explicit sub-expression, but one will be created regardless
186-
$in * $in # initial-pipeline position $in is still 4 here
187-
| $in / 2 # $in is now 16
188-
) # $p is the result, 8 - Sub-expression scope ends
185+
let p = ( # explicit sub-expression, but one will be created regardless
186+
$in * $in # initial-pipeline position $in is still 4 here
187+
| $in / 2 # $in is now 16
188+
) # $p is the result, 8 - Sub-expression scope ends
189189
190-
print $in # At the closure-scope, the "original" $in is still 4
191-
print $p
192-
}
193-
```
190+
print $in # At the closure-scope, the "original" $in is still 4
191+
print $p
192+
}
193+
```
194194

195-
So the output from the 3 `print` statements is:
195+
So the output from the 3 `print` statements is:
196196

197-
```nu
198-
4
199-
4
200-
8
201-
```
197+
```nu
198+
4
199+
4
200+
8
201+
```
202202

203-
Again, this would hold true even if the command above used the more compact, implicit sub-expression form:
203+
Again, this would hold true even if the command above used the more compact, implicit sub-expression form:
204204

205-
Example:
205+
Example:
206206

207-
```nushell
208-
4 | do {
209-
print $in # closure-scope $in is 4
210-
let p = $in * $in | $in / 2 # Implicit let sub-expression
211-
print $in # At the closure-scope, $in is still 4
212-
print $p
213-
}
207+
```nushell
208+
4 | do {
209+
print $in # closure-scope $in is 4
210+
let p = $in * $in | $in / 2 # Implicit let sub-expression
211+
print $in # At the closure-scope, $in is still 4
212+
print $p
213+
}
214214
215-
4
216-
4
217-
8
218-
```
215+
4
216+
4
217+
8
218+
```
219219

220-
* **_Rule 3:_** When used with no input, `$in` is null.
220+
- **_Rule 3:_** When used with no input, `$in` is null.
221221

222222
Example:
223223

@@ -240,15 +240,15 @@ See: [Custom Commands -> Pipeline Input](custom_commands.html#pipeline-input)
240240
This is the same as having no-input:
241241

242242
```nushell
243-
ls / | get name; $in | describe
244-
# => nothing
243+
ls / | get name; $in | describe
244+
# => nothing
245245
```
246246

247247
Instead, simply continue the pipeline:
248248

249249
```nushell
250250
ls / | get name | $in | describe
251-
# => list<string>
251+
# => list<string>
252252
```
253253

254254
### Best practice for `$in` in Multiline Code

0 commit comments

Comments
 (0)