(params, callback)
| 37 | } |
| 38 | |
| 39 | async run (params, callback) { |
| 40 | |
| 41 | let host = params.flags.h ? params.flags.h[0] : 'https://api.autocode.com'; |
| 42 | let port = params.flags.p && params.flags.p[0]; |
| 43 | |
| 44 | let force = params.flags.hasOwnProperty('f') || params.vflags.hasOwnProperty('force'); |
| 45 | let nologin = params.flags.hasOwnProperty('n') || params.vflags.hasOwnProperty('no-login'); |
| 46 | |
| 47 | if (!force && config.workspace()) { |
| 48 | console.log(); |
| 49 | console.log(chalk.bold.red('Oops!')); |
| 50 | console.log(); |
| 51 | console.log(`An Autocode workspace has already been set.`); |
| 52 | console.log(`The path of the Autocode workspace is:`) |
| 53 | console.log(` ${chalk.bold(config.workspace())}`); |
| 54 | console.log(); |
| 55 | console.log(`Use ${chalk.bold('lib init --force')} to override and set a new workspace.`); |
| 56 | console.log(); |
| 57 | return callback(null); |
| 58 | } |
| 59 | |
| 60 | config.initialize(process.cwd()); |
| 61 | |
| 62 | let cb = (err) => { |
| 63 | if (err) { |
| 64 | return callback(err); |
| 65 | } |
| 66 | console.log(); |
| 67 | console.log(chalk.bold.green(`Congratulations!`)); |
| 68 | console.log(`Your Autocode development environment has been initialized.`); |
| 69 | console.log(); |
| 70 | console.log(`Use ${chalk.bold('lib create <service>')} to create a new (local) service package.`); |
| 71 | console.log(`or type ${chalk.bold('lib download <service>')} to download an existing service package.`); |
| 72 | console.log() |
| 73 | console.log(`Additionally, use ${chalk.bold('lib help')} to see more commands.`) |
| 74 | console.log(); |
| 75 | console.log(chalk.bold('Happy building! :)')); |
| 76 | console.log(); |
| 77 | callback(null); |
| 78 | }; |
| 79 | |
| 80 | if (nologin) { |
| 81 | return cb(); |
| 82 | } |
| 83 | |
| 84 | console.log(); |
| 85 | console.log(chalk.bold.green('Welcome to Autocode! :)')) |
| 86 | console.log(); |
| 87 | console.log(`To use the ${chalk.bold('Autocode')} registry, you must have a registered account.`); |
| 88 | console.log(`It will allow you to push your services to the cloud and manage environments.`); |
| 89 | console.log(`If you don\'t have an account, it\'s ${chalk.bold.underline.green('free')} to sign up!`) |
| 90 | console.log(`Please go to https://autocode.com/signup to get started.`); |
| 91 | console.log(); |
| 92 | console.log(`If you already have an account, please enter your e-mail to login.`); |
| 93 | console.log(); |
| 94 | |
| 95 | let questions = []; |
| 96 |
nothing calls this directly
no test coverage detected