Skip to content

Commit

Permalink
fix: add --version argument for improved debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
UnderKoen committed Oct 31, 2023
1 parent e95728b commit 7027260
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/help.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,16 @@ class Help {

console.log(`${prefix}${suffix}`);
}

static printVersion(): void {
// eslint-disable-next-line @typescript-eslint/no-var-requires
const packageJson = require("../package.json") as {
version: string;
};

console.log(`${packageJson.version}`);
process.exit(0);
}
}

export { Help };
4 changes: 4 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ process.argv = argv["--"] ?? [];
const config = loadConfig(argv);

async function main() {
if (argv["version"]) {
Help.printVersion();
}

Help.printHelp(config, argv, argv.h);
Help.printHelp(config, argv, argv.help);

Expand Down

0 comments on commit 7027260

Please sign in to comment.