import * as yargs from "yargs"; import { inspect } from "../../lib/general"; import { AuthRepository } from "../../app/auth"; import { config } from "../../app/config"; import { Questions } from "../../app/cli"; export var command: string = 'add [extra]'; export var desc: string = 'Add credentials for authorisation'; export function builder( args: yargs.Argv ) { var remoteOpts = { describe: 'A remote ', choices: ['bitbucket-server', 'bitbucket', 'github'], demand: true }; let all = config(); inspect(remoteOpts); return args.usage(`${desc}\n\nUsage: add [extra]`, { remote: { describe: 'A remote ', choices: ['bitbucket-server', 'bitbucket', 'github'], demand: true } }) // .options({ // remote: { // describe: 'A remote (bitbucket server, bitbucket cloud or github)', // default: false // } // }) // .command('remote', 'A remote (bitbucket-server | bitbucket | github)', remoteOpts) // .command('method', 'The authentication (basic | oauth | oauth2 | token)') // .command('key', 'Depending on [method] (basic/token=username, oauth=key/id)') // .command('secret', 'Depending on [method] (basic=password, token=token, oauth=secret)') // .describe('remote', 'sdf') .help() .example('login bitbucket-server basic admin mypass https://git.myserver.com', 'Login into a BitBucket server. Note the last argument is the URL to the server') .example('login github basic johnny jhonrocx', 'Login into a Github server.') .example('login bitbucket basic johnny jhonrocx', 'Login into a Bitbucket server. ') .updateStrings({ 'Commands:' : 'Arguments:' }) ; } export function handler( argv ) { console.log('handler argv', argv); if ( argv._.length === 0 ) { yargs.showHelp(); return; } //AuthRepository.add('') console.log('sdfsadfsdf'); inspect('argv', argv); inspect('connections.all', AuthRepository.all()) }