| 5 | import { formatHelp, formatTopLevelHelp } from './help' |
| 6 | |
| 7 | function makeCmd(opts: { |
| 8 | description?: string |
| 9 | flags?: CommandConstructor['flags'] |
| 10 | args?: CommandConstructor['args'] |
| 11 | examples?: string[] |
| 12 | agentGuide?: string |
| 13 | effect?: CommandConstructor['effect'] |
| 14 | }): CommandConstructor { |
| 15 | class Cmd { |
| 16 | static description = opts.description |
| 17 | static flags = opts.flags ?? {} |
| 18 | static args = opts.args ?? {} |
| 19 | static examples = opts.examples ?? [] |
| 20 | static effect = opts.effect |
| 21 | static agentGuide = opts.agentGuide |
| 22 | |
| 23 | async run(_argv: string[]) {} |
| 24 | |
| 25 | agentGuide(): string { |
| 26 | return opts.agentGuide ?? '' |
| 27 | } |
| 28 | } |
| 29 | return Cmd as unknown as CommandConstructor |
| 30 | } |
| 31 | |
| 32 | describe('formatHelp', () => { |
| 33 | it('includes description when present', () => { |