Skip to content

Commit 57d2988

Browse files
authored
Merge pull request #11 from pkgjs/cli-help
Print CLI help message
2 parents 90db883 + b56bfb0 commit 57d2988

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

bin/detect-node-support

+11-4
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,13 @@ const { URL } = require('url');
99

1010
const internals = {};
1111

12+
internals.help = () => {
1213

13-
internals.autoDetect = (what) => {
14+
return `Usage: detect-node-support [ path | Github URL | npm package name ]`;
15+
};
1416

15-
if (!what) {
16-
return NodeSupport.detect({ path: '.' });
17-
}
17+
18+
internals.autoDetect = (what) => {
1819

1920
try {
2021
var url = new URL(what);
@@ -42,6 +43,11 @@ internals.autoDetect = (what) => {
4243

4344
exports.main = async (nodeBin, thisBin, what) => {
4445

46+
if (!what) {
47+
console.log(internals.help());
48+
return;
49+
}
50+
4551
const result = await internals.autoDetect(what);
4652

4753
console.log(result);
@@ -51,5 +57,6 @@ exports.main(...process.argv)
5157
.catch((err) => {
5258

5359
console.error(err);
60+
console.log(internals.help());
5461
process.exit(1);
5562
});

0 commit comments

Comments
 (0)