clean-code-metrics
Version:
metrics for clean code
62 lines (56 loc) • 1.23 kB
text/typescript
import yargs, { Argv, Options } from "yargs";
import summary from "./cli/summary";
import list from "./cli/list";
import * as fs from "fs";
const verboseOptions: Options = {
alias: "v",
describe: "verbose",
type: "boolean",
default: false,
};
const configFileOption: Options = {
alias: "c",
describe: "verbose",
type: "string",
//TODO add a default
};
yargs
.command(
"summary",
"Collects summary of all task from project",
(yargs: Argv) => {
return yargs
.option("taskFilter", {
alias: "t",
type: "array",
describe: "filter for task",
default: [],
})
.option("verbose", verboseOptions)
.option("config", configFileOption);
},
(argv) =>
summary(
argv.taskFilter,
argv.verbose as boolean,
argv.config as fs.PathLike,
),
)
.command(
"list",
"List all tasks grouped together by file",
(yargs: Argv) => {
return yargs
.option("files", {
alias: "f",
type: "array",
describe: "files to include",
default: [],
})
.option("verbose", verboseOptions)
.option("config", configFileOption);
},
(argv) =>
list(argv.files, argv.verbose as boolean, argv.config as fs.PathLike),
).argv;