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: move ctor for command help class to its own function #244

Merged
merged 3 commits into from Sep 14, 2021

Conversation

peternhale
Copy link
Contributor

@W-9708749@

src/main.ts Show resolved Hide resolved
src/main.ts Outdated Show resolved Hide resolved
src/main.ts Outdated Show resolved Hide resolved
src/help/index.ts Outdated Show resolved Hide resolved
@RodEsp
Copy link
Contributor

RodEsp commented Sep 13, 2021

@@ -90,6 +90,8 @@ export class Help extends HelpBase {
}

public async showHelp(argv: string[]) {
argv = argv.filter(arg => !getHelpFlagAdditions(this.config).includes(arg))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved the stripping of help flags to showHelp from main.ts.

Other function call via showHelp expect the help flags to be removed.

@@ -51,7 +51,6 @@ export async function run(argv = process.argv.slice(2), options?: Interfaces.Loa

// display help version if applicable
if (helpAddition(argv, config)) {
argv = argv.filter(arg => !getHelpFlagAdditions(config).includes(arg))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

main.ts should not have any knowledge of what showHelp expects in argv, just pass the whole thing as is.

Comment on lines -205 to +207
const help = new this.CommandHelpClass(command, this.config, this.opts)
const help = this.getCommandHelpClass(command)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really need a whole new method for this if this is the only place it's used?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@RodEsp This function will be overridden in the custom help class to allow the determination of short help.

@peternhale peternhale merged commit 26f2445 into main Sep 14, 2021
@peternhale peternhale deleted the phale/W-9708749 branch September 14, 2021 15:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants