You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This difference between commander and yargs and sywac is actually the difference I noticed most when converting some prior CLIs - I had some programs with many (100?) flags, and ended up writing wrappers to convert parameter names instead of renaming them.
What do you think about supporting this use case? I could see three viable paths:
Breaking change: start converting all kebab to camel. Breaks existing programs (potentially).
Add a boolean option defaulting to false for auto converting. Suffers a little from "yet another option", but gives the same behavior for essentially free.
Support more generically - some kind of "flag conversion" or "flag formatting" option. Or maybe even takes a full argv and allows you to define a key converter? This maybe suffers from "yet another option" AND "how the hell does it work".
Interested in your thoughts and how hot/cold you'd be for support for this feature.
The text was updated successfully, but these errors were encountered:
I'm honestly not a big fan of doing these types of conversions in sywac, but I'm not opposed to the 2nd option if it will make the migration from commander/yargs to sywac easier for folks.
If the command line flag is --reset-all, but the developer would prefer to write resetAll, maybe we should be suggesting:
sywac.boolean('--reset-all',{desc: 'Reset them all',aliases: 'resetAll'})
This gives you exactly what you had with yargs, with the downside that you need to specify it on every line (a bummer if there are many options). It also lets the user actually use that alias which I guess in very rare cases might not be desirable.
(I'm waffling because I think your inclination not to follow the path of yargs, where the options just grew and grew and grew and included complex boolean statements about what params are required when etc., isn't the right path for sywac.)
Another option:
sywac.boolean('--reset-all',{desc: 'Reset them all'}).check(argv=>{Object.keys(argv).forEach(key=>{argv[key.replace(/-./g,str=>str[1].toUpperCase())]=argv[key]})})
Maybe the "problem" could be solved just by suggesting this snippet in some kind of "converting to sywac" guide in the website?
This difference between commander and yargs and sywac is actually the difference I noticed most when converting some prior CLIs - I had some programs with many (100?) flags, and ended up writing wrappers to convert parameter names instead of renaming them.
What do you think about supporting this use case? I could see three viable paths:
Breaking change: start converting all kebab to camel. Breaks existing programs (potentially).
Add a boolean option defaulting to false for auto converting. Suffers a little from "yet another option", but gives the same behavior for essentially free.
Support more generically - some kind of "flag conversion" or "flag formatting" option. Or maybe even takes a full argv and allows you to define a key converter? This maybe suffers from "yet another option" AND "how the hell does it work".
Interested in your thoughts and how hot/cold you'd be for support for this feature.
The text was updated successfully, but these errors were encountered: