1 import { registerTSPaths } from '../helpers/register-ts-paths'
4 import * as program from 'commander'
5 import { getClient, Server, serverLogin } from '../../shared/extra-utils'
8 .option('-u, --url <url>', 'Server url')
9 .option('-n, --username <username>', 'Username')
10 .option('-p, --password <token>', 'Password')
13 const options = program.opts()
20 if (!options.url) console.error('--url field is required.')
21 if (!options.username) console.error('--username field is required.')
22 if (!options.password) console.error('--password field is required.')
27 getClient(options.url)
32 username: options.username,
33 password: options.password
36 id: res.body.client_id,
37 secret: res.body.client_secret
41 return serverLogin(server)
43 .then(accessToken => {
44 console.log(accessToken)