Ejemplo n.º 1
0
    def helpForCommandFinisher(self, commandName):
        c, s = self.c, None
        if commandName and commandName.startswith('help-for-'):
            # Execute the command itself.
            c.k.simulateCommand(commandName)
        else:
            if commandName:
                bindings = self.getBindingsForCommand(commandName)
                func = c.commandsDict.get(commandName)
                s = g.getDocStringForFunction(func)
                if s:
                    s = self.replaceBindingPatterns(s)
                else:
                    s = 'no docstring available'
                # Create the title.
                s2 = '%s (%s)' % (commandName,
                                  bindings) if bindings else commandName
                underline = '+' * len(s2)
                title = '%s\n%s\n\n' % (s2, underline)
                if 1:  # 2015/03/24
                    s = title + g.adjustTripleString(s, c.tab_width)
                else:
                    # Fixes bug 618570:
                    s = title + ''.join([
                        line.lstrip() if line.strip() else '\n'
                        for line in g.splitLines(s)
                    ])
            else:
                #@+<< set s to about help-for-command >>
                #@+node:ekr.20150514063305.384: *4* << set s to about help-for-command >>
                s = '''\

                ++++++++++++++++++++++++
                About Leo's help command
                ++++++++++++++++++++++++

                Invoke Leo's help-for-command as follows::

                    <F1>
                    <Alt-X>help-for-command<return>

                Next, type the name of one of Leo's commands.
                You can use tab completion.  Examples::

                    <F1><tab>           shows all commands.
                    <F1>help-for<tab>   shows all help-for- commands.

                Here are the help-for commands::

                    help-for-abbreviations
                    help-for-autocompletion
                    help-for-bindings
                    help-for-command
                    help-for-debugging-commands
                    help-for-dynamic-abbreviations
                    help-for-find-commands
                    help-for-minibuffer
                    help-for-python
                    help-for-regular-expressions

                '''
                #@-<< set s to about help-for-command >>
            c.putHelpFor(s)  # calls g.adjustTripleString.
Ejemplo n.º 2
0
    def helpForCommandFinisher(self, commandName):
        c, s = self.c, None
        if commandName and commandName.startswith('help-for-'):
            # Execute the command itself.
            c.k.simulateCommand(commandName)
        else:
            if commandName:
                bindings = self.getBindingsForCommand(commandName)
                func = c.commandsDict.get(commandName)
                s = g.getDocStringForFunction(func)
                if s:
                    s = self.replaceBindingPatterns(s)
                else:
                    s = 'no docstring available'
                # Create the title.
                s2 = '%s (%s)' % (commandName, bindings) if bindings else commandName
                underline = '+' * len(s2)
                title = '%s\n%s\n\n' % (s2, underline)
                if 1: # 2015/03/24
                    s = title + g.adjustTripleString(s, c.tab_width)
                else:
                    # Fixes bug 618570:
                    s = title + ''.join([
                        line.lstrip() if line.strip() else '\n'
                            for line in g.splitLines(s)])
            else:
                #@+<< set s to about help-for-command >>
                #@+node:ekr.20150514063305.384: *4* << set s to about help-for-command >>
                s = '''\

                ++++++++++++++++++++++++
                About Leo's help command
                ++++++++++++++++++++++++

                Invoke Leo's help-for-command as follows::

                    <F1>
                    <Alt-X>help-for-command<return>

                Next, type the name of one of Leo's commands.
                You can use tab completion.  Examples::

                    <F1><tab>           shows all commands.
                    <F1>help-for<tab>   shows all help-for- commands.

                Here are the help-for commands::

                    help-for-abbreviations
                    help-for-autocompletion
                    help-for-bindings
                    help-for-command
                    help-for-debugging-commands
                    help-for-dynamic-abbreviations
                    help-for-find-commands
                    help-for-minibuffer
                    help-for-python
                    help-for-regular-expressions

                '''
                #@-<< set s to about help-for-command >>
            c.putHelpFor(s) # calls g.adjustTripleString.