Added help command line option
This commit is contained in:
parent
f08b7da487
commit
0a78e805b6
@ -8,12 +8,15 @@ import { ArgParse } from "./utils/arg_parse.js";
|
|||||||
function printUsage() {
|
function printUsage() {
|
||||||
console.log("Usage: npm start -- boardFile gameLogFile [options]");
|
console.log("Usage: npm start -- boardFile gameLogFile [options]");
|
||||||
console.log(" options:");
|
console.log(" options:");
|
||||||
|
console.log(" -h --help Print this message");
|
||||||
console.log(" -m --maxPlayersPerGame Maximum players per game");
|
console.log(" -m --maxPlayersPerGame Maximum players per game");
|
||||||
console.log(" -d --debug Print stack trace on error");
|
console.log(" -d --debug Print stack trace on error");
|
||||||
}
|
}
|
||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
// Validate command line arguments
|
// Process command line arguments
|
||||||
|
if (ArgParse.getBooleanArg("h", "help")) return printUsage();
|
||||||
|
|
||||||
const boardFilename = ArgParse.getStringArg(2);
|
const boardFilename = ArgParse.getStringArg(2);
|
||||||
if (!boardFilename) return printUsage();
|
if (!boardFilename) return printUsage();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user