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
Reject incombatible flag combinations in to nuon
#12595
base: main
Are you sure you want to change the base?
Conversation
Follow up to nushell#12591 Ensure an error is shown. `.expect` is fine here as the precondition of reaching each branch is explicitly that this flag has been found. Only extra care has to be taken when changing the flag name. But that is the general risk of this stringly typed API.
This was introduced as nushell#8366 introduced a logic to have a priority of those flags (and have the `--raw` flag purely to match the flags on `to json`)
Marking as draft for a second as with this mutual excusion scheme #8366 introduced it with the implicit precedence scheme for |
Whatever we do here probably needs to be done for In general, I think we should have a default (which I think is raw here maybe?), and then a way to override the default with the number of indents and then whether those indents are tabs or spaces. |
The difference for The one argument for keeping def my_func[--human-readable] {
ls | first 3 | to nuon --indent 4 --raw=(not $human_readable)
} At the same time for interactive use and general readability having these implicit overrides is less fortunate, if you don't start writing documentation sermons like in the description of #8366 |
Description
Follow up to #12591
Ensure an error is shown.
.expect
is fine here as the precondition of reaching each branch isexplicitly that this flag has been found. Only extra care has to be
taken when changing the flag name. But that is the general risk of this
stringly typed API.
User-Facing Changes
Ineffective combinations of flags will now return a
ShellError::IncompatibleParameters
instead of returning output for which the exact behavior was previously undefined.