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: default help behaves properly #678

Merged
merged 9 commits into from
Apr 10, 2023
Merged

fix: default help behaves properly #678

merged 9 commits into from
Apr 10, 2023

Conversation

peternhale
Copy link
Contributor

@W-12513575@

@peternhale peternhale requested a review from cristiand391 March 29, 2023 20:07
flags[k] = defaultValue
}
}

for (const k of Object.keys(this.input.flags)) {
if ((k in flags) && Reflect.has(this.input.flags[k], 'defaultHelp')) {
Copy link
Member

Choose a reason for hiding this comment

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

could this be done in the previous for loop? both iterate over the keys of this.input.flags
https://github.com/oclif/core/blob/main/src/parser/parse.ts#L268-L290

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@cristiand391 When defaultHelp is called it is passed all resolved flag values (flags), which can only be done after all previous loops are finished.

@peternhale peternhale requested a review from cristiand391 April 5, 2023 14:10
peternhale added a commit that referenced this pull request Apr 10, 2023
* fix: defaultHelp not called with flag value at runtime

@W-12513575@

* chore(release): 2.8.1-beta.1 [skip ci]

* chore: move defaultHelp capture to after all flags have been parsed

* chore: force build

* fix: force build

* chore(release): 2.8.1-beta.4 [skip ci]

* fix: default help behaves properly

@W-12513575@

---------

Co-authored-by: svc-cli-bot <[email protected]>
@peternhale peternhale merged commit 8562e13 into main Apr 10, 2023
@peternhale peternhale deleted the phale/fix-default-help branch April 10, 2023 18:03
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