当前位置: 首页>>代码示例>>Python>>正文


Python BuildManPage.ManPageFormatter类代码示例

本文整理汇总了Python中coalib.misc.BuildManPage.ManPageFormatter的典型用法代码示例。如果您正苦于以下问题:Python ManPageFormatter类的具体用法?Python ManPageFormatter怎么用?Python ManPageFormatter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ManPageFormatter类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_mk_footer

 def test_mk_footer(self):
     uut = ManPageFormatter(app_name, ext_sections=sections)
     self.assertEqual(uut._mk_footer(),
                      ".SH {0}\n"
                      " {1}".format(section_name.upper(), section_text))
     uut = ManPageFormatter(app_name, ext_sections=None)
     self.assertEqual(uut._mk_footer(), "")
开发者ID:VCTLabs,项目名称:coala,代码行数:7,代码来源:BuildManPageTest.py

示例2: test_formatter

    def test_formatter(self):
        parser = test_arg_parser(ManPageFormatter)
        self.assertEqual(
            parser.format_help(),
            "usage: {0} [-h] [-a A] arg1\n\n{1}\n\n"
            "positional arguments:\n"
            "  arg1\n\n"
            "optional arguments:\n"
            "  \\fB-h\\fR, \\fB--help\\fR\n"
            "                        show this help message and exit\n"
            "  \\fB-a\\fR \\fIA\\fR\n"
            .format(app_name, app_description))

        parser = ManPageFormatter(app_name,
                                  parser=argparse.ArgumentParser(prog=app_name))
        today = datetime.date.today().strftime('%Y\\-%m\\-%d')
        self.assertEqual(parser.format_man_page(),
                         ".TH {0} 1 {1}\n"
                         ".SH NAME\n"
                         "{0}\n"
                         ".SH SYNOPSIS\n"
                         " \\fBname\\fR [-h]\n\n\n"
                         ".SH OPTIONS\n"
                         "  -h, --help  show this help message and exit\n"
                         .format(app_name, today))
开发者ID:VCTLabs,项目名称:coala,代码行数:25,代码来源:BuildManPageTest.py

示例3: test_format_functions

 def test_format_functions(self):
     uut = ManPageFormatter(app_name)
     self.assertEqual(ManPageFormatter._markup("a-b"), "a\\-b")
     self.assertEqual(ManPageFormatter._underline("test"), "\\fItest\\fR")
     self.assertEqual(ManPageFormatter._bold("test"), "\\fBtest\\fR")
     self.assertEqual(ManPageFormatter._bold("\\fBtest"), "\\fBtest\\fR")
     self.assertEqual(ManPageFormatter._bold("test\\fR"), "\\fBtest\\fR")
开发者ID:VCTLabs,项目名称:coala,代码行数:7,代码来源:BuildManPageTest.py

示例4: test_mk_options

 def test_mk_options(self):
     uut = ManPageFormatter(app_name, parser=test_arg_parser())
     self.assertEqual(uut._mk_options(),
                      ".SH OPTIONS\n"
                      "  arg1\n\n"
                      "  -h, --help  show this help message and exit\n"
                      "  -a A\n")
开发者ID:VCTLabs,项目名称:coala,代码行数:7,代码来源:BuildManPageTest.py

示例5: test_mk_description

 def test_mk_description(self):
     uut = ManPageFormatter(app_name,
                            parser=test_arg_parser())
     self.assertEqual(uut._mk_description(), "")
     uut = ManPageFormatter(app_name,
                            parser=test_arg_parser(),
                            long_desc=app_long_description)
     self.assertEqual(uut._mk_description(),
         ".SH DESCRIPTION\n{}\n".format(app_long_description))
开发者ID:VCTLabs,项目名称:coala,代码行数:9,代码来源:BuildManPageTest.py

示例6: test_mk_synopsis

 def test_mk_synopsis(self):
     uut = ManPageFormatter(app_name, parser=test_arg_parser())
     self.assertEqual(
         uut._mk_synopsis(),
         ".SH SYNOPSIS\n \\fB{}\\fR [-h] [-a A] arg1\n\n\n".format(app_name))
开发者ID:VCTLabs,项目名称:coala,代码行数:5,代码来源:BuildManPageTest.py

示例7: test_mk_name

 def test_mk_name(self):
     uut = ManPageFormatter(app_name, parser=test_arg_parser())
     self.assertEqual(uut._mk_name(),
                      ".SH NAME\n{}\n".format(app_name))
开发者ID:VCTLabs,项目名称:coala,代码行数:4,代码来源:BuildManPageTest.py

示例8: test_mk_title

 def test_mk_title(self):
     uut = ManPageFormatter(app_name, parser=test_arg_parser())
     today = datetime.date.today().strftime('%Y\\-%m\\-%d')
     self.assertEqual(uut._mk_title(),
                      '.TH {0} {1} {2}\n'.format(app_name, 1, today))
开发者ID:VCTLabs,项目名称:coala,代码行数:5,代码来源:BuildManPageTest.py

示例9: test_format_functions

 def test_format_functions(self):
     self.assertEqual(ManPageFormatter._markup('a-b'), 'a\\-b')
     self.assertEqual(ManPageFormatter._underline('test'), '\\fItest\\fR')
     self.assertEqual(ManPageFormatter._bold('test'), '\\fBtest\\fR')
     self.assertEqual(ManPageFormatter._bold('\\fBtest'), '\\fBtest\\fR')
     self.assertEqual(ManPageFormatter._bold('test\\fR'), '\\fBtest\\fR')
开发者ID:Anmolbansal1,项目名称:coala,代码行数:6,代码来源:BuildManPageTest.py


注:本文中的coalib.misc.BuildManPage.ManPageFormatter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。