The isRequired option does not seem to work when the flag is defined as kebab-case. I think it's probably looking for the kebab-case key in a map of camelCase flags when it checks to see if it has been provided.
Given this test fixture:
const cli = meow({
description: "Custom description",
help: `
Usage
foo <input>
`,
flags: {
test: {
type: "string",
alias: "t",
isRequired: true,
},
"kebab-case": {
type: "string",
isRequired: true,
},
number: {
type: "number",
isRequired: true,
},
notRequired: {
type: "string",
},
},
});
console.log(`${cli.flags.test},${cli.flags.kebabCase},${cli.flags.number}`);
This test case fails:
test("spawn cli and test specifying all required flags", async (t) => {
const { stdout } = await execa(fixtureRequiredPath, [
"-t",
"test",
"--kebab-case",
"test",
"--number",
"6",
]);
t.is(stdout, "test,test,6");
});
The failure is:
Missing required flag␊
--kebab-case
The
isRequiredoption does not seem to work when the flag is defined as kebab-case. I think it's probably looking for the kebab-case key in a map of camelCase flags when it checks to see if it has been provided.Given this test fixture:
This test case fails:
The failure is: