-
Notifications
You must be signed in to change notification settings - Fork 63
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
blueprint options #106
Comments
I think this sounds useful, it solves several problems at the same time, expands capabilities pretty easibly. There are some things to consider.
|
Thanks for the feedback @anithri.
Agreed. Plan is to use yargs commandDir to specify the main commands, so easy to add to without having to modify the main/root entry point. Also only needs a single entry point in bin. Supports multiple aliases for commands, e.g. generate | gen | g. Similarly, can alias the names of blueprints, e.g. redux-connected | container | smart.
yargs also supports env vars. I haven't looked at rc but we could use either/both.
Using Blueprint.list() (or a derivative) when building out the command line means we only need to solve these in one place.
yargs helps us here too with the config option. Perhaps even the extend variation. I'm also wondering if we could store the values configured in blueprintrc directly in the Blueprint when it's loaded so they can be made available to the CLI builder when defining the options. I.e. the CLI help for a blueprint could show the default/configured values for options.
#107 List and #108 Copy commands will be easy to add to this setup. I'm thinking about adding the list command along with this change by reusing the help output currently tied to |
I'll put together an initial PR for further discussion. |
Thanks for the great work @jamesr73 |
Since revisiting PR #79 a few days ago I've been thinking some more about the CLI and how I may be able to help move it towards the 2.0 release.
There are several issues that relate to options specific to one/some blueprints: #5, #25, #72, #88 and #101. There are also a couple relating to how commands are parsed: #10 and #96.
Whilst passing additional options to blueprints is supported at the moment they are hidden from the user unless they review the blueprint source. I've been thinking about a more formal mechanism for blueprints to define the options that they support such that the help command could document them. Making it clearer what could be passed on the command line and/or added to (the extended) .reduxrc. E.g.
I've done a little investigation and I think this can be achieved quite easily by switching out commander for yargs and then building sub-sub-commands from the available blueprints automatically, allowing them to specify options (in yargs format) if necessary. Existing blueprints and/or those that don't need to define options would continue to work as they are with the CLI creating default commands for them (using the existing description()). The blueprint would not need to define the action that yargs performs, this would be setup to run the blueprint automatically by the CLI.
Using yargs also makes it trivial to take care of #10 and #96.
If this sounds useful I'm happy to work on a PR.
The text was updated successfully, but these errors were encountered: