speechkit
Version:
AI-read audio for your news posts
74 lines (59 loc) • 1.86 kB
JavaScript
const SaveLocal = require('save-local')
const meow = require('meow')
const updateNotifier = require('update-notifier')
const speechkitLogin = require('./bin/speechkit-login')
const speechkitLs = require('./bin/speechkit-ls')
const speechkitCheck = require('./bin/speechkit-check')
const speechkitCreate = require('./bin/speechkit-create')
const cli = meow(
`
Usage:
$ speechkit login
$ speechkit ls <newsSiteId> <articleId>
$ speechkit check <newsSiteId> <articleId>
$ speechkit create <path-to-json>
Example:
$ speechkit login SpeechKit authentication
$ speechkit ls Show all your news sites
$ speechkit ls 299 1 Show specific article
$ speechkit check 299 1 Check if article processed
$ speechkit create article.json Create an article with audio
Options:
-h, --help Show help options
-v, --version Show version
`,
{
alias: {
h: 'help',
v: 'version'
}
}
)
updateNotifier({ pkg: cli.pkg }).notify()
const saveLocal = new SaveLocal('speechkit-store')
const input = cli.input[0] ? cli.input[0].toLowerCase() : undefined
let newsSiteId
let articleId
switch (input) {
case 'login':
speechkitLogin(saveLocal)
break
case 'ls':
newsSiteId = cli.input[1]
articleId = cli.input[2]
speechkitLs(saveLocal, newsSiteId, articleId)
break
case 'check':
newsSiteId = cli.input[1]
articleId = cli.input[2]
speechkitCheck(saveLocal, newsSiteId, articleId)
break
case 'create':
const file = cli.input[1]
speechkitCreate(saveLocal, file)
break
default:
cli.showHelp()
}