コード例 #1
0
 def __discover_help(self, main_help, parser):
     parser.description = main_help
     subparsers = subparser_choices(parser)
     for choice in sorted(subparsers.keys()):
         parser.description += '\n\n -> \x1b[%sm%s\x1b[0m\n%s' % (
             Logger.LEVELS_COLORS[Logger.L_DEBUG],
             choice, wrap_text(subparsers[choice].description))
コード例 #2
0
 def __init__(self, fs:FileUtils=FileUtils(), url: UrlUtils=UrlUtils(), tar_utils = TarUtils(), bamboo_utils: BambooUtils = BambooUtils()):
     super().__init__()
     self.command = 'eh-metrics-investigate'
     self.prevent_post_diagnostics = True
     self.description = wrap_text('Finds the reason for failing engineering health metrics. Should work '
                                  'automatically, comparing the latest result of ./jmake eh-metrics with the '
                                  'latest tagged CI build. You should run this command immediately after failing '
                                  './jmake eh-metrics, and with no parameters. The parameters available to this '
                                  'command are mostly for debug or tricky usages.')
     self.fs = fs
     self.url = url
     self.tar_utils = tar_utils
     self.bamboo_utils = bamboo_utils
コード例 #3
0
 def __init__(self,
              fs: FileUtils = FileUtils(),
              url: UrlUtils = UrlUtils(),
              tar_utils=TarUtils(),
              bamboo_utils: BambooUtils = BambooUtils()):
     super().__init__()
     self.command = 'eh-metrics-investigate'
     self.prevent_post_diagnostics = True
     self.description = wrap_text(
         'Finds the reason for failing engineering health metrics. Should work '
         'automatically, comparing the latest result of ./jmake eh-metrics with the '
         'latest tagged CI build. You should run this command immediately after failing '
         './jmake eh-metrics, and with no parameters. The parameters available to this '
         'command are mostly for debug or tricky usages.')
     self.fs = fs
     self.url = url
     self.tar_utils = tar_utils
     self.bamboo_utils = bamboo_utils
コード例 #4
0
    def __register(self, module, subparsers):
        subParser = subparsers.add_parser(name=module.command, description=module.description)
        subParser.epilog = wrap_text(
            'NOTE: "clean" option can be added to each variant of jmake. It will make all '
            'maven runners add a clean phase additionally. You can decide which maven '
            'command to use by setting JMAKE_MVN_CMD in your environment')

        submodules = module.get_submodules()
        if submodules is not None:
            self.__register_submodules(subParser, submodules)
            format_usage = module.append_format_usage()
            if format_usage is not None:
                usage_text = subParser.format_usage() + "\n" + format_usage + "\n\nError: "
                subParser.format_usage = lambda : usage_text
        else:
            subParser.set_defaults(func=module)
            subParser.add_argument('-s', '--silent', help='turns off notifications', dest='silent', action='store_true')
            subParser.add_argument('--log-level', help='sets logging verbosity of jmake', action='store',
                                   dest='log_level', choices=Logger.get_log_names())
            module.define_parser(subParser)