Example #1
0
    def do_help(self, line):
        doclines = [_('Red Hat Support assigns a state with all knowledge'
                      ' solutions, which is displayed in the above output.'),
                    '',
                    _('The current states are:')]

        for doc in doclines:
            print doc

        for state in self.state_explanations.keys():
            print '  %s - %s' % (state, self.state_explanations[state])

        common.do_help(self)
 def do_help(self, line):
     if not line:
         # Help can either be the options from the submenu, or
         # a listing of docstrings from the help_???? methods
         if self.help_is_options:
             # Plugin is using the options from _print_submenu as help
             # reset index to 1, and print again.
             self._sub_menu_index = 1
             self._print_submenu()
         else:
             common.do_help(self)
     else:
         cmd.Cmd.do_help(self, line)
Example #3
0
 def do_help(self, line):
     if not line:
         # Help can either be the options from the submenu, or
         # a listing of docstrings from the help_???? methods
         if self.help_is_options:
             # Plugin is using the options from _print_submenu as help
             # reset index to 1, and print again.
             self._sub_menu_index = 1
             self._print_submenu()
         else:
             common.do_help(self)
     else:
         cmd.Cmd.do_help(self, line)
Example #4
0
    def do_help(self, line):
        doclines = [
            _('Red Hat Support assigns a state with all knowledge'
              ' solutions, which is displayed in the above output.'), '',
            _('The current states are:')
        ]

        for doc in doclines:
            print doc

        for state in self.state_explanations.keys():
            print '  %s - %s' % (state, self.state_explanations[state])

        common.do_help(self)
Example #5
0
def main():
    try:
        if len(sys.argv) > 1:
            common.set_interactive(False)
            if str(sys.argv[1]).lower() == '-h' or str(
                    sys.argv[1]).lower() == '--help':
                common.do_help(RHHelp())
                sys.exit(0)
            if str(sys.argv[1]).lower() == '-v' or str(
                    sys.argv[1]).lower() == '--version':
                print 'redhat-support-tool %s' % (version.version)
                sys.exit(0)
            # Compose input string.
            var = u' '.join([unicode(i, 'utf8') for i in sys.argv[1:]])
            if not sys.stdin.isatty():
                # Do we have piped input?
                data = unicode(sys.stdin.read(), 'utf8')
                var = u'%s %s' % (var, data)
                var = var.strip()
            # Set the locale for cases where the user pipes to
            # a file or grep.  Without this 'print' will throw
            # an exception on unicode chars.
            if not sys.stdout.encoding:
                # Encoding will be None when piped to a program/file
                # ex: redhat-support-tool listcases | grep Title
                sys.stdout = codecs.getwriter(locale.getpreferredencoding())(
                    sys.stdout)
            if not sys.stdout.isatty():
                # We are piping to a file.  Disable ANSI bolding.
                Constants.BOLD = ''
                Constants.END = ''
            ret = RHHelp().onecmd(var)
            # Some commands return None, some for some reason return '', if
            # we sys.exit('') though, it'll print a blank line and set $? to
            # 1, so lets work around that.
            if ret is not None and ret is not 0 and ret != '':
                sys.exit(ret)
        else:
            RHHelp().cmdloop()
    except KeyboardInterrupt:
        print
    except Exception, e:
        print e
        print _('ERROR: %s') % e
Example #6
0
def main():
    try:
        if len(sys.argv) > 1:
            common.set_interactive(False)
            if str(sys.argv[1]).lower() == '-h' or str(sys.argv[1]).lower() == '--help':
                common.do_help(RHHelp())
                sys.exit(0)
            if str(sys.argv[1]).lower() == '-v' or str(sys.argv[1]).lower() == '--version':
                print 'redhat-support-tool %s' % (version.version)
                sys.exit(0)
            # Compose input string.
            var = u' '.join([unicode(i, 'utf8') for i in sys.argv[1:]])
            if not sys.stdin.isatty():
                # Do we have piped input?
                data = unicode(sys.stdin.read(), 'utf8')
                var = u'%s %s' % (var, data)
                var = var.strip()
            # Set the locale for cases where the user pipes to
            # a file or grep.  Without this 'print' will throw
            # an exception on unicode chars.
            if not sys.stdout.encoding:
                # Encoding will be None when piped to a program/file
                # ex: redhat-support-tool listcases | grep Title
                sys.stdout = codecs.getwriter(
                                    locale.getpreferredencoding())(sys.stdout)
            if not sys.stdout.isatty():
                # We are piping to a file.  Disable ANSI bolding.
                Constants.BOLD = ''
                Constants.END = ''
            ret = RHHelp().onecmd(var)
            # Some commands return None, some for some reason return '', if
            # we sys.exit('') though, it'll print a blank line and set $? to
            # 1, so lets work around that.
            if ret is not None and ret is not 0 and ret != '':
                sys.exit(ret)
        else:
            RHHelp().cmdloop()
    except KeyboardInterrupt:
        print
    except Exception, e:
        print e
        print _('ERROR: %s') % e
Example #7
0
 def do_help(self, line):
     if line:
         cmd.Cmd.do_help(self, line)
     else:
         common.do_help(self)
Example #8
0
 def do_help(self, line):
     if line:
         cmd.Cmd.do_help(self, line)
     else:
         common.do_help(self)