@@ -15,6 +15,7 @@ import {
1515 ensureString ,
1616 JsonMap ,
1717} from '@salesforce/ts-types' ;
18+ import * as ejs from 'ejs' ;
1819import { CommandClass , punctuate } from '../utils' ;
1920import { Ditamap } from './ditamap' ;
2021
@@ -53,11 +54,30 @@ export class Command extends Ditamap {
5354
5455 super ( filename , { } ) ;
5556
57+ for ( const flag of Object . keys ( command . flags ) ) {
58+ if ( command . flags [ flag ] . summary ) {
59+ command . flags [ flag ] . summary = ejs . render ( command . flags [ flag ] . summary , {
60+ command,
61+ config : { bin : commandMeta . binary } ,
62+ } ) ;
63+ }
64+ if ( command . flags [ flag ] . description ) {
65+ command . flags [ flag ] . description = ejs . render ( command . flags [ flag ] . description , {
66+ command,
67+ config : { bin : commandMeta . binary } ,
68+ } ) ;
69+ }
70+ }
71+
5672 this . flags = ensureObject ( command . flags ) ;
5773
58- const summary = punctuate ( asString ( command . summary ) ) ;
74+ const summary = punctuate (
75+ asString ( ejs . render ( command . summary || '' , { command, config : { bin : commandMeta . binary } } ) )
76+ ) ;
5977
60- const description = asString ( command . description ) ;
78+ const description = asString (
79+ ejs . render ( command . description || '' , { command, config : { bin : commandMeta . binary } } )
80+ ) ;
6181
6282 // Help are all the lines after the first line in the description. Before oclif, there was a 'help' property so continue to
6383 // support that.
0 commit comments