Skip to content

Commit bfeb908

Browse files
committed
Syntax errors fixed
1 parent fbc1a50 commit bfeb908

File tree

2 files changed

+19
-19
lines changed

2 files changed

+19
-19
lines changed

cli-index.js

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,36 +10,36 @@ var argv = require('minimist')(process.argv.slice(2), {
1010
g: 'groups',
1111
h: 'help'
1212
},
13-
boolean: ['e', 'd', 'm', 'g']
13+
boolean: ['e', 'd', 'm', 'g', 'h']
1414
});
1515

16-
console.log(argv);
17-
1816
if (argv.h) {
1917
console.error(
20-
"Usage: " + process.argv[1] + " <doi> \n\
21-
Options: \n\
22-
-e, --exact Find an exact match \n\
23-
-d, --declared Find a DOI with a 'doi:' prefix\n\
24-
-m, --match Find all matches within the given string");
18+
"Usage: " + process.argv[1] + " <doi>\n" +
19+
"Options: \n" +
20+
"-e, --exact Find an exact match \n" +
21+
"-d, --declared Find a DOI with a 'doi:' prefix\n" +
22+
"-m, --match Find all matches within the given string");
2523
process.exit(-1)
2624
}
2725

2826
var doi = (argv.doi || argv._[0])
2927

3028
if (argv.m) {
3129
console.log(doi.match(doiRegex()))
30+
process.exit(-1)
3231
} else if (argv.g) {
3332
console.log(doiRegex.groups(doi));
33+
process.exit(-1)
34+
}
35+
36+
if (argv.e && argv.d) {
37+
console.log('Is this a declared DOI',
38+
doiRegex.declared({exact: true}).test(doi))
39+
} else if (argv.e && !argv.d) {
40+
console.log('Is this a DOI?', doiRegex({exact: true}).test(doi))
41+
} else if (!argv.e && argv.d) {
42+
console.log('Is the DOI declared?', doiRegex.declared().test(doi))
3443
} else {
35-
if (argv.e && argv.d) {
36-
console.log('Is this a declared DOI',
37-
doiRegex.declared({exact: true}).test(doi))
38-
} else if (argv.e && !argv.d) {
39-
console.log('Is this a DOI?', doiRegex({exact: true}).test(doi))
40-
} else if (!argv.e && argv.d) {
41-
console.log('Is the DOI declared?', doiRegex.declared().test(doi))
42-
} else {
43-
console.log('Does a DOI exist?', doiRegex().test(doi))
44-
}
44+
console.log('Does a DOI exist?', doiRegex().test(doi))
4545
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "doi-regex",
3-
"version": "0.0.4",
3+
"version": "0.0.5",
44
"description": "Regular expression for matching DOIs",
55
"main": "index.js",
66
"scripts": {

0 commit comments

Comments
 (0)