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')
15 !program['username'] ||
18 if (!program['url']) console.error('--url field is required.')
19 if (!program['username']) console.error('--username field is required.')
20 if (!program['password']) console.error('--password field is required.')
25 getClient(program.url)
30 username: program['username'],
31 password: program['password']
34 id: res.body.client_id,
35 secret: res.body.client_secret
39 return serverLogin(server)
41 .then(accessToken => {
42 console.log(accessToken)