-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
gatsby-cli error semantics Did you mean <command>?
doesn't correctly convey command options given
#12078
Comments
Did you mean <command>?
doesn't correctly convey command options givenDid you mean <command>?
doesn't correctly convey command options given
I think that's a good idea (pinging @gatsbyjs/docs just to make sure). Do you want to make a PR to add this feature? Thanks a lot! |
some extra info: we use yargs as a cli parser. Code can be found https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby-cli/src/create-cli.js. Yargs as an option to add completion text to the cli. Currently I don't think we use it. reference: http://yargs.js.org/docs/#api-completioncmd-description-fn |
@freiksenet @wardpeet Just made a PR to the gatsby-cli codebase. My aim here to improve the DX for y'all. QuestionsDo I need to submit a feature request first? |
Awesome 👍 You can just create a PR. We don't really have separate responsible people per packages, everyone in Gatsby team is responsible :) |
* chore(gatsby-cli): Add meant dependency (#12078) Who uses `meant`: This package is used by NPM. Implementation: Used to mimic the same UX of giving command suggestions, upon failure to provide correct command Additional Reasons to use package: - Zero Dependencies attached - Only 30 lines of POJO - very lightweight - Very few issues with current versions Please checkout: https://www.npmjs.com/package/meant * feat: implemention of did you mean suggestion (#12078) This code has been duplicated from NPM 6.8.0 with minor tweaks. Tweaks: - Style changes of using string template literals over single quotes - newlines - \n added to the end to line 10 and line 13, to make the code more developer friendly * Modify gatsby-cli include command suggestion (#12078) Line 328 - alter demandCommand - message string `Pass --help ...` will not show, because cli.fail method (330 line) is utilise. Thus message string has been moved to function 285. Another reason it has been moved there is organise al suggestions into one place Line 318 - showHelpOnFail could not get access to `yargs` thus cli.fail function was used instead Line 319 - `recommendCommands`, did not recommend commands were not very accurate, thus cli.fail was used configured more specific commands and show multiple command suggestions * fix(gatsby-cli): demandCommand was changed back to original (#12078)
This issue has now been resolved. It is now part of gatsby-cli@2.4.14 |
Description
When
gatsby y develop
has been typed. The resulting stdout suggestsDid you mean new ?
, more preciselynew
being very different fromdevelop
. Doesn't accurately depict the command typed inSteps to reproduce
Demo Project - not required
Start up a new project gatsby and type in
gatsby y develop
Expected result
Did you mean develop?
Actual result
Did you mean new?
Solution Suggestions
Include the following criteria
Environment
File contents (if changed)
gatsby-config.js
: N/Apackage.json
: N/Agatsby-node.js
: N/Agatsby-browser.js
: N/Agatsby-ssr.js
: N/AThe text was updated successfully, but these errors were encountered: