コード例 #1
0
ファイル: parsedcmd.py プロジェクト: aeternocap/parsedcmd
 def do_help(self, cmd=None):
     Cmd.do_help(self, cmd)
     if not cmd or not self.show_usage:
         return
     do_ = getattr(self, "do_" + cmd, None)
     if not do_ or hasattr(self, "help_ " + cmd):
         return
     while (hasattr(do_, "__wrapped__") and
            not getattr(do_, USE_MY_ANNOTATIONS, None)):
         do_ = do_.__wrapped__
     if getattr(do_, GETS_RAW, None):
         return
     spec = getfullargspec(do_)
     args, varargs, varkw, defaults, kwonlyargs, kwonlydefaults, ann = spec
     non_kw_args = args[:-len(defaults)] if defaults else args
     kw_args = args[-len(defaults):] if defaults else []
     if not defaults:
         defaults = []
     if not kwonlydefaults:
         kwonlydefaults = {}
     helpstr = "\t" + cmd
     for arg, default in kwonlydefaults.items():
         helpstr += " [-{0} {1}(={2})]".format(arg, arg[0].upper(), default)
     for arg, default in zip(kw_args, defaults):
         helpstr += " [{0}(={1})]".format(arg.upper(), default)
     for arg in non_kw_args[1:]:
         helpstr += " {0}".format(arg.upper())
     if varargs:
         helpstr += " [{0}]".format(varargs.upper())
     self.stdout.write(helpstr + "\n")
コード例 #2
0
ファイル: console.py プロジェクト: dguan4/Airline
 def do_help(self, args):
     """
     Gets help for a certain command
     :param args: Any input you need help with
     :return: Documented comments about the command
     """
     Cmd.do_help(self, args)
コード例 #3
0
 def do_help(self, args):
     """Get help on commands
        'help' or '?' with no arguments prints a list of commands for which help is available
        'help <command>' or '? <command>' gives help on <command>
     """
     # The only reason to define this method is for the help text in the doc string
     Cmd.do_help(self, args)
コード例 #4
0
 def do_help(self, line):
     """
     Describe available CLI commands.
     """
     Cmd.do_help(self, line)
     if line is '':
         output(self.helpStr)
コード例 #5
0
    def do_help(self, arg):
        if arg:
            Cmd.do_help(self, arg)
        else:
            self.say("")
            headerString = "These are valid commands for Jarvis"
            formatString = "Format: command ([aliases for command])"
            self.say(headerString)
            self.say(formatString, Fore.BLUE)
            pluginDict = self._plugin_manager.get_plugins()
            uniquePlugins = {}
            for key in pluginDict.keys():
                plugin = pluginDict[key]
                if(plugin not in uniquePlugins.keys()):
                    uniquePlugins[plugin.get_name()] = plugin
            helpOutput = []
            for name in sorted(uniquePlugins.keys()):
                if (name == "help"):
                    continue
                try:
                    aliasString = ", ".join(uniquePlugins[name].alias())
                    if (aliasString != ""):
                        pluginOutput = "* " + name + " (" + aliasString + ")"
                        helpOutput.append(pluginOutput)
                    else:
                        helpOutput.append("* " + name)
                except AttributeError:
                    helpOutput.append("* " + name)

            Cmd.columnize(self, helpOutput)
コード例 #6
0
 def do_help(self, args):
     """
        Getting help on "help" is kinda silly dont you think?
     """
     #The only reason to define this method is for the help text in the
     #docstring
     Cmd.do_help(self, args)
コード例 #7
0
ファイル: serial_snoop.py プロジェクト: Xipiter/MiscTools
 def do_help(self, args):
     """
        Getting help on "help" is kinda silly dont you think?
     """
     #The only reason to define this method is for the help text in the
     #docstring
     Cmd.do_help(self, args)
