diff --git a/README.md b/README.md index 6b35a5c..ae71c81 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,7 @@ game-pass-api init ``` It asks a few questions (markets, language, platforms, and which properties to include) and writes a `config.json`, then offers to run it right away. +Running `game-pass-api` with no arguments and no `config.json` present starts this wizard automatically. You can also write the `config.json` by hand - see [Configuration](#configuration) - and then run the tool: diff --git a/bin/cli.js b/bin/cli.js index 64d8903..ec92229 100644 --- a/bin/cli.js +++ b/bin/cli.js @@ -27,6 +27,11 @@ program .option('-o, --out ', 'directory to write output files to (overrides outputDirectory; default: output)') .addHelpText('after', '\nThe configuration comes from a config.json in the current directory (or --config ).\nRun "game-pass-api init" to create one interactively, or see the README and config.schema.json for every option.') .action(async (options) => { + // Start the interactive wizard when invoked with no options and no config to load, but only in an interactive shell so scripts still get the friendly no-config error + if (!options.config && !options.from && !options.out && !fs.existsSync('config.json') && process.stdin.isTTY) { + await runWizard('config.json'); + return; + } const config = loadConfig(options.config); if (options.out) { config.outputDirectory = options.out;