generated from jCloud/repository-template
feat(cli): add output directory option
This commit is contained in:
1 file changed
+6
@@ -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
|
||||||
Reference in new issue
Block a user