beesbuild
Version:
构建工具链
27 lines (26 loc) • 557 B
JavaScript
import parseArgs from "yargs-parser";
const aliases = {
c: "config",
h: "help",
v: "version"
};
const parseCliArguments = (args) => {
const options = parseArgs(args, {
boolean: [""],
alias: aliases,
configuration: {
"parse-numbers": false,
"camel-case-expansion": false
}
});
if (options.V) {
options.verbose = typeof options.V === "boolean" ? options.V : options.V.length;
delete options.V;
}
options.increment = options._[0] || options.i;
return options;
};
export {
aliases,
parseCliArguments
};