Closed
Conversation
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.
Update: Ideally, this PR should be superseded by #1938 and #1940. See comment for details.
Partially fixes #1916. I think it is a good idea to react to wrong library uses even if they have not been featured in many issues.
Why
console.warn()and not throw from withinparse()/parseAsync()?Errors thrown from
parse()/parseAsync()are expected to have originated in user-supplied code (argParsers, hooks, actions).An alternative could be to
console.error()andprocess.exit()with a non-zero exit code, effectively forbidding all wrong usage, but what I don't like is the discrepancy between this approach and how all other library errors are simply thrown and can be handled by the user.ChangeLog
Added
.parse()Peer PRs
Warnings need to be consistent with…
chainArgParserCalls()for configuration. Additionally await thenable implicit and default option values and thenable default argument values #1915.command()#1938.parse()#1940Parse call subroutine (
_parseSubroutine()) needs to be consistent with…parse()/parseAsync()#1919Incompatible with…
.suppressWarnings()for warnings in #1915 #1931 #1938 #1940 #1955: parse methods shall never be called on subcommands, so if warnings about such calls are added, the JSDoc and the ChangeLog entry for.suppressWarnings()introduced there become incorrect. The fact there is currently no well-defined meaning for such calls is one of the reasons why #1938 and #1940 should be preferred over this PR (#1917)!