(options: Options)
| 11 | * CLI action for formatting a ZModel schema file. |
| 12 | */ |
| 13 | export async function run(options: Options) { |
| 14 | const schemaFile = getSchemaFile(options.schema); |
| 15 | let formattedContent: string; |
| 16 | |
| 17 | try { |
| 18 | formattedContent = await formatDocument(fs.readFileSync(schemaFile, 'utf-8')); |
| 19 | } catch (error) { |
| 20 | console.error(colors.red('✗ Schema formatting failed.')); |
| 21 | // Re-throw to maintain CLI exit code behavior |
| 22 | throw error; |
| 23 | } |
| 24 | |
| 25 | fs.writeFileSync(schemaFile, formattedContent, 'utf-8'); |
| 26 | console.log(colors.green('✓ Schema formatting completed successfully.')); |
| 27 | } |
nothing calls this directly
no test coverage detected