Skip to content

Commit

Permalink
Improve input validation
Browse files Browse the repository at this point in the history
Fixes #10
  • Loading branch information
sindresorhus committed May 23, 2019
1 parent f041897 commit 38ee523
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,11 @@ const cli = meow(`
const [input, output] = cli.input;
const options = cli.flags;

if (!input) {
console.error('Please specify a URL or file path');
process.exit(1);
}

options.hideElements = arrify(options.hideElements);
options.removeElements = arrify(options.removeElements);
options.modules = arrify(options.module);
Expand Down
2 changes: 1 addition & 1 deletion test.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ test('check flags', async t => {
.replace(/\\"/g, '"')
.split('\n');

const {stdout} = await execa('./cli.js', ['--internal-print-flags', ...flags]);
const {stdout} = await execa('./cli.js', ['noop-file', '--internal-print-flags', ...flags]);
const json = JSON.parse(stdout);
t.snapshot(json);
});

0 comments on commit 38ee523

Please sign in to comment.