From 0a78e805b6f325b6e83c903c28ad155172a675e7 Mon Sep 17 00:00:00 2001 From: Ben Ashton Date: Fri, 27 May 2022 06:08:57 -0700 Subject: [PATCH] Added help command line option --- src/main.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main.ts b/src/main.ts index cfc5b96..ac1ead6 100644 --- a/src/main.ts +++ b/src/main.ts @@ -8,12 +8,15 @@ import { ArgParse } from "./utils/arg_parse.js"; function printUsage() { console.log("Usage: npm start -- boardFile gameLogFile [options]"); console.log(" options:"); + console.log(" -h --help Print this message"); console.log(" -m --maxPlayersPerGame Maximum players per game"); console.log(" -d --debug Print stack trace on error"); } async function main() { - // Validate command line arguments + // Process command line arguments + if (ArgParse.getBooleanArg("h", "help")) return printUsage(); + const boardFilename = ArgParse.getStringArg(2); if (!boardFilename) return printUsage();