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
Was using sade in a project where I wanted an option to be coerced to a string always, so I specified that a default value of "". However I noticed that when using the alias of the option, the value was not turned into a string (repo below). For me, the use case is for simple file matching, where some file names may begin with a number. So the option may be passed a value of "01" and I want that as a string, not the number 1.
I think lukeed/sade#17 is related to what I want here, but seeing as how that issue is old and closed without discussion I thought maybe opening a new issue focused around the use case would be helpful. Apologies if I thought wrong here 😬
Repo
test.js:
constsade=require("sade");// v1.7.3// Using `isOne` just to simplify this programconst{ args }=sade("test",true).option("-a --arg","Test option","").parse(process.argv,{lazy: true});console.log(args);
If you think this is something that should/can be fixed, happy to open a PR. My assumption is that we need to pass defaults for option names and aliases to mri?
Thanks!
P.S. Love all awesome libraries you build - thanks for giving these to us 😁
The text was updated successfully, but these errors were encountered:
Hey Luke 👋
Related: lukeed/sade#17
Was using
sade
in a project where I wanted an option to be coerced to astring
always, so I specified that a default value of""
. However I noticed that when using the alias of the option, the value was not turned into a string (repo below). For me, the use case is for simple file matching, where some file names may begin with a number. So the option may be passed a value of"01"
and I want that as a string, not the number1
.I think lukeed/sade#17 is related to what I want here, but seeing as how that issue is old and closed without discussion I thought maybe opening a new issue focused around the use case would be helpful. Apologies if I thought wrong here 😬
Repo
test.js:
Output with
--arg
:Output with
-a
alias:(expected to be the same as
--arg
output)$ node .\test.js -a 01 [ { _: [], a: 1, arg: 1 } ]
If you think this is something that should/can be fixed, happy to open a PR. My assumption is that we need to pass defaults for option names and aliases to
mri
?Thanks!
P.S. Love all awesome libraries you build - thanks for giving these to us 😁
The text was updated successfully, but these errors were encountered: