Skip to content

Commit

Permalink
Merge pull request #134 from docsbydoxdox/feature/parser-override-cli
Browse files Browse the repository at this point in the history
[feat] Added new flag for swapping out the parser.
  • Loading branch information
neogeek authored Feb 9, 2022
2 parents 334c673 + 23b10dd commit f10dc78
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ Options:
-n, --name Sets name of project.
-d, --description Sets description of project.
-i, --ignore Comma separated list of paths to ignore.
-l, --parser Parser used to parse the source files with. Defaults to jsdoc.
-r, --renderer Renderer to generate the documentation with. Defaults to Markdown.
-o, --output File to save documentation to. Defaults to stdout.
-p, --package Sets location of package.json file.
Expand Down
6 changes: 5 additions & 1 deletion packages/doxdox-cli/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ Options:
-n, --name Sets name of project.
-d, --description Sets description of project.
-i, --ignore Comma separated list of paths to ignore.
-l, --parser Parser used to parse the source files with. Defaults to jsdoc.
-r, --renderer Renderer to generate the documentation with. Defaults to Markdown.
-o, --output File to save documentation to. Defaults to stdout.
-p, --package Sets location of package.json file.
Expand All @@ -61,6 +62,9 @@ const overrideDescription = String(
args.flags['-d'] || args.flags['--description'] || ''
);
const overrideIgnore = String(args.flags['-i'] || args.flags['--ignore'] || '');
const overrideParser = String(
args.flags['-l'] || args.flags['--parser'] || 'jsdoc'
);
const overrideRenderer = String(
args.flags['-r'] || args.flags['--renderer'] || 'markdown'
);
Expand Down Expand Up @@ -115,7 +119,7 @@ const overridePackage = String(

const loadedParser = await loadPlugin<
(cwd: string, path: string) => Promise<File>
>(nodeModulesDir, 'doxdox-parser-', 'jsdoc');
>(nodeModulesDir, 'doxdox-parser-', overrideParser.toLowerCase());

const loadedRenderer = await loadPlugin<(doc: Doc) => Promise<string>>(
nodeModulesDir,
Expand Down

0 comments on commit f10dc78

Please sign in to comment.