generated from jCloud/repository-template
Feat(cli): add base command-line interface #16
@@ -50,7 +50,15 @@ def error(message: str, exit_code: int = 1):
|
|||||||
print(f'{_PROGRAM_NAME}: error: {message}', file = sys.stderr)
|
print(f'{_PROGRAM_NAME}: error: {message}', file = sys.stderr)
|
||||||
return exit_code
|
return exit_code
|
||||||
|
|
||||||
def main(argv = None) -> int:
|
def create_argument_parser() -> argparse.ArgumentParser:
|
||||||
|
'''
|
||||||
|
Prepares a parser to parse the command-line arguments using
|
||||||
|
argparse.
|
||||||
|
|
||||||
|
:return: The parser.
|
||||||
|
:rtype: argparse.ArgumentParser
|
||||||
|
'''
|
||||||
|
|
||||||
common_parser = argparse.ArgumentParser(add_help = False)
|
common_parser = argparse.ArgumentParser(add_help = False)
|
||||||
common_parser.add_argument(
|
common_parser.add_argument(
|
||||||
'project_directory',
|
'project_directory',
|
||||||
@@ -103,6 +111,10 @@ def main(argv = None) -> int:
|
|||||||
help = 'indicates whether Markdown tables are allowed in the documentation. By default, Markdown tables are disabled. Warning: Markdown tables are not CommonMark.'
|
help = 'indicates whether Markdown tables are allowed in the documentation. By default, Markdown tables are disabled. Warning: Markdown tables are not CommonMark.'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
return argument_parser
|
||||||
|
|
||||||
|
def main(argv = None) -> int:
|
||||||
|
argument_parser = create_argument_parser()
|
||||||
args = argument_parser.parse_args(argv)
|
args = argument_parser.parse_args(argv)
|
||||||
|
|
||||||
if args.output_dir is None:
|
if args.output_dir is None:
|
||||||
|
|||||||
Reference in new issue
Block a user