Skip to content
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

fix: preserve failMessage from showHelpOnFail #2087

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 2 additions & 5 deletions lib/usage.ts
Expand Up @@ -26,10 +26,8 @@ export function usage(yargs: YargsInstance, shim: PlatformShim) {
arg1: boolean | string = true,
arg2?: string
) {
function parseFunctionArgs(): [boolean, string?] {
return typeof arg1 === 'string' ? [true, arg1] : [arg1, arg2];
}
const [enabled, message] = parseFunctionArgs();
const [enabled, message] =
typeof arg1 === 'string' ? [true, arg1] : [arg1, arg2];
failMessage = message;
showHelpOnFail = enabled;
return self;
Expand Down Expand Up @@ -683,7 +681,6 @@ export function usage(yargs: YargsInstance, shim: PlatformShim) {
self.reset = function reset(localLookup) {
// do not reset wrap here
// do not reset fails here
failMessage = null;
failureOutput = false;
usages = [];
usageDisabled = false;
Expand Down