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
import*ascliffyfrom'jsr:@cliffy/[email protected]'constcli=newcliffy.Command().name('test').option('--files <...files:string>','A list of files to watch').option('--foobar','A foobar').action(opts=>{console.log({opts})})cli.parse()
when called like so: deno run --check test.ts --files foo,bar --foobar produces the following output
{ opts: { files: [ "foo,bar", "--foobar" ] } }
This means that users of a cli tool need to know which args are variadic and remember to put them last. I also imagine this means theres no way to specify more than one option that accepts variadic arguments. One possible way to handle these cases would be if I could specify a delimeter for variadic args. E.g. a comma (you can see in the example above that comma separated values are currently read as a single value. To avoid making it break existing clis, this could be an optional arg on the option method.
Also, while testing this I realized that the same command with an = character hits an infinite recursion loop: deno run --check test.ts --files=foo,bar
error: Uncaught (in promise) RangeError: Maximum call stack size exceeded
function parseValue(
^
at parseValue (https://jsr.io/@cliffy/flags/1.0.0-rc.4/flags.ts:411:16)
at parseNext (https://jsr.io/@cliffy/flags/1.0.0-rc.4/flags.ts:347:20)
at parseNext (https://jsr.io/@cliffy/flags/1.0.0-rc.4/flags.ts:373:11)
at parseNext (https://jsr.io/@cliffy/flags/1.0.0-rc.4/flags.ts:373:11)
at parseNext (https://jsr.io/@cliffy/flags/1.0.0-rc.4/flags.ts:373:11)
at parseNext (https://jsr.io/@cliffy/flags/1.0.0-rc.4/flags.ts:373:11)
at parseNext (https://jsr.io/@cliffy/flags/1.0.0-rc.4/flags.ts:373:11)
at parseNext (https://jsr.io/@cliffy/flags/1.0.0-rc.4/flags.ts:373:11)
at parseNext (https://jsr.io/@cliffy/flags/1.0.0-rc.4/flags.ts:373:11)
at parseNext (https://jsr.io/@cliffy/flags/1.0.0-rc.4/flags.ts:373:11)
The text was updated successfully, but these errors were encountered:
a sample script like this:
when called like so:
deno run --check test.ts --files foo,bar --foobar
produces the following outputThis means that users of a cli tool need to know which args are variadic and remember to put them last. I also imagine this means theres no way to specify more than one option that accepts variadic arguments. One possible way to handle these cases would be if I could specify a delimeter for variadic args. E.g. a comma (you can see in the example above that comma separated values are currently read as a single value. To avoid making it break existing clis, this could be an optional arg on the
option
method.Also, while testing this I realized that the same command with an
=
character hits an infinite recursion loop:deno run --check test.ts --files=foo,bar
The text was updated successfully, but these errors were encountered: