| 49 | } |
| 50 | |
| 51 | class ProgramImpl implements IInternalProgram { |
| 52 | version(version: string): this { |
| 53 | _program.version(version); |
| 54 | return this; |
| 55 | } |
| 56 | description(desc: string): this { |
| 57 | _program.description(desc); |
| 58 | return this; |
| 59 | } |
| 60 | help(help: string, options?: IHelpOptions): this { |
| 61 | _program.help(help, options); |
| 62 | return this; |
| 63 | } |
| 64 | section(_name: string, _icon: string): this { |
| 65 | const icon = _icon + (PAD_EMOJI.has(_icon) ? ' ' : ''); |
| 66 | const name = _name.toUpperCase(); |
| 67 | const line = ''.padEnd(50 - name.length - 1, '─'); |
| 68 | _program.command('', `\n\n${icon} ${name} ${line}`); |
| 69 | return this; |
| 70 | } |
| 71 | command(name: string, desc: string): ICommand { |
| 72 | return new CommandImpl(_program, name, desc); |
| 73 | } |
| 74 | option<T>(name: string, desc: string, options: IProgramOptions<T>): this { |
| 75 | // biome-ignore lint/suspicious/noExplicitAny: TODO |
| 76 | _program.option(name, desc, { global: true, ...options } as any); |
| 77 | return this; |
| 78 | } |
| 79 | disableGlobalOption(name: string): this { |
| 80 | _program.disableGlobalOption(name); |
| 81 | return this; |
| 82 | } |
| 83 | run(): this { |
| 84 | _program.run(); |
| 85 | return this; |
| 86 | } |
| 87 | async exec(args: unknown[], options?: IExecOptions): Promise<void> { |
| 88 | // biome-ignore lint/suspicious/noExplicitAny: TODO |
| 89 | await _program.exec(args as any, options as any); |
| 90 | } |
| 91 | } |
| 92 | |
| 93 | /********************************************************************************************** |
| 94 | * Command. |
nothing calls this directly
no outgoing calls
no test coverage detected