コード例 #8
0
ファイル: battleman.py プロジェクト: annabunches/4etools
 def do_help(self, arg):
     if arg:
         Cmd.do_help(self, arg)
     else:
         # Everything from here to the end is lifted straight
         # out of cmd.Cmd.do_help()
         names = self.get_names()
         cmds_doc = []
         cmds_undoc = []
         help = {}
         for name in names:
             if name[:5] == 'help_':
                 help[name[5:]]=1
         names.sort()
         # There can be duplicates if routines overridden
         prevname = ''
         for name in names:
             if name[:3] == 'do_':
                 if name == prevname:
                     continue
                 prevname = name
                 cmd=name[3:]
                 if cmd in help:
                     cmds_doc.append(cmd)
                     del help[cmd]
                 elif getattr(self, name).__doc__:
                     cmds_doc.append(cmd)
                 else:
                     cmds_undoc.append(cmd)
         self.stdout.write("%s\n"%str(self.doc_leader))
         self.print_topics(self.doc_header,   cmds_doc,   15,80)
         self.print_topics(self.misc_header,  help.keys(),15,80)
コード例 #9
0
ファイル: cli.py プロジェクト: cyclefusion/easyOVS
 def do_help(self, line):
     """
     Describe available CLI commands.
     """
     Cmd.do_help(self, line)
     if line is "":
         output(self.helpStr)
コード例 #10
0
ファイル: cmd.py プロジェクト: diffeo/yakonfig
    def do_help(self, args):
        '''print help on a command'''
        if args.command:
            f = getattr(self, 'help_' + args.command, None)
            if f:
                f()
                return

            f = getattr(self, 'do_' + args.command, None)
            if not f:
                msg = self.nohelp % (args.command,)
                self.stdout.write('{0}\n'.format(msg))
                return

            docstr = getattr(f, '__doc__', None)
            f = getattr(self, 'args_' + args.command, None)
            if f:
                parser = argparse.ArgumentParser(
                    prog=args.command,
                    description=docstr)
                f(parser)
                parser.print_help(file=self.stdout)
            else:
                if not docstr:
                    docstr = self.nohelp % (args.command,)
                self.stdout.write('{0}\n'.format(docstr))
        else:
            Cmd.do_help(self, '')
コード例 #11
0
ファイル: badocker.py プロジェクト: banuchka/badocker_cmd
 def do_help(self, args):
     """Get help on commands
        'help' or '?' with no arguments prints a list of commands for which help is available
        'help <command>' or '? <command>' gives help on <command>
     """
     ## The only reason to define this method is for the help text in the doc string
     Cmd.do_help(self, args)
コード例 #12
0
    def do_help(self, args):
        """Override the help command to handle cases of command arguments.
        
        General help is provided by help_*() methods."""
        if len(args.split()) < 2:
            Cmd.do_help(self, args)
        else:
            if args == 'talk show':
                print Help.TALK_SHOW_TALKS
            elif args == 'talk show events':
                print Help.TALK_SHOW_EVENTS
	    elif args == 'talk remove':
		print Help.TALK_REMOVE
	    elif args == 'talk add':
		print Help.TALK_ADD
	    elif args == 'talk update':
		print Help.TALK_UPDATE
	    elif args == 'config show':
		print Help.CONFIG_SHOW
	    elif args == 'config set audio':
		print Help.CONFIG_SET_AUDIO
	    elif args == 'config set video':
		print Help.CONFIG_VIDEO_SET
	    elif args == 'config set video resolution':
		print Help.CONFIG_VIDEO_RESOLUTION_SET
	    elif args == 'config set dir':
		print Help.CONFIG_DIR_SET
	    elif args == 'config set streaming':
		print Help.CONFIG_SET_STREAMING
	    elif args == 'config set file':
		print Help.CONFIG_SET_FILE
	    elif args == 'config set':
		print Help.CONFIG_SET
            else:
                print 'Unknown %s topic' % (args)
コード例 #13
0
 def do_help(self, arg):
     if arg: Cmd.do_help(self, arg)
     else:
         print "Available commands:",
         print ", ".join([
             name[3:] for name in dir(self)
             if name.startswith('do_') and getattr(self, name).__doc__
         ])
         print "Use 'help <command>' for details."
コード例 #14
0
ファイル: cli.py プロジェクト: stevelorenz/comnetsemu
    def do_help(self, line):
        "Describe available CLI commands."
        Cmd.do_help(self, line)

        if line == "":
            output("\n*** Mininet CLI usage:\n")
            output(super(CLI, self).helpStr)

            output("*** ComNetsEmu CLI usage:\n")
            output(self.helpStr)
