Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/stephansama/packages. open source npm packages created by @stephansama packages.stephansama.info
Something went wrong. Try again.
836 B · 35 lines
TypeScript
123456789101112131415161718192021222324252627282930313233343536import { enable } from "obug";import yargs, { type Options } from "yargs";import { hideBin } from "yargs/helpers";
import { moduleName } from "./util";
const args = { config: { alias: "c", description: "Path to config file", type: "string" }, output: { alias: "o", description: "Output file for commit-msg", type: "string", }, verbose: { alias: "v", description: "Enable verbose logging", type: "boolean", },} satisfies Record<string, Options>;
export async function parseArgs() { const yargsInstance = yargs(hideBin(process.argv)) .options(args) .help("h") .alias("h", "help") .epilogue(`--> @stephansama open-source ${new Date().getFullYear()}`);
const parsed = await yargsInstance .wrap(yargsInstance.terminalWidth()) .parse();
if (parsed.verbose) enable(`${moduleName}*`);
return parsed;}