-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathargv.js
50 lines (49 loc) · 1.24 KB
/
argv.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
const yargs = require('yargs');
const defaultValue = require('./defaultValue');
module.exports = yargs
.option('file', {
type: 'string',
describe: 'The path of audio file',
alias: 'f',
})
.option('output', {
type: 'string',
describe: 'The output path',
default: defaultValue.OUTPUT_PATH,
alias: 'o',
})
.option('fftsize', {
type: 'number',
default: defaultValue.FFT_SIZE,
alias: 'fs',
})
.option('intervalTime', {
type: 'number',
default: defaultValue.INTERVAL_TIME,
describe: 'The interval time of analyse audio',
alias: 'it',
})
.option('outputType', {
type: 'string',
default: defaultValue.OUTPUT_TYPE,
choices: ['txt', 'json'],
describe: 'The type of output file, supoort json and txt.',
alias: 'ot',
})
.option('dataType', {
type: 'string',
default: defaultValue.DATA_TYPE,
choices: ['floatFrequency', 'byteFrequency', 'floatTimeDomain', 'byteTimeDomain'],
describe: 'The data type of analysis.',
alias: 'dt',
})
.option('dataLength', {
type: 'number',
default: defaultValue.DATA_LENGTH,
describe: 'The length of analysis data.',
alias: 'dl',
})
.example('analyse --file ./a.mp3')
.help('h')
.alias('h', 'help')
.argv