コード例 #15
0
ファイル: repo.py プロジェクト: prashanthellina/procodile
    def do_help(self, args):

        if args == '':
            Cmd.do_help(self, args)

        else:
            if 'do_%s' % args in dir(self):
                code = 'doc_string = self.do_%s.__doc__' % args
                exec(code)
                print doc_string
コード例 #16
0
ファイル: miniterm.py プロジェクト: zoroas/uArmClient
 def do_help(self, arg):
     values = arg.split(' ')
     if len(values) == 1 and values[0] == '':
         help_title = Style.BRIGHT + Fore.MAGENTA + "uArm Command line Help Center" + Fore.RESET + Style.RESET_ALL
         help_title += "\n\n"
         help_title += "Please use {}{}connect{}{} before any control action".format(Back.BLACK, Fore.WHITE, Fore.RESET, Back.RESET)
         help_title += "\n"
         help_title += self.help_msg
         print (help_title)
     # print (self.help_msg)
     Cmd.do_help(self,arg)
コード例 #17
0
ファイル: miniterm.py プロジェクト: uArm-Developer/pyuarm
 def do_help(self, arg):
     values = arg.split(' ')
     if len(values) == 1 and values[0] == '':
         help_title = Style.BRIGHT + Fore.MAGENTA + "uArm Command line Help Center" + Fore.RESET + Style.RESET_ALL
         help_title += "\n\n"
         help_title += "Please use {}{}connect{}{} before any control action".format(Back.BLACK, Fore.WHITE, Fore.RESET, Back.RESET)
         help_title += "\n"
         help_title += self.help_msg
         print (help_title)
     # print (self.help_msg)
     Cmd.do_help(self,arg)
コード例 #18
0
    def do_help(self, args):
        '''
        Get help on command

        \'help\' or \'?\' with no arguments prints a list of commands for
        which help is available \'help <command>\' or \'? <command>\' gives
        help on <command>
        '''
        # The only reason to define this method is for the help text in
        # the doc string
        Cmd.do_help(self, args)
コード例 #19
0
ファイル: miniterm.py プロジェクト: xknxknqq/pyuarm
 def do_help(self, arg):
     values = arg.split(' ')
     if len(values) == 1 and values[0] == '':
         help_title = "uArm Command line Help Center"
         help_title += "\n\n"
         help_title += "Please use connect before any control action"
         help_title += "\n"
         help_title += self.help_msg
         print (help_title)
     # print (self.help_msg)
     Cmd.do_help(self,arg)
コード例 #20
0
 def do_help(self, arg):
     """Print help topic"""
     argv = arg.split()
     if argv and argv[0] in ['set']:
         # Provide extended help
         help_def = getattr(self, "help_" + argv[0])
         if help_def:
             help_def(' '.join(argv[1:]))
         else:
             Cmd.do_help(self, arg)
     else:
         Cmd.do_help(self, arg)
コード例 #21
0
    def do_help(self, string=''):
        if '' != string:
            logd('help for %s' % string)

        if (string.upper() in self._cmd_dict.keys()):
            print('\t%s' % self._cmd_dict[string.upper()])

        elif (string.lower() in self._cmd_dict.keys()):
            print('\t%s' % self._cmd_dict[string.lower()])

        else:
            Cmd.do_help(self, string)
コード例 #22
0
ファイル: pynicom.py プロジェクト: guyt101z/pynicom
    def do_help(self, string = ''):
        if '' != string:
            logd('help for %s' % string)

        if (string.upper() in self._cmd_dict.keys()):
            print('\t%s' % self._cmd_dict [string.upper()])

        elif (string.lower() in self._cmd_dict.keys()):
            print('\t%s' % self._cmd_dict [string.lower()])

        else:
            Cmd.do_help(self, string)
コード例 #23
0
ファイル: cli.py プロジェクト: chutzimir/kedpm
 def do_help(self, arg):
     """Print help topic"""
     argv = arg.split()
     if argv and argv[0] in ['set']:
         # Provide extended help
         help_def = getattr(self, "help_"+argv[0])
         if help_def:
             help_def(' '.join(argv[1:]))
         else:
             Cmd.do_help(self, arg)
     else:
         Cmd.do_help(self, arg)
