Add --env and --wrapped flags to def#10566
Merged
kubouch merged 7 commits intonushell:mainfrom Oct 2, 2023
Merged
Conversation
sophiajt
reviewed
Oct 1, 2023
Contributor
|
Looks good. Just had one question about you were handling errors for incomplete |
This was referenced Oct 14, 2023
WindSoilder
pushed a commit
that referenced
this pull request
Oct 19, 2023
follow-up to - #10566 # Description this PR deprecates the use of `extern-wrapped` and `export extern-wrapped` these two core commands will be removed in 0.88 # User-Facing Changes using `extern-wrapped` will give a warning ```nushell > extern-wrapped foo [...args] { print "foo" }; foo Error: × Deprecated command ╭─[entry #2:1:1] 1 │ extern-wrapped foo [...args] { print "foo" }; foo · ───────┬────── · ╰── `extern-wrapped` is deprecated and will be removed in 0.88. ╰──── help: Use `def --wrapped` instead foo ``` # Tests + Formatting # After Submitting
WindSoilder
pushed a commit
that referenced
this pull request
Oct 19, 2023
follow-up to - #10566 # Description this PR deprecates the use of `def-env` and `export def-env` these two core commands will be removed in 0.88 # User-Facing Changes using `def-env` will give a warning ```nushell > def-env foo [] { print "foo" }; foo Error: × Deprecated command ╭─[entry #1:1:1] 1 │ def-env foo [] { print "foo" }; foo · ───┬─── · ╰── `def-env` is deprecated and will be removed in 0.88. ╰──── help: Use `def --env` instead foo ``` # Tests + Formatting # After Submitting
gaetschwartz
pushed a commit
to gaetschwartz/nushell
that referenced
this pull request
Oct 20, 2023
follow-up to - nushell#10566 # Description this PR deprecates the use of `extern-wrapped` and `export extern-wrapped` these two core commands will be removed in 0.88 # User-Facing Changes using `extern-wrapped` will give a warning ```nushell > extern-wrapped foo [...args] { print "foo" }; foo Error: × Deprecated command ╭─[entry nushell#2:1:1] 1 │ extern-wrapped foo [...args] { print "foo" }; foo · ───────┬────── · ╰── `extern-wrapped` is deprecated and will be removed in 0.88. ╰──── help: Use `def --wrapped` instead foo ``` # Tests + Formatting # After Submitting
gaetschwartz
pushed a commit
to gaetschwartz/nushell
that referenced
this pull request
Oct 20, 2023
follow-up to - nushell#10566 # Description this PR deprecates the use of `def-env` and `export def-env` these two core commands will be removed in 0.88 # User-Facing Changes using `def-env` will give a warning ```nushell > def-env foo [] { print "foo" }; foo Error: × Deprecated command ╭─[entry nushell#1:1:1] 1 │ def-env foo [] { print "foo" }; foo · ───┬─── · ╰── `def-env` is deprecated and will be removed in 0.88. ╰──── help: Use `def --env` instead foo ``` # Tests + Formatting # After Submitting
hardfau1t
pushed a commit
to hardfau1t/nushell
that referenced
this pull request
Dec 14, 2023
hardfau1t
pushed a commit
to hardfau1t/nushell
that referenced
this pull request
Dec 14, 2023
follow-up to - nushell#10566 # Description this PR deprecates the use of `extern-wrapped` and `export extern-wrapped` these two core commands will be removed in 0.88 # User-Facing Changes using `extern-wrapped` will give a warning ```nushell > extern-wrapped foo [...args] { print "foo" }; foo Error: × Deprecated command ╭─[entry nushell#2:1:1] 1 │ extern-wrapped foo [...args] { print "foo" }; foo · ───────┬────── · ╰── `extern-wrapped` is deprecated and will be removed in 0.88. ╰──── help: Use `def --wrapped` instead foo ``` # Tests + Formatting # After Submitting
hardfau1t
pushed a commit
to hardfau1t/nushell
that referenced
this pull request
Dec 14, 2023
follow-up to - nushell#10566 # Description this PR deprecates the use of `def-env` and `export def-env` these two core commands will be removed in 0.88 # User-Facing Changes using `def-env` will give a warning ```nushell > def-env foo [] { print "foo" }; foo Error: × Deprecated command ╭─[entry #1:1:1] 1 │ def-env foo [] { print "foo" }; foo · ───┬─── · ╰── `def-env` is deprecated and will be removed in 0.88. ╰──── help: Use `def --env` instead foo ``` # Tests + Formatting # After Submitting
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR adds
--envand--wrappedflags todefto be used instead ofdef-envandextern-wrapped. This allowsdef --env --wrappedto be used together, which was not possible before. In addition, it reduces the number of keywords we have and avoids the confusion ofextern-wrappedbeing, in fact, a normal command, not a known external.Deprecation strategy
Because
def-envis used everywhere, including virtualenv, I propose the following steps:def-envandextern-wrappedunchanged.def-envandextern-wrappedbut keep them working.def-envandextern-wrapped.Possible caveat
There is a silent failure if you put the flag between the signature and the block, e.g.,
def spam [] --env {}. I suspect it's because of some signature parsing weirdness. Because signatures are not first-class values, I noticed some weird behavior when I tried to parse them in value situations, such aslet x: signature = .... Not 100% but it might be related. Given the new parser is underway, I didn't investigate further, as this code will be replaced anyway.Doing
def spam [] {} --envfails with a missing positional error which is also quite unhelpful, but at least it failsUser-Facing Changes
Apart from the added flags, no changes. There should be no breakages (yet...).
Tests + Formatting
After Submitting