Skip to content

Commit b9c6b07

Browse files
authored
Edit 0.98.0 release notes (#1551)
1 parent 285c702 commit b9c6b07

File tree

1 file changed

+80
-14
lines changed

1 file changed

+80
-14
lines changed

blog/2024-09-17-nushell_0_98_0.md

Lines changed: 80 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,12 @@ As part of this release, we also publish a set of optional plugins you can insta
2525
# Table of content
2626

2727
- [_Highlights and themes of this release_](#highlights-and-themes-of-this-release-toc)
28-
- [_Changes to commands_](#changes-to-commands-toc)
28+
- [_Changes_](#changes-toc)
2929
- [_Additions_](#additions-toc)
3030
- [_Breaking changes_](#breaking-changes-toc)
3131
- [_Deprecations_](#deprecations-toc)
3232
- [_Removals_](#removals-toc)
3333
- [_Bug fixes and other changes_](#bug-fixes-and-other-changes-toc)
34-
- [_All breaking changes_](#all-breaking-changes-toc)
3534
- [_Notes for plugin developers_](#notes-for-plugin-developers-toc)
3635
- [_Hall of fame_](#hall-of-fame-toc)
3736
- [_Full changelog_](#full-changelog-toc)
@@ -67,6 +66,41 @@ As part of this release, we also publish a set of optional plugins you can insta
6766
for the list of available *containers*
6867
-->
6968

69+
## Non-zero exit codes are now errors
70+
71+
One long-requested feature for nushell is to make non-zero exit codes throw an error. Before this release, non-zero exit codes would quietly stop execution. In some cases, execution would not even stop, but rather only skip over the remaining commands in the current code block. With this release, non-zero exit codes (and termination due to unix signals) are now errors just like any other error, so nushell now runs almost as if bash's `set -e` option was enabled ([#13515](https://github.com/nushell/nushell/pull/13515)).
72+
73+
Errors due to non-zero exit codes can be caught in a `try`/`catch` block, and the error record passed to the catch closure will contain an `exit_code` column in this case.
74+
75+
```nushell
76+
try {
77+
nu -c 'exit 42'
78+
} catch {|e|
79+
print $e.exit_code? # prints 42
80+
}
81+
```
82+
83+
As such, `$env.LAST_EXIT_CODE` is no longer necessary in most cases. Rather, `try`/`catch` should suffice for both internal and external errors, unifying and simplifying error handling.
84+
85+
Note that the `complete` command still works the same as it does today. If the previous command fails, its exit code and output will still be captured and returned by `complete`.
86+
87+
Some other things to note about the current implementation:
88+
89+
- Only the exit code of the last command of a pipeline is checked and can cause an error. The exit codes of all the previous commands in a pipeline are ignored. In the future, we may check and track the exit codes of all commands in a pipeline to provide an equivalent to bash's `set -o pipefail`, but this would require a major refactor. So for now, this functionality is only a potential future addition.
90+
91+
- If a command was terminated by a unix signal (e.g., SIGTERM, SIGINT), then the `exit_code` value in the `catch` error record will contain the negation of the signal number. For example, if SIGINT is signal number 2, then `exit_code` would be reported as `-2`. This is similar to how Python reports exit codes.
92+
93+
- The one exception is SIGPIPE. If a command is terminated due to SIGPIPE, then it is not treated as an error.
94+
95+
One downside of having non-zero exit codes as errors is that uncaught errors will print a nushell error message to the terminal which may make it annoying to find any error messages printed by the external command that failed. Similarly, some commands use exit codes to indicate other things besides failure (e.g., `diff`). Having all these extra error message in the REPL can be annoying, so two new config options have been added as well:
96+
97+
1. `$env.config.display_errors.exit_code`
98+
2. `$env.config.display_errors.termination_signal`
99+
100+
With no config (e.g., when running a script), these config options are both `true` and the corresponding error cases will be printed as a nushell error message. However, the default config (i.e., `config nu --default`) sets `display_errors.exit_code` to `false`. So, if you use the default config, or set this option in your config, then an error message won't be printed for non-zero exit codes in the REPL.
101+
102+
One last thing to note is that core dumps are treated as a separate error case and an error message will always be printed if the error is uncaught (i.e., there is no config option for this).
103+
70104
## Removing support for the system clipboard
71105

72106
With [#13694](https://github.com/nushell/nushell/pull/13694), support for the system clipboard in keybinds has been removed, as this is not something that we think we can provide good, cross-platform support for in a secure manner. Namely,
@@ -78,14 +112,37 @@ With [#13694](https://github.com/nushell/nushell/pull/13694), support for the sy
78112

79113
So, going forward, users that want the system clipboard functionality will have to compile a custom build of nushell by enabling the `system-clipboard` cargo feature. As an alternative, we recommend users delegate system clipboard handling to their terminal.
80114

81-
# Changes to commands [[toc](#table-of-content)]
115+
## Record parsing changes
116+
117+
Previously, it was impossible to use datetime literals with colons in record literals without adding parentheses. But thanks to [@cyradotpink](https://github.com/cyradotpink) in [#13413](https://github.com/nushell/nushell/pull/13413), this is now possible.
118+
119+
```nushell
120+
# Previously, parentheses were necessary:
121+
{ foo: (2024-08-13T22:11:09) }
122+
123+
# But this now works!
124+
{ foo: 2024-08-13T22:11:09 }
125+
```
126+
127+
To make this possible, a few changes were made to record parsing. This should not affect most code, but some previously valid code no longer parses successfully. For example:
128+
129+
```nushell
130+
{ :: 1 }
131+
# This used to parse as { ':': 1 }, but it is now an error.
132+
```
133+
134+
# Changes [[toc](#table-of-content)]
82135

83136
## Additions [[toc](#table-of-content)]
84137

85138
### `metadata access`
86139

87140
Thanks to [@Bahex](https://github.com/Bahex) in [#13785](https://github.com/nushell/nushell/pull/13785), a new `metadata access` command was added. It takes a closure argument, and the first argument to the closure will be the metadata record. Additionally, the pipeline input to `metadata access` will be forwarded to the closure as is. So, unlike the `metadata` command, this new command allows you to get the metadata of a pipeline without consuming the pipeline.
88141

142+
### `split cell-path`
143+
144+
In [#13705](https://github.com/nushell/nushell/pull/13705), [@Bahex](https://github.com/Bahex) also added the `split cell-path` command. It is essentially the opposite of `into cell-path` and returns a list of the path members of the input cell path.
145+
89146
### `split column --numbered`
90147

91148
Thanks to [@nome](https://github.com/nome) in [#13831](https://github.com/nushell/nushell/pull/13831), a `--numbered` flag was added to `split column` which limits the number of times to split the input string (just like `split row --numbered`).
@@ -121,12 +178,19 @@ After [#13650](https://github.com/nushell/nushell/pull/13650), `into record` als
121178

122179
### `clear`
123180

124-
In [#13821](https://github.com/nushell/nushell/pull/13821), [@T3sT3ro](https://github.com/T3sT3ro) changed the `clear` command to clear the entire scrollback buffer. As such, the `--all` flag was removed, since it is now the default behavior. Instead, a `--keep-scrollback` flag was added, which when used, makes `clear` clear only the terminal (the previous default behavior).
181+
In [#13821](https://github.com/nushell/nushell/pull/13821), [@T3sT3ro](https://github.com/T3sT3ro) changed the `clear` command to clear the entire scrollback buffer. As such, the `--all` flag was removed, since it is now the default behavior. Instead, a `--keep-scrollback` flag was added which, when used, makes `clear` clear only the terminal (the previous default behavior).
125182

126183
### `path exists`
127184

128185
After [#13763](https://github.com/nushell/nushell/pull/13763), if an I/O error occurs when checking if a path exists, `false` is now returned instead of throwing an error (this includes errors due to insufficient permissions).
129186

187+
### `scope commands` and `help commands`
188+
189+
With [#13598](https://github.com/nushell/nushell/pull/13598), two output columns have been renamed for `scope commands` and `help commands`:
190+
191+
1. `usage` has been renamed to `description`
192+
2. `extra_usage` is now `extra_description`
193+
130194
## Deprecations [[toc](#table-of-content)]
131195

132196
## Removals [[toc](#table-of-content)]
@@ -135,6 +199,10 @@ After [#13763](https://github.com/nushell/nushell/pull/13763), if an I/O error o
135199

136200
In [#13693](https://github.com/nushell/nushell/pull/13693), the `str deunicode` command (added in v0.96.0) has been removed due to concerns with stability and support post v1.0.
137201

202+
### `$env.config.use_grid_icons`
203+
204+
After [#13788](https://github.com/nushell/nushell/pull/13788), the `use_grid_icons` config option has been removed. Instead, the `grid` command now has an `--icons` flag that has the same effect.
205+
138206
## Bug fixes and other changes [[toc](#table-of-content)]
139207

140208
### `find`
@@ -143,6 +211,14 @@ After [#13848](https://github.com/nushell/nushell/pull/13848), the find command
143211

144212
Also, regex patterns are now properly escaped after [#13792](https://github.com/nushell/nushell/pull/13792).
145213

214+
### Improved script help output
215+
216+
Thanks to [@gwenya](https://github.com/gwenya) in [#13445](https://github.com/nushell/nushell/pull/13445), the help output for scripts now uses the name of the script instead of `main`. The available subcommands are now also listed in the help output.
217+
218+
### Bit operations and commands
219+
220+
`bits ror` and `bits rol` had undefined behavior in some cases and could also panic in others. This has been fixed in [#13673](https://github.com/nushell/nushell/pull/13673). Similarly, bugs for `bits shl`, `bits shr`, `bit-shl`, and `bit-shr` were fixed in [#13663](https://github.com/nushell/nushell/pull/13663).
221+
146222
### `detect columns`
147223

148224
One source of panics was fixed in [#13752](https://github.com/nushell/nushell/pull/13752).
@@ -174,16 +250,6 @@ One source of panics was fixed in [#13752](https://github.com/nushell/nushell/pu
174250
```
175251
-->
176252

177-
# All breaking changes [[toc](#table-of-content)]
178-
179-
<!-- TODO:
180-
paste the output of
181-
```nu
182-
./make_release/release-note/list-merged-prs nushell/nushell --label pr:breaking-change --pretty --no-author
183-
```
184-
here
185-
-->
186-
187253
# Notes for plugin developers [[toc](#table-of-content)]
188254

189255
# Hall of fame [[toc](#table-of-content)]

0 commit comments

Comments
 (0)