44 lines
1.0 KiB
TypeScript
44 lines
1.0 KiB
TypeScript
|
import {Template} from "../Template"
|
||
|
import {UniversalPath} from "../../util"
|
||
|
|
||
|
/**
|
||
|
* Template that generates a new Directive class in the app/directives directory.
|
||
|
*/
|
||
|
const directive_template: Template = {
|
||
|
name: 'directive',
|
||
|
fileSuffix: '.directive.ts',
|
||
|
description: 'Create a new Directive class which adds functionality to the ./ex command.',
|
||
|
baseAppPath: ['directives'],
|
||
|
render(name: string, fullCanonicalName: string, targetFilePath: UniversalPath) {
|
||
|
return `import {Directive, OptionDefinition} from "@extollo/cli"
|
||
|
import {Injectable} from "@extollo/di"
|
||
|
|
||
|
/**
|
||
|
* ${name} Directive
|
||
|
* ---------------------------------------------------
|
||
|
* Put some description here.
|
||
|
*/
|
||
|
@Injectable()
|
||
|
export class ${name}Directive extends Directive {
|
||
|
getKeywords(): string | string[] {
|
||
|
return ['${name.toLowerCase()}']
|
||
|
}
|
||
|
|
||
|
getDescription(): string {
|
||
|
return ''
|
||
|
}
|
||
|
|
||
|
getOptions(): OptionDefinition[] {
|
||
|
return []
|
||
|
}
|
||
|
|
||
|
async handle(argv: string[]) {
|
||
|
|
||
|
}
|
||
|
}
|
||
|
`
|
||
|
}
|
||
|
}
|
||
|
|
||
|
export { directive_template }
|