-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
executable file
·63 lines (57 loc) · 1.47 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/usr/bin/env node
const process = require('process');
const yargs = require('yargs');
const updateNotifier = require('update-notifier');
const pkg = require('./package.json');
updateNotifier({ pkg }).notify();
const main = require('./src');
const argv = yargs
.option('i', {
alias: 'input',
default: 'stdin',
description: 'Input file or string',
type: 'string',
coerce: value => (value === 'stdin' ? process.stdin : value),
})
.option('t', {
alias: 'type',
default: 'pdb',
description: 'Type of input',
choices: ['pdb'],
})
.option('email', {
description: 'Email address (required by InterProScan)',
type: 'string',
coerce: string => {
if (
!string.includes('@') ||
string.toLowerCase().endsWith('example.com')
) {
throw new Error('Invalid email');
}
return string;
},
})
.option('o', {
alias: 'output',
default: 'stdout',
description: 'Output file',
type: 'string',
coerce: value => (value === 'stdout' ? process.stdout : value),
})
.option('force-output', {
default: false,
description: 'Force overwriting the output file if it already exists',
type: 'boolean',
})
.option('s', {
alias: 'silent',
default: false,
description: "Don't output anything to stderr (no spinner)",
})
.demandOption(
'email',
'Please provide a contact email, it is required by InterProScan',
)
.help().argv;
main(argv).catch(console.error);