You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
extollo-cli/src/service/CommandLine.ts

40 lines
1.1 KiB

import {Unit} from "@extollo/lib"
import {Singleton, Instantiable} from "@extollo/di"
import {Collection} from "@extollo/util"
import {CommandLineApplication} from "./CommandLineApplication"
import {Directive} from "../Directive";
@Singleton()
export class CommandLine extends Unit {
protected directives: Collection<Instantiable<Directive>> = new Collection<Instantiable<Directive>>()
constructor() { super() }
public isCLI() {
return this.app().hasUnit(CommandLineApplication)
}
public getASCIILogo() {
return ` ______ _ _ _
| ____| | | | | |
| |__ __ _| |_ ___ | | | ___
| __| \\ \\/ / __/ _ \\| | |/ _ \\
| |____ > <| || (_) | | | (_) |
|______/_/\\_\\\\__\\___/|_|_|\\___/`
}
public registerDirective(directiveClass: Instantiable<Directive>) {
if ( !this.directives.includes(directiveClass) ) {
this.directives.push(directiveClass)
}
}
public hasDirective(directiveClass: Instantiable<Directive>) {
return this.directives.includes(directiveClass)
}
public getDirectives() {
return this.directives.clone()
}
}