refactor(lmc): use short property for options and simplify flags

This commit is contained in:
mitchell 2026-06-26 17:06:12 -04:00
parent b1730bfaf4
commit 5b6c65d30f

View file

@ -22,40 +22,32 @@ async function main() {
const { values: args, positionals } = util.parseArgs({ const { values: args, positionals } = util.parseArgs({
args: process.argv.slice(2), args: process.argv.slice(2),
options: { options: {
model: { type: "string" }, model: { type: "string", short: "m" },
m: { type: "string" }, new: { type: "boolean", short: "n" },
new: { type: "boolean" }, config: { type: "boolean", short: "c" },
n: { type: "boolean" },
config: { type: "boolean" },
c: { type: "boolean" },
plain: { type: "boolean" }, plain: { type: "boolean" },
"plain-out": { type: "boolean" }, "plain-out": { type: "boolean" },
"plain-err": { type: "boolean" }, "plain-err": { type: "boolean" },
version: { type: "boolean" }, version: { type: "boolean", short: "v" },
v: { type: "boolean" }, "git-message": { type: "boolean", short: "g" },
"git-message": { type: "boolean" }, review: { type: "boolean", short: "r" },
g: { type: "boolean" }, file: { type: "string", short: "f" },
review: { type: "boolean" }, stdin: { type: "boolean", short: "i" },
r: { type: "boolean" },
file: { type: "string" },
f: { type: "string" },
stdin: { type: "boolean" },
i: { type: "boolean" },
}, },
strict: true, strict: true,
allowPositionals: true, allowPositionals: true,
}); });
const newConvo = args.new ?? args.n; const newConvo = args.new;
const plainOut = args["plain-out"] ?? args.plain ?? !process.stdout.isTTY; const plainOut = args["plain-out"] ?? args.plain ?? !process.stdout.isTTY;
const plainErr = args["plain-err"] ?? args.plain ?? !process.stderr.isTTY; const plainErr = args["plain-err"] ?? args.plain ?? !process.stderr.isTTY;
const modelOverride = args.model ?? args.m; const modelOverride = args.model;
const showVersion = args.version ?? args.v; const showVersion = args.version;
const editConfig = args.config ?? args.c; const editConfig = args.config;
const generateGitMessage = args["git-message"] ?? args.g; const generateGitMessage = args["git-message"];
const generateReview = args.review ?? args.r; const generateReview = args.review;
const inputFile = args.file ?? args.f; const inputFile = args.file;
const stdinContent = args.stdin ?? args.i; const stdinContent = args.stdin;
if (showVersion) { if (showVersion) {
console.log("0.0.0"); console.log("0.0.0");