Skip to content

Commit c08daa6

Browse files
authored
Release notes for 0.95.0 for changes I'm aware of (#1454)
1 parent 76afe75 commit c08daa6

File tree

1 file changed

+91
-3
lines changed

1 file changed

+91
-3
lines changed

blog/2024-06-25-nushell_0_95_0.md

Lines changed: 91 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,20 @@ As part of this release, we also publish a set of optional plugins you can insta
2222

2323
# Table of content
2424
- [_Highlights and themes of this release_](#highlights-and-themes-of-this-release-toc)
25+
- [_External command parsing improvements_](#external-command-parsing-improvements-toc)
26+
- [_Plugin version reporting_](#plugin-version-reporting-toc)
2527
- [_Changes to commands_](#changes-to-commands-toc)
2628
- [_Additions_](#additions-toc)
2729
- [_Breaking changes_](#breaking-changes-toc)
30+
- [_`run-external`_](#run-external-toc)
2831
- [_Deprecations_](#deprecations-toc)
2932
- [_Removals_](#removals-toc)
3033
- [_Other changes_](#other-changes-toc)
3134
- [_Bug fixes_](#bug-fixes-toc)
3235
- [_All breaking changes_](#all-breaking-changes-toc)
33-
- [_Notes for plugin developers_](#notes-for-plugin-developers)
36+
- [_Notes for plugin developers_](#notes-for-plugin-developers-toc)
37+
- [_API_](#api-toc)
38+
- [_Protocol_](#protocol-toc)
3439
- [_Hall of fame_](#hall-of-fame-toc)
3540
- [_Full changelog_](#full-changelog-toc)
3641
<!-- TODO: please add links to the other sections here
@@ -64,12 +69,81 @@ As part of this release, we also publish a set of optional plugins you can insta
6469
for the list of available *containers*
6570
-->
6671

72+
## External command parsing improvements [[toc](#table-of-content)]
73+
74+
::: warning Breaking change
75+
See a full overview of the [breaking changes](#breaking-changes)
76+
:::
77+
78+
A lot of the quirks of external command parsing have been cleaned up in [#13089](https://github.com/nushell/nushell/pull/13089), with most of the actual string handling work being moved into `nu-parser` itself. Previously, the parser was doing some very special things to create expressions in a way that `run-external` would then finish parsing in order to handle quotes in external options, globs, tilde expansion, etc., but this was error prone and did not have great test coverage.
79+
80+
Resolving this made it easier to find some of the edge cases that were not being handled, as well as making some syntax behave in a way that feels more consistent with the rest of Nushell:
81+
82+
- Bare word interpolation works for external command options, and otherwise embedded in other strings:
83+
```nushell
84+
^echo --foo=(2 + 2) # prints --foo=4
85+
^echo -foo=$"(2 + 2)" # prints -foo=4
86+
^echo foo="(2 + 2)" # prints (no interpolation!) foo=(2 + 2)
87+
^echo foo,(2 + 2),bar # prints foo,4,bar
88+
```
89+
90+
- Bare word interpolation expands for external command head/args:
91+
```nushell
92+
let name = "exa"
93+
~/.cargo/bin/($name) # this works, and expands the tilde
94+
^$"~/.cargo/bin/($name)" # this doesn't expand the tilde
95+
^echo ~/($name)/* # this glob is expanded
96+
^echo $"~/($name)/*" # this isn't expanded
97+
```
98+
99+
- Ndots are now supported for the head/args of an external command (`^.../foo` works, expanding to `^../../foo`)
100+
- Because our ndots handling requires path normalization, it is disabled for bare arguments that don't contain at least three consecutive dots, and for arguments that contain the string `://` as that is likely to be a URL.
101+
102+
- Glob values are now supported for head/args of an external command, and expanded appropriately:
103+
```nushell
104+
^("~/.cargo/bin/exa" | into glob) # the tilde is expanded
105+
^echo ("*.txt" | into glob) # this glob is expanded
106+
```
107+
108+
## Plugin version reporting [[toc](#table-of-content)]
109+
110+
::: warning Breaking change
111+
See a full overview of the [breaking changes](#breaking-changes)
112+
:::
113+
114+
Plugins can now report their own version to Nushell, and have it displayed in `plugin list` and `version`. This can help users understand exactly which plugin version they have active in their shell.
115+
116+
This is a breaking change for the Rust API, as implementing it on the `Plugin` trait is now required. We recommend the following implementation, which will take the plugin version directly from the cargo package metadata:
117+
118+
```rust
119+
fn version(&self) -> String {
120+
env!("CARGO_PKG_VERSION").into()
121+
}
122+
```
123+
124+
If not using the Rust plugin API, you need to implement the new [`Metadata`](/contributor-book/plugin_protocol_reference.md#metadata-plugin-call) call. Providing a version is optional, but highly recommended.
125+
67126
# Changes to commands [[toc](#table-of-content)]
68127

69128
## Additions [[toc](#table-of-content)]
70129

71130
## Breaking changes [[toc](#table-of-content)]
72131

132+
### `run-external` [[toc](#table-of-content)]
133+
134+
`run-external` now works more like any other command, without expecting a special call convention for its args:
135+
136+
```nushell
137+
> run-external echo "'foo'"
138+
# 0.94: 'foo'
139+
# 0.95: foo
140+
> run-external echo "*.txt"
141+
# 0.94: (glob is expanded)
142+
# 0.95: *.txt
143+
```
144+
145+
This argument handling is now implemented in the parser instead. [See the previous section](#external-command-parsing-improvements-toc) for more information on these changes.
146+
73147
## Deprecations [[toc](#table-of-content)]
74148

75149
## Removals [[toc](#table-of-content)]
@@ -114,7 +188,21 @@ As part of this release, we also publish a set of optional plugins you can insta
114188
here
115189
-->
116190

117-
## Notes for plugin developers
191+
## Notes for plugin developers [[toc](#table-of-content)]
192+
193+
### API [[toc](#table-of-content)]
194+
195+
- The `Plugin` trait now has a required method `fn version(&self) -> String`. The following implementation should suffice in most cases:
196+
```rust
197+
fn version(&self) -> String {
198+
env!("CARGO_PKG_VERSION").into()
199+
}
200+
```
201+
- A new derive macro has been added ([#13031](https://github.com/nushell/nushell/pull/13031)) for `FromValue` and `IntoValue` conversion traits to make serialization to and from Nushell values easier. The API design is similar to `serde-derive`. We expect this to make certain kinds of plugins much easier to develop! Many thanks to [@cptpiepmatz](https://github.com/cptpiepmatz).
202+
203+
### Protocol [[toc](#table-of-content)]
204+
205+
- The plugin protocol has a new required call, [`Metadata`](/contributor-book/plugin_protocol_reference.md#metadata-plugin-call), which is currently used to report version information on registration, but may be used for other plugin metadata in the future. The intention is that all fields are optional, and `version` is currently optional. This means that although the Rust API requires a version to be reported, it is perfectly allowed (but not recommended) for a plugin to not report a version.
118206

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

@@ -131,4 +219,4 @@ Thanks to all the contributors below for helping us solve issues and improve doc
131219
./make_release/release-note/get-full-changelog
132220
```
133221
here
134-
-->
222+
-->

0 commit comments

Comments
 (0)