parent
0d533c5d9d
commit
7cffc2a359
@ -0,0 +1,26 @@
|
|||||||
|
import {Directive} from "../Directive"
|
||||||
|
import {Injectable} from "@extollo/di"
|
||||||
|
import {Unit} from "@extollo/lib"
|
||||||
|
import {ErrorWithContext} from "@extollo/util"
|
||||||
|
import {CommandLineApplication} from "../service"
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
|
export class RunDirective extends Directive {
|
||||||
|
getDescription(): string {
|
||||||
|
return 'run the application normally'
|
||||||
|
}
|
||||||
|
|
||||||
|
getKeywords(): string | string[] {
|
||||||
|
return ['run', 'up']
|
||||||
|
}
|
||||||
|
|
||||||
|
async handle(): Promise<void> {
|
||||||
|
if ( !CommandLineApplication.getReplacement() ) {
|
||||||
|
throw new ErrorWithContext(`Cannot run application: no run target specified.`)
|
||||||
|
}
|
||||||
|
|
||||||
|
const unit = <Unit> this.make(CommandLineApplication.getReplacement())
|
||||||
|
await this.app().startUnit(unit)
|
||||||
|
await this.app().stopUnit(unit)
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in new issue