def _get_arg_parser(self, doc_parser=False):
"""Create the auto parser. This should be implemented by the implementing class.
To enable autocomplete in your shell please execute activate-global-python-argcomplete in your shell.
The arg parser should support two output modes, one for the command line (default) and one for generating
the documentation. If the flag doc_parser is true the parser should be generated for the documentation.
Args:
doc_parser (boolean): If true the parser should be prepared for the documentation. If false (the default)
the parser should be generated for the command line.
Returns:
argparse.ArgumentParser: the argument parser
"""
description = textwrap.dedent("""
Basic parser introduction here.
Can be multiline.
""")
epilog = textwrap.dedent("""
Examples of use:
mdt-model-fit "BallStick (Cascade)" data.nii.gz data.prtcl roi_mask_0_50.nii.gz
""")
parser = argparse.ArgumentParser(description=description, epilog=epilog,
formatter_class=argparse.RawTextHelpFormatter)
return parser
评论列表
文章目录