Repository navigation
Parser: Schematics options camelCase coercion #13544
Description
🚀 Feature request
Command (mark with an x)
- [ ] new
- [ ] build
- [ ] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc
- [x] schematics
Description
When passing arguments to schematics as options, I would like to be able to pass a dash-case option (i.e. ---dry-run) and get the camelCase equivalent (i.e. dryRun) in the options passed to my schematic.
Currently, if I pass the option option-one as a dash-case argument...
schematics my-collection:my-schematic --option-one=testThe factory function will receive the following options object...
{
"option-one": "test"
}Furthermore, if I were to pass both the dash-case and camelCase equivalent of the same argument like so...
schematics my-collection:my-schematic --option-one=test1 --optionOne=test2The factory function will receive the following options object...
{
"option-one": "test1",
"optionOne": "test2"
}This is not only very confusing but also inconsistent with the base schematics options such as --dry-run. Meaning that the following two commands are analogous...
schematics my-collection:my-schematic --dry-run=true
schematics my-collection:my-schematic --dryRun=trueThereby treating dry-run as dryRun. I don't see a great use case for allowing two arguments of different cases to coexist.
Describe the solution you'd like
Option 1
Coerce all options argument to camelCase.
Option 2
Smart case corecursion of all options argument based on options schema.
Describe alternatives you've considered
Checking for both dash-case and camelCase options and resolving each option manually based on expected options schema.
Activity
[-]Schematics options camelCase coercion[/-][+]Parser: Schematics options camelCase coercion[/+]angular-robot commentedon Feb 1, 2022
Just a heads up that we kicked off a community voting process for your feature request. There are 20 days until the voting process ends.
Find more details about Angular's feature request process in our documentation.
angular-robot commentedon Feb 21, 2022
Thank you for submitting your feature request! Looks like during the polling process it didn't collect a sufficient number of votes to move to the next stage.
We want to keep Angular rich and ergonomic and at the same time be mindful about its scope and learning journey. If you think your request could live outside Angular's scope, we'd encourage you to collaborate with the community on publishing it as an open source package.
You can find more details about the feature request process in our documentation.
refactor(@angular-devkit/schematics-cli): replace parser with yargs-p…
angular-automatic-lock-bot commentedon Apr 2, 2022
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.