CLI: Parsed filenames as string (#18546)
This commit is contained in:
1 parent
8ad3204bf0
commit
656ff271a0
5 files changed
+16
-4
No files matched your search
@@ -1,6 +1,9 @@
|
||||
export default function createMinimistOptions(detailedOptions) {
|
||||
const booleanNames = [];
|
||||
const stringNames = [];
|
||||
// Numeric-looking arguments will be returned as numbers unless opts.string or opts.boolean contains that argument name.
|
||||
// To disable numeric conversion for non-option arguments, add '_' to opts.string.
|
||||
// https://github.com/minimistjs/minimist#const-argv--parseargsargs-opts
|
||||
const stringNames = ["_"];
|
||||
const defaultValues = {};
|
||||
|
||||
for (const option of detailedOptions) {
|
||||
|
||||
@@ -28,7 +28,7 @@ function parseArgv(rawArguments, detailedOptions, logger, keys) {
|
||||
return [option.forwardToApi || camelCase(key), value];
|
||||
}),
|
||||
),
|
||||
_: normalized._?.map(String),
|
||||
_: normalized._,
|
||||
get __raw() {
|
||||
return argv;
|
||||
},
|
||||
|
||||
@@ -56,11 +56,18 @@ exports[`number file/dir 4`] = `
|
||||
`;
|
||||
|
||||
exports[`number file/dir 5`] = `
|
||||
{
|
||||
"stdout": "1e3",
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`number file/dir 6`] = `
|
||||
{
|
||||
"stdout": "1/file-in-dir-named-1.js
|
||||
2.2/file-in-dir-named-2.2.js
|
||||
3
|
||||
4.44",
|
||||
4.44
|
||||
1e3",
|
||||
}
|
||||
`;
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ describe("allow overriding flags", () => {
|
||||
});
|
||||
|
||||
describe("number file/dir", () => {
|
||||
const patterns = ["1", "2.2", "3", "4.44"];
|
||||
const patterns = ["1", "2.2", "3", "4.44", "1e3"];
|
||||
for (const pattern of patterns) {
|
||||
runCli("cli/arg-parsing/number", [
|
||||
"--parser=babel",
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
hello(
|
||||
'prettier')
|
||||
Reference in new issue
Block a user