Пример #1
0
        def __call__(self, parser, namespace, values, option_string=None):
            print usage_text.ShortHelpText(command, argument_interceptor)

            if detailed_help:
                sys.stdout.write("""
  To see detailed help, run the following command.
    $ {tool} help {command_path}
  """.format(tool=command.GetPath()[0],
                command_path=' '.join(command.GetPath()[1:])))

            sys.exit(0)
Пример #2
0
  def error(self, message):
    """Override's argparse.ArgumentParser's .error(message) method.

    Specifically, it avoids reprinting the program name and the string "error:".

    Args:
      message: str, The error message to print.
    """
    if self._is_group:
      shorthelp = usage_text.ShortHelpText(
          self._calliope_command, self._calliope_command.ai)
      # pylint:disable=protected-access
      argparse._sys.stderr.write(shorthelp + '\n')
    else:
      self.usage = usage_text.GenerateUsage(
          self._calliope_command, self._calliope_command.ai)
      # pylint:disable=protected-access
      self.print_usage(argparse._sys.stderr)

    log.error('({prog}) {message}'.format(prog=self.prog, message=message))
    self.exit(2)
Пример #3
0
 def GetShortHelp(self):
     return usage_text.ShortHelpText(self, self._ai)
Пример #4
0
 def LongHelp():
     help_func(self._path,
               default=usage_text.ShortHelpText(self, self._ai))
Пример #5
0
 def Func():
     metrics.Help(command.dotted_name, '-h')
     print usage_text.ShortHelpText(command, command.ai)
Пример #6
0
 def Func():
   metrics.Help(command.dotted_name, '--help')
   help_func(
       command.GetPath(),
       default=usage_text.ShortHelpText(command, command.ai))