Skip to content

Commit a3e7ce9

Browse files
authored
Use options for link-readme CLI command (#102)
1 parent 1ee3652 commit a3e7ce9

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

bin/doc-tools.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -309,25 +309,27 @@ automation
309309
process.exit(0);
310310
});
311311

312-
programCli
313-
.command('link-readme <subdir> <targetFilename>')
312+
programCli
313+
.command('link-readme')
314314
.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) => {
316318
const repoRoot = findRepoRoot();
317-
const normalized = subdir.replace(/\/+$/, '');
319+
const normalized = options.subdir.replace(/\/+$/, '');
318320
const moduleName = normalized.split('/')[0];
319321

320322
const projectDir = path.join(repoRoot, normalized);
321323
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);
324326

325327
if (!fs.existsSync(projectDir)) {
326328
console.error(`❌ Project directory not found: ${projectDir}`);
327329
process.exit(1);
328330
}
329331
if (!fs.existsSync(sourceFile)) {
330-
console.error(`❌ README.adoc not found in ${normalized}`);
332+
console.error(`❌ README.adoc not found in ${projectDir}`);
331333
process.exit(1);
332334
}
333335

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@redpanda-data/docs-extensions-and-macros",
3-
"version": "4.4.1",
3+
"version": "4.4.2",
44
"description": "Antora extensions and macros developed for Redpanda documentation.",
55
"keywords": [
66
"antora",

0 commit comments

Comments
 (0)