Fix the bug of when there is no default person to pronounce

This commit is contained in:
2017-06-12 10:48:49 +08:00
parent 24eb787f9b
commit b6523df7da
2 changed files with 4 additions and 3 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "say-it",
"version": "0.1.3",
"version": "0.1.4",
"description": "Read the text you typed in command line by using Baidu tts.",
"main": "say-it.js",
"bin": {
+3 -2
View File
@@ -20,7 +20,7 @@ var person = 0
charm.pipe(process.stdout);
program
.version('0.0.1')
.version('0.1')
.command(' ', 'read the texts you typed in', {
isDefault: true
})
@@ -31,7 +31,8 @@ program.on('*', () => {
if (!text || text.trim() === '') {
return showError()
}
if (!_.includes([0, 1, 2, 3, 4], Number.parseInt(program.person))) {
if (!!program.person && !_.includes([0, 1, 2, 3, 4], Number.parseInt(program.person))) {
return showError(TEXTS.invalidPerson)
}
person = Number.parseInt(program.person)