Skip to content

feat: specify flag name in parse error message#589

Merged
mdonnalley merged 2 commits intooclif:mdonnalley/589from
MichaelGoberling:specify-flag-name-parse-error
Jan 23, 2023
Merged

feat: specify flag name in parse error message#589
mdonnalley merged 2 commits intooclif:mdonnalley/589from
MichaelGoberling:specify-flag-name-parse-error

Conversation

@MichaelGoberling
Copy link
Copy Markdown
Contributor

@MichaelGoberling MichaelGoberling commented Jan 13, 2023

We have use cases where we want to use the min and max values for an integer flag (See PR here)

It would be nice if the parsing error message included the flag it pertained to

Before

➜  the-worst-folder git:(main) wow create character --strength=51 --intellect=51 --agility=2
    Error: Expected an integer less than or equal to 50 but received: 51

After

➜  the-best-folder git:(main) wow create character --strength=51 --intellect=51 --agility=2
    Error: Parsing --intellect 
        Expected an integer less than or equal to 50 but received: 51
    See more help with --help

Comment thread src/parser/parse.ts Outdated
Comment thread src/parser/parse.ts Outdated
@mdonnalley
Copy link
Copy Markdown
Contributor

@MichaelGoberling Thanks for the contribution - love the idea! I just made a couple of suggestions to clean up the implementation

@mdonnalley mdonnalley changed the base branch from main to mdonnalley/589 January 23, 2023 16:09
@mdonnalley mdonnalley merged commit e945b51 into oclif:mdonnalley/589 Jan 23, 2023
mdonnalley added a commit that referenced this pull request Jan 23, 2023
* feat: specify flag name in parse errors

* fix: impl. for specifying flag name in parse errors

Co-authored-by: Michael Goberling <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants