New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
enable to pass switch values dynamically #11057
Merged
Merged
Conversation
This file contains 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
sholderbach
added
semantics
Places where we should define/clarify nushell's semantics
syntax
Changes to the grammar or syntax beyond parser bugfixes
labels
Nov 15, 2023
After discussing, I think we can merge and try it first |
This was referenced Nov 23, 2023
amtoine
added a commit
to amtoine/nu-git-manager
that referenced
this pull request
Nov 24, 2023
related to - nushell/nushell#11057 ## description this PR simplifies the switch forwarding in `gm gh query-user` and `gm gh query-releases` to `gm gh query-api` with the following syntax from nushell/nushell#11057 ```nushell foo --bar=$bar ```
amtoine
added a commit
to amtoine/nu-git-manager
that referenced
this pull request
Dec 13, 2023
related to - nushell/nushell#11057 ## description this PR simplifies the switch forwarding in `gm gh query-user` and `gm gh query-releases` to `gm gh query-api` with the following syntax from nushell/nushell#11057 ```nushell foo --bar=$bar ```
hardfau1t
pushed a commit
to hardfau1t/nushell
that referenced
this pull request
Dec 14, 2023
# Description Closes: nushell#7260 About the change: When we make an internalcall, and meet a `switch` (Flag.arg is None), nushell will try to see if the switch is called like `--xyz=false` , if that is true, `parse_long_flag` will return relative value. # User-Facing Changes So after the pr, the following would be possible: ```nushell def build-imp [--push, --release] { echo $"Doing a build with push: ($push) and release: ($release)" } def build [--push, --release] { build-imp --push=$push --release=$release } build --push --release=false build --push=false --release=true build --push=false --release=false build --push --release build ``` # Tests + Formatting Done # After Submitting Needs to submit a doc update, mentioned about the difference between `def a [--x] {}` and `def a [--x: bool] {}`
2 tasks
amtoine
added a commit
that referenced
this pull request
Dec 21, 2023
# Description While #11057 is merged, it's hard to tell the difference between `--flag: bool` and `--flag`, and it makes user hard to read custom commands' signature, and hard to use them correctly. After discussion, I think we can deprecate `--flag: bool` usage, and encourage using `--flag` instead. # User-Facing Changes The following code will raise warning message, but don't stop from running. ```nushell ❯ def florb [--dry-run: bool, --another-flag] { "aaa" }; florb Error: × Deprecated: --flag: bool ╭─[entry #7:1:1] 1 │ def florb [--dry-run: bool, --another-flag] { "aaa" }; florb · ──┬─ · ╰── `--flag: bool` is deprecated. Please use `--flag` instead, more info: https://www.nushell.sh/book/custom_commands.html ╰──── aaa ``` cc @kubouch # Tests + Formatting Done # After Submitting - [ ] Add more information under https://www.nushell.sh/book/custom_commands.html to indicate `--dry-run: bool` is not allowed, - [ ] remove `: bool` from custom commands between 0.89 and 0.90 --------- Co-authored-by: Antoine Stevan <44101798+amtoine@users.noreply.github.com>
dmatos2012
pushed a commit
to dmatos2012/nushell
that referenced
this pull request
Feb 20, 2024
# Description Closes: nushell#7260 About the change: When we make an internalcall, and meet a `switch` (Flag.arg is None), nushell will try to see if the switch is called like `--xyz=false` , if that is true, `parse_long_flag` will return relative value. # User-Facing Changes So after the pr, the following would be possible: ```nushell def build-imp [--push, --release] { echo $"Doing a build with push: ($push) and release: ($release)" } def build [--push, --release] { build-imp --push=$push --release=$release } build --push --release=false build --push=false --release=true build --push=false --release=false build --push --release build ``` # Tests + Formatting Done # After Submitting Needs to submit a doc update, mentioned about the difference between `def a [--x] {}` and `def a [--x: bool] {}`
dmatos2012
pushed a commit
to dmatos2012/nushell
that referenced
this pull request
Feb 20, 2024
# Description While nushell#11057 is merged, it's hard to tell the difference between `--flag: bool` and `--flag`, and it makes user hard to read custom commands' signature, and hard to use them correctly. After discussion, I think we can deprecate `--flag: bool` usage, and encourage using `--flag` instead. # User-Facing Changes The following code will raise warning message, but don't stop from running. ```nushell ❯ def florb [--dry-run: bool, --another-flag] { "aaa" }; florb Error: × Deprecated: --flag: bool ╭─[entry nushell#7:1:1] 1 │ def florb [--dry-run: bool, --another-flag] { "aaa" }; florb · ──┬─ · ╰── `--flag: bool` is deprecated. Please use `--flag` instead, more info: https://www.nushell.sh/book/custom_commands.html ╰──── aaa ``` cc @kubouch # Tests + Formatting Done # After Submitting - [ ] Add more information under https://www.nushell.sh/book/custom_commands.html to indicate `--dry-run: bool` is not allowed, - [ ] remove `: bool` from custom commands between 0.89 and 0.90 --------- Co-authored-by: Antoine Stevan <44101798+amtoine@users.noreply.github.com>
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
Closes: #7260
About the change:
When we make an internalcall, and meet a
switch
(Flag.arg is None), nushell will try to see if the switch is called like--xyz=false
, if that is true,parse_long_flag
will return relative value.User-Facing Changes
So after the pr, the following would be possible:
Tests + Formatting
Done
After Submitting
Needs to submit a doc update, mentioned about the difference between
def a [--x] {}
anddef a [--x: bool] {}