* Print help for a specific command * @param command Command to print help for
(command: Command)
| 61 | * @param command Command to print help for |
| 62 | */ |
| 63 | function printCommandHelp(command: Command): void { |
| 64 | console.log(`SPARC 2.0 CLI v${VERSION}`); |
| 65 | console.log(`\nCommand: ${command.name}`); |
| 66 | console.log(`\n${command.description}`); |
| 67 | console.log("\nOptions:"); |
| 68 | |
| 69 | for (const option of command.options) { |
| 70 | const shortFlag = option.shortName ? `-${option.shortName}, ` : " "; |
| 71 | const required = option.required ? " (required)" : ""; |
| 72 | const defaultValue = option.default !== undefined ? ` (default: ${option.default})` : ""; |
| 73 | console.log( |
| 74 | ` ${shortFlag}--${option.name.padEnd(15)} ${option.description}${required}${defaultValue}`, |
| 75 | ); |
| 76 | } |
| 77 | } |
| 78 | |
| 79 | /** |
| 80 | * Analyze command action |