import StdOutUtil from '../utils/StdOutUtil' ; import StorageHelper from '../utils/StorageHelper' ; import Command , { IParams , ICommandLineOptions } from './Command' ; export default class List extends Command { protected command = 'list' ; protected aliases = [ 'ls' ] ; protected description = 'List all CapRover machines currently logged in.' ; protected async preAction ( cmdLineoptions ) { StdOutUtil . printMessage ( 'Logged in CapRover Machines:\n' ) ; return Promise . resolve ( cmdLineoptions ) ; } protected async action ( params ) { const machines = StorageHelper . get ( ) . getMachines ( ) ; machines . forEach ( StdOutUtil . displayColoredMachine ) ; if ( machines . length ) { StdOutUtil . printMessage ( '' ) ; } } }