UNPKG

672 BJavaScriptView Raw
1const opn = require( 'opn' );
2const chalk = require( 'chalk' );
3const nconf = require( 'nconf' );
4const inquirer = require( 'inquirer' );
5const sh = require( 'shelljs' );
6const cp = require( 'child_process' );
7const util = require( '../lib/util' );
8const prompt = require( '../lib/prompt' );
9
10/**
11 * The main command.
12 */
13async function ssh() {
14 if ( !util.localProjectsExist() ) {
15 console.error( chalk`{red.bold No projects available.}` );
16 process.exit( 1 );
17 }
18
19 const projObj = await inquirer.prompt( prompt.getAvailableProjectsPrompt() );
20
21 cp.spawnSync( 'docker', ['exec', '-it', projObj.answer, '/bin/bash'], {
22 stdio : 'inherit',
23 });
24}
25
26module.exports = ssh;