コード例 #24
0
ファイル: mycmd.py プロジェクト: Oliver2213/TTCom
    def do_help(self, line):
        """Print help for the program or its commands.
		"""
        if not line.strip() or len(line.split()) != 1:
            return Cmd.do_help(self, line)
        matches = filter(lambda a: a.lower() == "do_" + line.lower().strip(),
                         dir(self))
        if len(matches) != 1:
            return Cmd.do_help(self, line)
        try:
            txt = eval("self." + matches[0]).__doc__
        except AttributeError:
            return Cmd.do_help(self, line)
        self.msg(self._formatHelp(txt))
コード例 #25
0
ファイル: main.py プロジェクト: kotenev/yokadi
 def do_help(self, arg):
     """Type help <topic> to see the help for a given topic"""
     """
     Overload do_help to show help from the command parser if it exists:
     if there is a parser_foo() method, assume this method returns a
     YokadiOptionParser for the do_foo() method and show the help of the
     parser, instead of do_foo() docstring.
     """
     if arg in self.aliases:
         # If arg is an alias, get help on the underlying command
         arg = self.aliases[arg].split()[0]
     if hasattr(self, "parser_" + arg):
         parserMethod = getattr(self, "parser_" + arg)
         parserMethod().print_help(sys.stderr)
     else:
         print("Usage: ", end=' ')
         Cmd.do_help(self, arg)
コード例 #26
0
    def do_help(self, s):
        """Help introduction message"""
        if s != "":
            Cmd.do_help(self, s)
            return

        print(
            "\nYour login information will be retained for the duration of this session"
        )
        print("Possible shell commands include:\n")

        for name, descript in list(self.subcommand_desc.items()):
            print("\t%-20s" % (name) + descript)
        print("\n\t%-20s" % ("exit") +
              "Exit the interpreter, and end this session")
        print(
            "\nHelp commands take the form of either:\n help reg || ? reg || reg -h || reg --help"
        )
コード例 #27
0
ファイル: main.py プロジェクト: agateau/yokadi
    def do_help(self, arg):
        """Type help <topic> to see the help for a given topic"""

        """
        Overload do_help to show help from the command parser if it exists:
        if there is a parser_foo() method, assume this method returns a
        YokadiOptionParser for the do_foo() method and show the help of the
        parser, instead of do_foo() docstring.
        """
        if arg in self.aliases:
            # If arg is an alias, get help on the underlying command
            arg = self.aliases[arg].split()[0]
        if hasattr(self, "parser_" + arg):
            parserMethod = getattr(self, "parser_" + arg)
            parserMethod().print_help(sys.stderr)
        else:
            print("Usage: ", end=' ')
            Cmd.do_help(self, arg)
コード例 #28
0
ファイル: console.py プロジェクト: nag90/dust
    def do_help(self, args):
        '''
        help [cmd] - Show help on command cmd. 
        Modified from base class.
        '''

        commands = self.cluster.get_commands()

        if args:
            if args in commands:
                docstr, _ = commands.get(args)
                print docstr
                return
            return Cmd.do_help(self, args)

        print self.dustintro
        print "\nAvailable commands:\n"

        # generate help summary from docstrings

        names = dir(self.__class__)
        prevname = ""
        for name in names:
            if name[:3] == 'do_':
                if name == prevname:
                    continue
                cmd = name[3:]
                docstr = ""
                if getattr(self, name):
                    docstr = getattr(self, name).__doc__
                self._print_cmd_help(docstr, cmd)

        # show help from drop-in commands
        modcommands = defaultdict(list)
        for cmd, (docstr, mod) in commands.items():
            modcommands[mod].append( (cmd, docstr) )

        for mod, cmds in modcommands.iteritems():
            print "\n== From %s:" % mod.__name__
            for (cmd, docstr) in cmds: 
                self._print_cmd_help(docstr, cmd)

        print '\nType help [command] for detailed help on a command'

        print '\nFor most commands, [target] can be a node name, regular expression, or filter expression'
        print 'A node "name" in these commands is the Name tag in the cloud node metadata or in the cluster definition.'
        print '\n'
