You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: blog/2024-11-12-nushell_0_100_0.md
+143-3Lines changed: 143 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -81,13 +81,34 @@ We wish to express our heartfelt gratitude and congratulations to all of our con
81
81
82
82
With [#14072](https://github.com/nushell/nushell/pull/14072), this release adds two "new" operators: `like` and `not-like`. These operators are alternative forms of the preexisting `=~` and `!~` operators, respectively. The only reason to use one form over the other is preference. For example, people familiar with SQL may prefer using `like` and `not-like`. In the future, there is a chance that the shorter forms may be removed, but there are no plans to do so yet, if at all.
83
83
84
+
### `history import`
85
+
86
+
Thanks to [@qfel](https://github.com/qfel) in [#13450](https://github.com/nushell/nushell/pull/13450), this release adds the `history import` command. Running this command takes the history from the alternate history file format and imports it into the currently configured history file format. For example, to migrate from plain text to sqlite:
87
+
88
+
```nu
89
+
# Current format is plain text
90
+
# $env.config.history.file_format == plaintext
91
+
92
+
# Change the file format. Make sure to set this in your config if you want to persist this change.
93
+
$env.config.history.file_format = 'sqlite'
94
+
95
+
# Import the old history to the new format. It will create a backup if necessary.
96
+
history import
97
+
```
98
+
99
+
You can also pipe new history entries into `history import`, and they will be added to your history file. See `help history import` for some examples.
100
+
84
101
### `catch` error record
85
102
86
103
In [#14082](https://github.com/nushell/nushell/pull/14082), two additional columns were added to the error record passed to catch blocks/closures:
87
104
88
105
-`json`: a string containing the error data as JSON.
89
106
-`rendered`: a string containing the pretty formatted error message, roughly the same as you would see in your terminal.
90
107
108
+
### `touch --no-deref`
109
+
110
+
Thanks to [@Dorumin](https://github.com/Dorumin) in [#14214](https://github.com/nushell/nushell/pull/14214), a new `--no-deref` flag was added to `touch`. Providing this flag will make `touch` not follow symlinks.
111
+
91
112
### `help commands` and `scope commands`
92
113
93
114
The `help commands` and `scope commands` now output an `is_const` column indicating whether a command can be used in a parse-time constant context ([#14125](https://github.com/nushell/nushell/pull/14125)).
@@ -105,6 +126,10 @@ Thanks to [@adaschma](https://github.com/adaschma) in [#14073](https://github.co
105
126
# a=1&a=2&b=3
106
127
```
107
128
129
+
### `length`
130
+
131
+
Thanks to [@sgvictorino](https://github.com/sgvictorino) in [#14224](https://github.com/nushell/nushell/pull/14224), the `length` command now supports binary values as input and returns the number of bytes.
132
+
108
133
### `stor`
109
134
110
135
`stor` now supports list and table inputs thanks to [@friaes](https://github.com/friaes) in [#14175](https://github.com/nushell/nushell/pull/14175).
@@ -123,7 +148,7 @@ In [#14158](https://github.com/nushell/nushell/pull/14158), the `--no-newline`/`
123
148
124
149
### `open --raw`
125
150
126
-
After [#14141](https://github.com/nushell/nushell/pull/14141), `open --raw` now sets the `content-type` in the pipeline metadata for `nu`, `nuon`, and `json` files.
151
+
After [#14141](https://github.com/nushell/nushell/pull/14141), `open --raw` now sets the appropriate `content-type` in the pipeline metadata for `nu`, `nuon`, and `json` files.
127
152
128
153
### `help`
129
154
@@ -133,8 +158,85 @@ The `help` output for commands now shows the command type in parenthesis after t
133
158
134
159
A new option has been introduced for table rendering by [@zhiburt](https://github.com/zhiburt) in [#14070](https://github.com/nushell/nushell/pull/14070). With `$env.config.table.footer_inheritance = true`, if one of the inner rendered tables trips the footer mode setting to show a footer at the bottom of the table, all of the outer tables will also have footers rendered.
135
160
161
+
### Function key keybindings
162
+
163
+
Thanks to [@hacker-DOM](https://github.com/hacker-DOM) in [#14201](https://github.com/nushell/nushell/pull/14201), the function keys from F21 to F35 are now allowed in key bindings. Note that for the keys to work, support for the kitty keyboard protocol needs to be enabled in your config (`$env.config.use_kitty_protocol`) and your terminal also needs to support the protocol.
164
+
136
165
## Breaking changes [[toc](#table-of-content)]
137
166
167
+
### Division, floor division, and `mod`
168
+
169
+
In [#14157](https://github.com/nushell/nushell/pull/14157), several changes were made to the division related operators to make them more consistent.
170
+
171
+
### Division
172
+
173
+
First, division between two integers used to be able to return either an int or a float value even though the type signature claimed the result would always be a float.
174
+
175
+
```nu
176
+
(1 / 2 | describe) == float
177
+
(2 / 2 | describe) == int
178
+
```
179
+
180
+
This release changes division between any two types to always return a float **except** if the left hand side is a filesize or duration and the right hand side is an int or float.
181
+
182
+
```nu
183
+
(1 / 2 | describe) == float
184
+
(2 / 2 | describe) == float
185
+
(1KB / 1KB | describe) == float
186
+
(2sec / 2sec | describe) == float
187
+
188
+
# There is no floating point representation for filesizes and durations,
189
+
# so truncating division is used in this case.
190
+
(5B / 2) == 2B
191
+
(2sec / 2.0) == 1sec
192
+
```
193
+
194
+
#### Floor division
195
+
196
+
Second, floor division now does automatic float promotion. That is, if one of the operands is a float, and the other is an int or float, then the result will be a float. This matches the behavior of other operators like addition and multiplication which do float promotion as well. It also avoids potential overflows when trying to convert a large magnitude float into an int.
197
+
198
+
```nu
199
+
# Before
200
+
(1 // 1 | describe) == int
201
+
(1 // 1.0 | describe) == int
202
+
(1.0 // 1.0 | describe) == int
203
+
204
+
# After
205
+
(1 // 1 | describe) == int
206
+
(1 // 1.0 | describe) == float
207
+
(1.0 // 1.0 | describe) == float
208
+
```
209
+
210
+
Additionally, the previous implementation of floor division performed unnecessary clamping which has been fixed with this release. So, results should now be more accurate.
211
+
212
+
#### `mod`
213
+
214
+
In previous releases, the implementation of `mod` was based off of truncating division even though Nushell does not have a truncating division operator. This release changes `mod` to be based off of floor division so that `mod` and floor division in combination can satisfy the division rule:
215
+
216
+
```nu
217
+
let quotient = $n // $d
218
+
let remainder = $n mod $d
219
+
$n == $quotient * $d + $remainder
220
+
```
221
+
222
+
If the signs of the divisor and dividend are the same, then the result of `mod` will be the same as before. However, if the signs are not the same, then the result of `mod` will be different compared to before to satisfy the division rule.
223
+
224
+
```nu
225
+
# Before
226
+
let q = 8 // -3 # -3
227
+
let r = 8 mod -3 # 2
228
+
8 == $q * -3 + $r # false
229
+
230
+
# After
231
+
let q = 8 // -3 # -3
232
+
let r = 8 mod -3 # -1
233
+
8 == $q * -3 + $r # true
234
+
```
235
+
236
+
This matches the behavior of Python's `//` and `%` operators which were the original inspiration.
237
+
238
+
Otherwise, the implementation of all the division related operators has been improved to account for overflow. Rather than silently clamping or overflowing, the operators will now create an error in these cases.
239
+
138
240
### Lone, leading pipe in closures
139
241
140
242
Currently, a leading pipe character is allowed for pipelines in Nushell:
@@ -186,19 +288,47 @@ plugin list | where status == running
186
288
187
289
In case you want to avoid loading the plugin registry file (e.g. for performance reasons), you can now use the `--engine` flag to do so. Similarly, the `--registry` flag will only display the contents of the registry, without comparing them against the state of the engine (but all plugins will appear as `added`). The `--plugin-config` flag is now supported to allow use of a separate plugin registry file, identically to the other `plugin` commands.
188
290
291
+
### `http``--max-time`
292
+
293
+
With [#14237](https://github.com/nushell/nushell/pull/14237), the `--max-time` flag for the `http` family of commands now takes a duration value instead of a integer number of seconds. Thanks to [@alex-kattathra-johnson](https://github.com/alex-kattathra-johnson) for making this change!
294
+
295
+
### Empty rest matches
296
+
297
+
If a list rest pattern match ended up being empty, the match variable would previously be `null`. In [#14246](https://github.com/nushell/nushell/pull/14246) thanks to [@CharlesTaylor7](https://github.com/CharlesTaylor7), the match variable will instead be an empty list if no matches are found.
298
+
299
+
```nu
300
+
# Before
301
+
match [] {
302
+
[..$rest] => ($rest == null) # true
303
+
}
304
+
305
+
# After
306
+
match [] {
307
+
[..$rest] => ($rest == []) # true
308
+
}
309
+
```
310
+
311
+
### `ansi clear_entire_screen_plus_buffer`
312
+
313
+
In [#14184](https://github.com/nushell/nushell/pull/14184), `ansi clear_entire_screen_plus_buffer` now returns an ansi code that clears both the screen and scrollback buffer. Previously, it would only clear the scrollback buffer. In addition, a new `clear_scrollback_buffer` entry has been added to the `ansi` command. This will clear only the scrollback buffer.
314
+
189
315
## Deprecations [[toc](#table-of-content)]
190
316
191
317
## Removals [[toc](#table-of-content)]
192
318
193
319
## Bug fixes and other changes [[toc](#table-of-content)]
194
320
195
-
### `return`
321
+
### `return`, `break`, and `continue`
196
322
197
323
In [#14120](https://github.com/nushell/nushell/pull/14120), a bug was fixed were `return`, `break`, and `continue` would set the last exit code to 1.
198
324
325
+
### External command bareword arguments
326
+
327
+
There was a bug where "expressions" inside barewords created using backticks would be evaluated if provided as arguments to external commands. This has been fixed with [#14210](https://github.com/nushell/nushell/pull/14210).
328
+
199
329
### `to text`
200
330
201
-
`to text`would previously have different behavior for list values and streaming list input. This has been fixed with [#14158](https://github.com/nushell/nushell/pull/14158), and the behavior for list streams is now used for list values.
331
+
`to text` previously had different behavior for list values and streaming list input. This has been fixed with [#14158](https://github.com/nushell/nushell/pull/14158), and the behavior for list streams is now used for list values.
202
332
203
333
### `to nuon`
204
334
@@ -230,6 +360,14 @@ The formatting has also been changed in [#14197](https://github.com/nushell/nush
230
360
231
361
The step value for ranges was previously not taken into account when checking if a value was `in` a range. Thanks to [@JoaquinTrinanes](https://github.com/JoaquinTrinanes), this has been fixed with [#14011](https://github.com/nushell/nushell/pull/14011).
232
362
363
+
### `ansi -l`
364
+
365
+
The preview column from `ansi -l` now also shows bold, dimmed, blink, and other effects thanks to [@NotTheDr01ds](https://github.com/NotTheDr01ds) in [#14196](https://github.com/nushell/nushell/pull/14196).
366
+
367
+
### `join`
368
+
369
+
An issue where table literal agruements to `join` were not parsed correctly has been fixed in [#14190](https://github.com/nushell/nushell/pull/14190) thanks to [@sgvictorino](https://github.com/sgvictorino).
370
+
233
371
### `clear`
234
372
235
373
On some terminals, `clear` would behave weirdly if used in a series of commands. Thanks to [@NotTheDr01ds](https://github.com/NotTheDr01ds), this has been fixed in [#14181](https://github.com/nushell/nushell/pull/14181).
0 commit comments