Start basic CLI framework
This commit is contained in:
37
cli/src/directive/Directive.ts
Normal file
37
cli/src/directive/Directive.ts
Normal file
@@ -0,0 +1,37 @@
|
||||
import AppClass from '../../../lib/src/lifecycle/AppClass.ts'
|
||||
import {Logging} from '../../../lib/src/service/logging/Logging.ts'
|
||||
|
||||
export abstract class Directive extends AppClass {
|
||||
public abstract readonly keyword: string
|
||||
public abstract readonly help: string
|
||||
|
||||
static options() {
|
||||
return []
|
||||
}
|
||||
|
||||
public abstract invoke(): any
|
||||
|
||||
success(message: any) {
|
||||
this.make(Logging).success(message, true)
|
||||
}
|
||||
|
||||
error(message: any) {
|
||||
this.make(Logging).error(message, true)
|
||||
}
|
||||
|
||||
warn(message: any) {
|
||||
this.make(Logging).warn(message, true)
|
||||
}
|
||||
|
||||
info(message: any) {
|
||||
this.make(Logging).info(message, true)
|
||||
}
|
||||
|
||||
debug(message: any) {
|
||||
this.make(Logging).debug(message, true)
|
||||
}
|
||||
|
||||
verbose(message: any) {
|
||||
this.make(Logging).verbose(message, true)
|
||||
}
|
||||
}
|
||||
10
cli/src/directive/UsageDirective.ts
Normal file
10
cli/src/directive/UsageDirective.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import {Directive} from './Directive.ts'
|
||||
|
||||
export class UsageDirective extends Directive {
|
||||
public readonly keyword = 'help'
|
||||
public readonly help = 'Display usage information'
|
||||
|
||||
public async invoke() {
|
||||
console.log('Hello, from Daton CLI.')
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user