refactor(lmc): use short property for options and simplify flags
This commit is contained in:
parent
b1730bfaf4
commit
5b6c65d30f
1 changed files with 16 additions and 24 deletions
40
src/index.ts
40
src/index.ts
|
|
@ -22,40 +22,32 @@ async function main() {
|
|||
const { values: args, positionals } = util.parseArgs({
|
||||
args: process.argv.slice(2),
|
||||
options: {
|
||||
model: { type: "string" },
|
||||
m: { type: "string" },
|
||||
new: { type: "boolean" },
|
||||
n: { type: "boolean" },
|
||||
config: { type: "boolean" },
|
||||
c: { type: "boolean" },
|
||||
model: { type: "string", short: "m" },
|
||||
new: { type: "boolean", short: "n" },
|
||||
config: { type: "boolean", short: "c" },
|
||||
plain: { type: "boolean" },
|
||||
"plain-out": { type: "boolean" },
|
||||
"plain-err": { type: "boolean" },
|
||||
version: { type: "boolean" },
|
||||
v: { type: "boolean" },
|
||||
"git-message": { type: "boolean" },
|
||||
g: { type: "boolean" },
|
||||
review: { type: "boolean" },
|
||||
r: { type: "boolean" },
|
||||
file: { type: "string" },
|
||||
f: { type: "string" },
|
||||
stdin: { type: "boolean" },
|
||||
i: { type: "boolean" },
|
||||
version: { type: "boolean", short: "v" },
|
||||
"git-message": { type: "boolean", short: "g" },
|
||||
review: { type: "boolean", short: "r" },
|
||||
file: { type: "string", short: "f" },
|
||||
stdin: { type: "boolean", short: "i" },
|
||||
},
|
||||
strict: true,
|
||||
allowPositionals: true,
|
||||
});
|
||||
|
||||
const newConvo = args.new ?? args.n;
|
||||
const newConvo = args.new;
|
||||
const plainOut = args["plain-out"] ?? args.plain ?? !process.stdout.isTTY;
|
||||
const plainErr = args["plain-err"] ?? args.plain ?? !process.stderr.isTTY;
|
||||
const modelOverride = args.model ?? args.m;
|
||||
const showVersion = args.version ?? args.v;
|
||||
const editConfig = args.config ?? args.c;
|
||||
const generateGitMessage = args["git-message"] ?? args.g;
|
||||
const generateReview = args.review ?? args.r;
|
||||
const inputFile = args.file ?? args.f;
|
||||
const stdinContent = args.stdin ?? args.i;
|
||||
const modelOverride = args.model;
|
||||
const showVersion = args.version;
|
||||
const editConfig = args.config;
|
||||
const generateGitMessage = args["git-message"];
|
||||
const generateReview = args.review;
|
||||
const inputFile = args.file;
|
||||
const stdinContent = args.stdin;
|
||||
|
||||
if (showVersion) {
|
||||
console.log("0.0.0");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue