lib/src/cli/templates/directive.ts

44 lines
1.0 KiB
TypeScript
Raw Normal View History

2021-06-02 01:59:40 +00:00
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 }