Closed riacataquian closed 2 years ago
Rather than keeping two booleans for "supported" and "allow override", how about:
default bool // default of "off" or "on" like Bash
supported bool // whether we support the option's non-default state
I think that's a bit easier to understand, and it should be enough information to print what we need:
1) If an option is supported, we simply print the name and its default, like globstar off
.
2) If an option is not supported and its default is off
, we print globstar off ("on" not supported)
.
3) If an option is not supported and its default is on
, we print globstar on ("off" not supported)
.
This output is also clearer to the end user, I think.
I also think we need to record the default values anyway, as I'm fairly sure there are a good number of Bash options that default to "on".
That sounds better, thanks! :)
Also, I agree on:
I also think we need to record the default values anyway, as I'm fairly sure there are a good number of Bash options that default to "on".
I briefly mentioned it here https://github.com/mvdan/sh/pull/883#discussion_r901299481, will also include in this PR.
@mvdan could you take a look please? I incorporated the feedbacks above. Thanks!
Trying to set an unsupported but valid Bash option leads to a potentially confusing error message:
Fix that by handling the unsupported options differently from the invalid ones:
Additionally, this commit lists all of the Bash options when
shopt
without arguments is called and explicitly identify the unsupported options, for example:While at it, rewrite the
bashOptsTable
so that it can keep two option states: 1) Bash's default options and 2) whether we support itFixes #877