コード例 #29
0
    def do_help(self, line):
        """I think you know what this does."""
        # this works around a misfeature in cmd.py
        # getdoc is better at docs than the raw (cleans them up)
        line = line.strip()
        try:
            if line and not getattr(self, 'help_' + line, None):
                from pydoc import getdoc
                docs = getdoc(getattr(self, 'do_' + line))
                if not docs:
                    docs = '(to be documented)'
                self.stdout.write("%s: %s\n" %
                                  (ansi.BOLD + line + ansi.RESET, str(docs)))
                return
        except:
            pass

        return Cmd.do_help(self, line)
コード例 #30
0
    def do_help(self, line):
        """I think you know what this does."""
        # this works around a misfeature in cmd.py
        # getdoc is better at docs than the raw (cleans them up)
        line = line.strip()
        try:
            if line and not getattr(self, 'help_' + line, None):
                from pydoc import getdoc
                docs = getdoc(getattr(self, 'do_' + line))
                if not docs:
                    docs = '(to be documented)'
                self.stdout.write("%s: %s\n" % (ansi.BOLD + line + ansi.RESET,
                                                str(docs)))
                return
        except:
            pass

        return Cmd.do_help(self, line)
コード例 #31
0
    def do_help(self, arg):
        '''List available commands with 'help' or detailed help with
        'help cmd'.

        '''
        if not arg:
            return Cmd.do_help(self, arg)
        arg = arg.replace('-', '_')
        try:
            doc = getattr(self, 'do_' + arg).__doc__
            if doc:
                doc = doc.format(command=arg)
                self.stdout.write('%s\n' % trim(str(doc)))
                return
        except AttributeError:
            pass
        self.stdout.write('%s\n' % str(self.nohelp % (arg, )))
        return
コード例 #32
0
    def do_help(self, line):
        if line:
            return Cmd.do_help(self, line)

        self.basecmds.sort()
        self.vprint('\nbasics:')

        for line in formatargs(self.basecmds):
            self.vprint(line)

        subsys = self.extsubsys.keys()
        subsys.sort()

        for sub in subsys:
            self.vprint('\n%s:' % sub)
            cmds = self.extsubsys.get(sub)
            cmds.sort()
            for line in formatargs(cmds):
                self.vprint(line)

        self.vprint('\n')
コード例 #33
0
ファイル: cli.py プロジェクト: bat-serjo/vivisect
    def do_help(self, line):
        if line:
            return Cmd.do_help(self, line)

        self.basecmds.sort()
        self.vprint('\nbasics:')

        # self.vprint( self.columnize( self.basecmds ) )
        self.columnize(self.basecmds)

        subsys = list(self.extsubsys.keys())
        subsys.sort()

        for sub in subsys:
            self.vprint('\n%s:' % sub)

            cmds = self.extsubsys.get(sub)
            cmds.sort()

            self.columnize(cmds)

        self.vprint('\n')
コード例 #34
0
ファイル: cli.py プロジェクト: wflk/vivisect
    def do_help(self, line):
        if line:
            return Cmd.do_help(self, line)

        self.basecmds.sort()
        self.vprint('\nbasics:')

        #self.vprint( self.columnize( self.basecmds ) )
        self.columnize(self.basecmds)

        subsys = self.extsubsys.keys()
        subsys.sort()

        for sub in subsys:
            self.vprint('\n%s:' % sub)

            cmds = self.extsubsys.get(sub)
            cmds.sort()

            self.columnize(cmds)

        self.vprint('\n')
コード例 #35
0
ファイル: secsmash.py プロジェクト: tevora-threat/SecSmash
 def do_options(self, line):
     """\tDisplays the help menu\n"""
     Cmd.do_help(self, line)
コード例 #36
0
ファイル: cli.py プロジェクト: IxLabs/vlab
 def do_help(self, line):
     """Describe available CLI commands."""
     Cmd.do_help(self, line)
     if line is '':
         print(self.help_str)
コード例 #37
0
 def do_help(self, line):
     """Get help on commands.
     'help' or '?' with no arguments prints a list of commands for which help is available
     'help <command>' or '? <command>' gives help on <command>
     """
     Cmd.do_help(self, line)
