UNPKG

snips-sam

Version:

The Snips Assistant Manager

25 lines (21 loc) 800 B
import * as yargs from 'yargs'; import chalk from 'chalk'; import cli from '../cli'; import { SSHService } from '../session/ssh'; exports.command = 'init'; exports.desc = 'Initialize a device'; exports.handler = async (argv: yargs.Argv) => { const ssh = new SSHService(); await ssh.connect().catch(e => cli.stream.error(e)); cli.stream.print('Installing Snips packages'); try { await ssh.installSnips(string => cli.stream.printNoLN(string)); } catch (e) { cli.stream.error('Failed to install platform: ' + e.stack); ssh.disconnect(); process.exit(); } cli.stream.success('Successfully installed the platform'); cli.stream.hint(`You can now setup your microphone with ` + chalk.blue('sam setup microphone')); ssh.disconnect(); };