Skip to content

Commit 2d2cec6

Browse files
committed
Continue release notes
1 parent dea650c commit 2d2cec6

File tree

1 file changed

+143
-3
lines changed

1 file changed

+143
-3
lines changed

blog/2024-11-12-nushell_0_100_0.md

Lines changed: 143 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,34 @@ We wish to express our heartfelt gratitude and congratulations to all of our con
8181

8282
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.
8383

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+
84101
### `catch` error record
85102

86103
In [#14082](https://github.com/nushell/nushell/pull/14082), two additional columns were added to the error record passed to catch blocks/closures:
87104

88105
- `json`: a string containing the error data as JSON.
89106
- `rendered`: a string containing the pretty formatted error message, roughly the same as you would see in your terminal.
90107

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+
91112
### `help commands` and `scope commands`
92113

93114
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
105126
# a=1&a=2&b=3
106127
```
107128

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+
108133
### `stor`
109134

110135
`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`/`
123148

124149
### `open --raw`
125150

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.
127152

128153
### `help`
129154

@@ -133,8 +158,85 @@ The `help` output for commands now shows the command type in parenthesis after t
133158

134159
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.
135160

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+
136165
## Breaking changes [[toc](#table-of-content)]
137166

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+
138240
### Lone, leading pipe in closures
139241

140242
Currently, a leading pipe character is allowed for pipelines in Nushell:
@@ -186,19 +288,47 @@ plugin list | where status == running
186288

187289
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.
188290

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+
189315
## Deprecations [[toc](#table-of-content)]
190316

191317
## Removals [[toc](#table-of-content)]
192318

193319
## Bug fixes and other changes [[toc](#table-of-content)]
194320

195-
### `return`
321+
### `return`, `break`, and `continue`
196322

197323
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.
198324

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+
199329
### `to text`
200330

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.
202332

203333
### `to nuon`
204334

@@ -230,6 +360,14 @@ The formatting has also been changed in [#14197](https://github.com/nushell/nush
230360

231361
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).
232362

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+
233371
### `clear`
234372

235373
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).
@@ -256,6 +394,8 @@ https://github.com/nushell/nushell/pull/14128
256394
https://github.com/nushell/nushell/pull/14229
257395
https://github.com/nushell/nushell/pull/14230
258396
https://github.com/nushell/nushell/pull/14291
397+
https://github.com/nushell/nushell/pull/14307
398+
https://github.com/nushell/nushell/pull/14002
259399
-->
260400

261401
# Full changelog [[toc](#table-of-content)]

0 commit comments

Comments
 (0)