コード例 #38
0
	def do_help(self,arg):
		"""
		output help of command
		"""
		Cmd.do_help(self,arg)
コード例 #39
0
ファイル: cli.py プロジェクト: chutzimir/kedpm
 def do_help(self, arg):
     '''Print help message'''
     Cmd.do_help(self, arg)
コード例 #40
0
ファイル: cli.py プロジェクト: zlorb/containernet
 def do_help(self, line):  # pylint: disable=arguments-differ
     "Describe available CLI commands."
     Cmd.do_help(self, line)
     if line == '':
         output(self.helpStr)
コード例 #41
0
ファイル: __init__.py プロジェクト: FernFerret/tfcon
 def do_systemhelp(self, arg):
     return Cmd.do_help(self, arg)
コード例 #42
0
ファイル: __init__.py プロジェクト: FernFerret/tfcon
 def do_help(self, arg):
     if self._current_server:
         print self.rcon("help " + arg)
     else:
         return Cmd.do_help(self, arg)
コード例 #43
0
 def do_help(self, *args):
     "Display help\nhelp [command]"
     return Cmd.do_help(self, *args)
コード例 #44
0
ファイル: cli.py プロジェクト: gyepisam/kedpm
 def do_help(self, arg):
     """Print help message"""
     Cmd.do_help(self, arg)
コード例 #45
0
 def do_help(self, arg):
     '''Print help message'''
     Cmd.do_help(self, arg)
コード例 #46
0
ファイル: cli.py プロジェクト: NougatRillettes/mn-ccnx
    def do_help( self, line ):
        "Describe available CLI commands."
	#pdb.set_trace()
        Cmd.do_help( self, line )
        if line is '':
            output( self.helpStr )
コード例 #47
0
ファイル: traccmd.py プロジェクト: nyuhuhuu/trachacks
 def do_help(self, arg):
     """A version of help that deals with the array args"""
     return Cmd.do_help(self, " ".join(arg))
コード例 #48
0
ファイル: secsmash.py プロジェクト: tevora-threat/SecSmash
 def do_help(self, *args):
     """\tDisplays the help menu\n"""
     Cmd.do_help(self, *args)
コード例 #49
0
 def do_help(self, args):
     """Get help on commands"""
     Cmd.do_help(self, args)
コード例 #50
0
ファイル: console.py プロジェクト: aftab90/py-web-graph
	def do_help( self, arg ):
		if arg:	Cmd.do_help( self, arg )
		else:
			print "Available commands:",
			print ", ".join( [ name[ 3 : ] for name in dir( self )	if name.startswith( 'do_' ) and getattr( self, name ).__doc__ ] )
			print "Use 'help <command>' for details."
コード例 #51
0
ファイル: cli.py プロジェクト: heitorgo1/myfog
 def do_help(self, s):
     "Print help"
     Cmd.do_help(self, s)
     if s is "":
         print self.helpStr
コード例 #52
0
 def do_help(self, arg):
     """A version of help that deals with the array args"""
     return Cmd.do_help(self, " ".join(arg))
コード例 #53
0
 def do_help( self, line ):
     "Describe available CLI commands."
     Cmd.do_help( self, line )
     if line is '':
         output( self.helpStr )
     self.not_implemented()
コード例 #54
0
ファイル: ratone.py プロジェクト: woo0/ratone
 def do_help(self, arg):
     if arg in self.aliases:
         arg = self.aliases[arg].__name__[3:]
     Cmd.do_help(self, arg)
コード例 #55
0
ファイル: cli.py プロジェクト: Jasminexsh/p4-learning
 def do_help(self, line):
     "Describe available CLI commands."
     Cmd.do_help(self, line)
     if line == '':
         print(self.helpStr)
コード例 #56
0
ファイル: cli.py プロジェクト: nsg-ethz/p4-learning
 def do_help(self, arg):
     "Describe available CLI commands."
     Cmd.do_help(self, arg)
     if arg == '':
         print(self.helpStr)
コード例 #57
0
ファイル: cmd_utils.py プロジェクト: Oneplus/cnccgbank
 def do_help(self, args):
     Cmd.do_help(self, args)