shell_utils.py 文件源码

python
阅读 31 收藏 0 点赞 0 评论 0

项目:MDT 作者: cbclab 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号