-
-
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
Empty strings are parsed as arguments regardless of context #665
Comments
I investigated this issue a bit more and turns out cliffy is always parsing empty strings as arguments regardless of context. import { Command } from "jsr:@cliffy/command@^1.0.0-rc.4";
const cli = new Command()
.arguments("[a]")
.option(
"-A, --A [a]",
"A",
)
.action((opts, ...args) => {
console.log(opts);
console.log(args);
});
cli.parse(["-A", ""]);
// { A: true }
// [ "" ]
cli.parse(["-A", " "]);
// { A: " " }
// [] An aside, but seems like short flag only options are broken at the moment. |
greentore
changed the title
Empty strings are not recognized as a value for option
Empty strings are parsed as arguments regardless of context
Apr 17, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Passing an empty string (
""
) to an option with a required value results in an error. In case of optional value the string is ignored and you gettrue
instead.Is it a bug or working as intended?
The text was updated successfully, but these errors were encountered: