Skip to content
forked from tsdjs/tsd

Commit

Permalink
Remove -h and -v short flags
Browse files Browse the repository at this point in the history
  • Loading branch information
tommy-mitchell committed Sep 13, 2022
1 parent 0e52cb5 commit d5e3a6f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 26 deletions.
14 changes: 3 additions & 11 deletions source/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ const cli = meow(`
The given directory must contain a package.json and a typings file.
Info
--help, -h Display help text
--version, -v Display version info
--help, Display help text
--version, Display version info
Options
--typings, -t Type definition file to test [Default: "types" property in package.json]
--files, -f Glob of files to test [Default: /path/test-d/**/*.test-d.ts or .tsx]
--files, -f Glob of files to test [Default: '/path/test-d/**/*.test-d.ts' or '.tsx']
Examples
$ tsd /path/to/project
Expand All @@ -41,14 +41,6 @@ const cli = meow(`
});

(async () => {
if (cli.flags.h) {
cli.showHelp(0);
}

if (cli.flags.v) {
cli.showVersion();
}

try {
const cwd = cli.input.length > 0 ? cli.input[0] : process.cwd();
const typingsFile = cli.flags.typings;
Expand Down
20 changes: 5 additions & 15 deletions source/test/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,28 +35,18 @@ test('provide a path', async t => {
});

test('cli help flag', async t => {
const runTest = (arg: '--help' | '-h') => {
const {exitCode} = execa.commandSync(`dist/cli.js ${arg}`);
const {exitCode} = await execa('dist/cli.js', ['--help']);

t.is(exitCode, 0);
};

runTest('--help');
runTest('-h');
t.is(exitCode, 0);
});

test('cli version flag', async t => {
const pkg = readPkgUp.sync({normalize: false})?.packageJson ?? {};

const runTest = (arg: '--version' | '-v') => {
const {exitCode, stdout} = execa.commandSync(`dist/cli.js ${arg}`);
const {exitCode, stdout} = await execa('dist/cli.js', ['--version']);

t.is(exitCode, 0);
t.is(stdout, pkg.version);
};

runTest('--version');
runTest('-v');
t.is(exitCode, 0);
t.is(stdout, pkg.version);
});

test('cli typings flag', async t => {
Expand Down

0 comments on commit d5e3a6f

Please sign in to comment.