import { AbstractRunner } from '../runners' ; import { SchematicOption } from './schematic.option' ; export class AbstractCollection { constructor ( protected collection , protected runner ) { } public async execute ( name , options , extraFlags ? ) { let command = this . buildCommandLine ( name , options ) ; command = extraFlags ? command . concat ( ` ${ extraFlags }` ) : command ; await this . runner . run ( command ) ; } private buildCommandLine ( name , options ) { return `${ this . collection }:${ name }${ this . buildOptions ( options ) }` ; } private buildOptions ( options ) { return options . reduce ( ( line , option ) => { return line . concat ( ` ${ option . toCommandString ( ) }` ) ; } , '' ) ; } }