(context: CliContext)
| 16 | |
| 17 | const require = createRequire(import.meta.url); |
| 18 | const packageJson = require('../package.json') as { version: string }; |
| 19 | |
| 20 | export function createProgram(context: CliContext): Command { |
| 21 | const program = new Command(); |
| 22 | |
| 23 | program |
| 24 | .name('mslearn') |
| 25 | .description('CLI for the Microsoft Learn MCP server.') |
| 26 | .version(context.version) |
| 27 | .addOption(new Option('--endpoint <url>', 'Override the Learn MCP endpoint for this command.').hideHelp()) |
| 28 | .showHelpAfterError() |
| 29 | .configureOutput({ |
| 30 | writeOut: context.writeOut, |
| 31 | writeErr: context.writeErr, |
| 32 | outputError: (value, write) => { |
| 33 | write(value); |
| 34 | }, |
| 35 | }); |
| 36 | |
| 37 | registerSearchCommand(program, context); |
| 38 | registerFetchCommand(program, context); |
| 39 | registerCodeSearchCommand(program, context); |
| 40 | registerDoctorCommand(program, context); |
| 41 | registerSetupCommand(program, context); |
| 42 | registerRemoveCommand(program, context); |
| 43 | |
| 44 | return program; |
no test coverage detected