feat(cli): add output directory option

This commit is contained in:
jakob.scheid committed 2026-09-05 20:38:58 +02:00
1 parent 436dacf806
commit 2d6de2028f
1 file changed
+6
+6
View File
@@ -30,9 +30,15 @@ def existing_directory(path: str) -> pathlib.Path:
raise argparse.ArgumentTypeError(f'{_path}: no such file or directory') raise argparse.ArgumentTypeError(f'{_path}: no such file or directory')
if not path.is_dir(): if not path.is_dir():
raise argparse.ArgumentTypeError(f'{_path}: not a directory') raise argparse.ArgumentTypeError(f'{_path}: not a directory')
return path
def main() -> int: def main() -> int:
argument_parser = argparse.ArgumentParser() argument_parser = argparse.ArgumentParser()
argument_parser.add_argument('project_directory', type = existing_directory, nargs = '?', default = pathlib.Path('.'), help = 'The directory of the project') argument_parser.add_argument('project_directory', type = existing_directory, nargs = '?', default = pathlib.Path('.'), help = 'The directory of the project')
argument_parser.add_argument('-o', '--output-dir', type = pathlib.Path, help = 'the output directory the documentation will be written to')
args = argument_parser.parse_args() args = argument_parser.parse_args()
if args.output_dir is None:
args.output_dir = args.project_directory / 'docs/reference'
return 0 return 0