-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommand.js
More file actions
103 lines (95 loc) · 2.31 KB
/
command.js
File metadata and controls
103 lines (95 loc) · 2.31 KB
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
const meta = require('./package')
const debug = require('debug')(meta.name + ':command')
const yargs = require('yargs')
module.exports = function () {
yargs.usage('Usage: $0 <command> [options]')
yargs.options({
'secret': {
alias: 's',
nargs: 1,
string: true,
describe: 'The secret for email address anonymization',
default: 'quite a boring secret'
},
'output': {
alias: 'o',
nargs: 1,
string: true,
describe: 'Write data to file'
},
'save-mapping': {
alias: ['mapping', 'm'],
nargs: 1,
string: true,
describe: 'Write anonymization mapping to file'
},
'user-words': {
nargs: 1,
number: true,
describe: 'The number of words for anonymization of address usernames',
default: 4
},
'domain-words': {
nargs: 1,
number: true,
describe: 'The number of words for anonymization of address domains',
default: 3
},
'provider': {
alias: 'p',
nargs: 1,
string: true,
choices: [
'mac',
'imap',
'gmail'
],
describe: 'The mailbox provider',
},
'mac-index': {
nargs: 1,
string: true,
describe: 'The index file path for "mac" provider',
default: '~/Library/Mail/V5/MailData/Envelope\ Index'
},
'imap-host': {
alias: 'H',
nargs: 1,
string: true,
describe: 'The IMAP server host',
},
'imap-port': {
nargs: 1,
number: true,
describe: 'The IMAP server port',
default: 993
},
'imap-tls': {
nargs: 1,
boolean: true,
describe: 'Enable TLS on the connection with the IMAP server',
default: true
},
'imap-filter': {
alias: 'gmail-filter',
nargs: 1,
string: true,
describe: 'Only fetch in mailboxes matching the given regular expression'
},
'imap-invert': {
alias: 'gmail-invert',
nargs: 1,
boolean: true,
describe: 'Invert filter matching'
}
})
yargs.command(require('./command-flow'))
yargs.command(require('./command-map'))
yargs.help('h')
yargs.alias('h', 'help')
yargs.alias('v', 'version')
yargs.env(meta.name.replace(/-/g, '').toUpperCase())
yargs.demandCommand(1, `${meta.name}@${meta.version} ${__dirname}`)
yargs.strict()
const argv = yargs.argv
}