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.
lib/src/cli/templates/directive.ts

42 lines
933 B

import {Template} from '../Template'
/**
* Template that generates a new Directive class in the app/directives directory.
*/
const templateDirective: Template = {
name: 'directive',
fileSuffix: '.directive.ts',
description: 'Create a new Directive class which adds functionality to the ./ex command.',
baseAppPath: ['directives'],
render(name: string) {
return `import {Directive, OptionDefinition, Injectable} from '@extollo/lib'
/**
* ${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 { templateDirective }