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

[PR with tiny fixes] Fix help command for subcommands with an executable handler and only a short help flag. Do not use undefined long help option flag in legacy code. Change initial variable values in test for better error messages. #1930

Merged
merged 5 commits into from
Aug 19, 2023

Conversation

aweebit
Copy link
Contributor

@aweebit aweebit commented Aug 3, 2023

Tiny fixes that don't really belong anywhere else.

ChangeLog

Changed

  • do not call preSubcommand hooks when displaying help for a subcommand with an executable handler
    • (technically breaking, but hey, are we really going to assume someone relied on this?)
  • deviating help flags specified for a subcommand with an executable handler via .helpOption() are now respected by the parent's help command (passed to the subcommand instead of the parent's help flag)

Fixed

  • .version() optional parameter type
  • subcommands with an executable handler and only a short help flag are now handled correctly by the parent's help command
  • stopped using undefined long help option flag in legacy code

Borrowed from a3f0e28 that was supposed to land in the now-closed tj#1921.
@aweebit aweebit changed the title Fix version() parameter type and change initial variable values in test for better error messages (PR with tiny fixes) Fix version() parameter type. Do not use undefined long help option flag in legacy code. Change initial variable values in test for better error messages. Aug 3, 2023
@aweebit aweebit changed the title (PR with tiny fixes) Fix version() parameter type. Do not use undefined long help option flag in legacy code. Change initial variable values in test for better error messages. [PR with tiny fixes] Fix version() parameter type. Do not use undefined long help option flag in legacy code. Change initial variable values in test for better error messages. Aug 3, 2023
@aweebit
Copy link
Contributor Author

aweebit commented Aug 12, 2023

The .version() type fix has to agree with whatever decision about the future of the call with no parameters is made in #1954.

Note for myself

One. Change. Per. PR. Always. (no matter how tiny it is)

lib/command.js Outdated Show resolved Hide resolved
lib/command.js Outdated Show resolved Hide resolved
typings/index.d.ts Outdated Show resolved Hide resolved
Copy link
Collaborator

@shadowspawn shadowspawn left a comment

Choose a reason for hiding this comment

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

Couple of good fixes for the reasonably recent possibility the help option might only have short flag.

Changes noted in separate comments.

lib/command.js Outdated Show resolved Hide resolved
@aweebit aweebit changed the title [PR with tiny fixes] Fix version() parameter type. Do not use undefined long help option flag in legacy code. Change initial variable values in test for better error messages. [PR with tiny fixes] Fix help command for subcommand with an executable handler. Do not use undefined long help option flag in legacy code. Change initial variable values in test for better error messages. Aug 13, 2023
@aweebit aweebit changed the title [PR with tiny fixes] Fix help command for subcommand with an executable handler. Do not use undefined long help option flag in legacy code. Change initial variable values in test for better error messages. [PR with tiny fixes] Fix help command for subcommands with an executable handler. Do not use undefined long help option flag in legacy code. Change initial variable values in test for better error messages. Aug 13, 2023
lib/command.js Outdated Show resolved Hide resolved
@shadowspawn shadowspawn added the pending release Merged into a branch for a future release, but not released yet label Aug 22, 2023
@shadowspawn shadowspawn removed the pending release Merged into a branch for a future release, but not released yet label Feb 3, 2024
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.

3 participants