blob: 5868d05485b0a27abbd6ae82e4991bf74f8bee4d (
plain) (
tree)
|
|
import { registerTSPaths } from '../helpers/register-ts-paths'
registerTSPaths()
import { program } from 'commander'
import { getAccessToken } from '../../shared/extra-utils'
program
.option('-u, --url <url>', 'Server url')
.option('-n, --username <username>', 'Username')
.option('-p, --password <token>', 'Password')
.parse(process.argv)
const options = program.opts()
if (
!options.url ||
!options.username ||
!options.password
) {
if (!options.url) console.error('--url field is required.')
if (!options.username) console.error('--username field is required.')
if (!options.password) console.error('--password field is required.')
process.exit(-1)
}
getAccessToken(options.url, options.username, options.password)
.then(accessToken => {
console.log(accessToken)
process.exit(0)
})
.catch(err => {
console.error(err)
process.exit(-1)
})
|