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
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
+
fnversion(&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
+
67
126
# Changes to commands [[toc](#table-of-content)]
68
127
69
128
## Additions [[toc](#table-of-content)]
70
129
71
130
## Breaking changes [[toc](#table-of-content)]
72
131
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
+
73
147
## Deprecations [[toc](#table-of-content)]
74
148
75
149
## 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
114
188
here
115
189
-->
116
190
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
+
fnversion(&self) ->String {
198
+
env!("CARGO_PKG_VERSION").into()
199
+
}
200
+
```
201
+
-Anewderivemacrohasbeenadded ([#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
+
-Thepluginprotocolhasanewrequiredcall, [`Metadata`](/contributor-book/plugin_protocol_reference.md#metadata-plugin-call), whichiscurrentlyusedtoreportversioninformationonregistration, butmaybeusedforotherpluginmetadatainthefuture.Theintentionisthatallfieldsareoptional, and `version` iscurrentlyoptional.ThismeansthatalthoughtheRustAPIrequiresaversiontobereported, itisperfectlyallowed (butnotrecommended) foraplugintonotreportaversion.
118
206
119
207
# Halloffame [[toc](#table-of-content)]
120
208
@@ -131,4 +219,4 @@ Thanks to all the contributors below for helping us solve issues and improve doc
0 commit comments