diff --git a/readme.md b/readme.md index f1d2d6e..f5f7609 100644 --- a/readme.md +++ b/readme.md @@ -49,8 +49,9 @@ $ npm run ts-build $ node dist/standalone/executable.js $ node dist/standalone/executable.js --config ./my-config.yaml $ node dist/standalone/executable.js -c ./my-config.yaml +$ node dist/standalone/executable.js --debug --no-wait ``` -The `--config` (or `-c`) option allows you to specify a custom configuration file instead of the default `config.json`. Both JSON and YAML files are supported. You can also use the form `--config=`. +The `--config` (or `-c`) option allows you to specify a custom configuration file instead of the default `config.json`. Both JSON and YAML files are supported. You can also use the form `--config=`. Use `--debug` to enable debug output and `--no-wait` to exit without waiting for a keypress. #### Running on Linux/macOS @@ -60,6 +61,7 @@ Once the project adds support for these platforms the steps are the same: npm run ts-build node dist/standalone/executable.js --config ./my-config.yaml node dist/standalone/executable.js --config=./my-config.yaml +node dist/standalone/executable.js --debug --no-wait ``` The build pipeline will skip the signing step on non-Windows systems. #### npm scripts diff --git a/source/standalone/executable.ts b/source/standalone/executable.ts index e40145f..32a7840 100644 --- a/source/standalone/executable.ts +++ b/source/standalone/executable.ts @@ -1,4 +1,4 @@ -import Patcher from '../index.js'; +import Patcher, { Debug } from '../index.js'; import yargs from 'yargs'; import { hideBin } from 'yargs/helpers'; @@ -10,6 +10,16 @@ const argv = yargs(hideBin(process.argv)) type: 'string', describe: 'Path to configuration file', }) + .option('debug', { + type: 'boolean', + describe: 'Enable debug mode', + default: false, + }) + .option('wait', { + type: 'boolean', + describe: 'Wait for keypress before exiting', + default: true, + }) .help() .version() .strict() @@ -22,7 +32,12 @@ const argv = yargs(hideBin(process.argv)) /** Just run the patcher */ try { - await runPatcher({ configFilePath: argv.config as string | undefined }); + if (argv.debug) Debug.enable({ logging: argv.debug }); + + await runPatcher({ + configFilePath: argv.config as string | undefined, + waitForExit: argv.wait as boolean, + }); } catch (error) { console.error(error); process.exitCode = 1;