@@ -309,25 +309,27 @@ automation
309
309
process . exit ( 0 ) ;
310
310
} ) ;
311
311
312
- programCli
313
- . command ( 'link-readme <subdir> <targetFilename> ' )
312
+ programCli
313
+ . command ( 'link-readme' )
314
314
. description ( 'Symlink a README.adoc into docs/modules/<module>/pages/' )
315
- . action ( ( subdir , targetFilename ) => {
315
+ . requiredOption ( '-s, --subdir <subdir>' , 'Relative path to the lab project subdirectory' )
316
+ . requiredOption ( '-t, --target <filename>' , 'Name of the target AsciiDoc file in pages/' )
317
+ . action ( ( options ) => {
316
318
const repoRoot = findRepoRoot ( ) ;
317
- const normalized = subdir . replace ( / \/ + $ / , '' ) ;
319
+ const normalized = options . subdir . replace ( / \/ + $ / , '' ) ;
318
320
const moduleName = normalized . split ( '/' ) [ 0 ] ;
319
321
320
322
const projectDir = path . join ( repoRoot , normalized ) ;
321
323
const pagesDir = path . join ( repoRoot , 'docs' , 'modules' , moduleName , 'pages' ) ;
322
- const sourceFile = path . join ( repoRoot , normalized , 'README.adoc' ) ;
323
- const destLink = path . join ( pagesDir , targetFilename ) ;
324
+ const sourceFile = path . join ( projectDir , 'README.adoc' ) ;
325
+ const destLink = path . join ( pagesDir , options . target ) ;
324
326
325
327
if ( ! fs . existsSync ( projectDir ) ) {
326
328
console . error ( `❌ Project directory not found: ${ projectDir } ` ) ;
327
329
process . exit ( 1 ) ;
328
330
}
329
331
if ( ! fs . existsSync ( sourceFile ) ) {
330
- console . error ( `❌ README.adoc not found in ${ normalized } ` ) ;
332
+ console . error ( `❌ README.adoc not found in ${ projectDir } ` ) ;
331
333
process . exit ( 1 ) ;
332
334
}
333
335
0 commit comments