diff --git a/README.md b/README.md index d3f638c5f4..bdda8ace27 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ npm install liquidjs **CLI** ```bash -npx liquidjs --template 'Hello, {{ name }}!' --context '{"name": "Liquid"}' +npx liquidjs 'Hello, {{ name }}!' --context '{"name": "Liquid"}' ``` See the [setup guide][setup] for partials, layouts, caching, and other options. diff --git a/bin/liquid.js b/bin/liquid.js index 9d54b865d8..03e534a392 100755 --- a/bin/liquid.js +++ b/bin/liquid.js @@ -3,19 +3,7 @@ const fs = require('fs/promises') const Liquid = require('..').Liquid -// Preserve compatibility by falling back to legacy CLI behavior if: -// - stdin is redirected (i.e. not connected to a terminal) AND -// - there are either no arguments, or only a single argument which does not start with a dash -// TODO: Remove this fallback for 11.0 - -let renderPromise = null -if (!process.stdin.isTTY && (process.argv.length === 2 || (process.argv.length === 3 && !process.argv[2].startsWith('-')))) { - renderPromise = renderLegacy() -} else { - renderPromise = render() -} - -renderPromise.catch(err => { +render().catch(err => { process.stderr.write(`${err.message}\n`) process.exitCode = 1 }) @@ -26,8 +14,8 @@ async function render () { program .name('liquidjs') .description('Render a Liquid template') - .requiredOption('-t, --template ', 'liquid template to render (@- to read from stdin)') // TODO: Change to argument in 11.0 - .option('-c, --context ', 'input context in JSON format (@- to read from stdin)') + .argument('