errbot icon indicating copy to clipboard operation
errbot copied to clipboard

Improve command help text output

Open e4r7hbug opened this issue 7 years ago • 0 comments

In order to let us help you better, please fill out the following fields as best you can:

I am...

  • [ ] Reporting a bug
  • [x] Suggesting a new feature
  • [ ] Requesting help with running my bot
  • [ ] Requesting help writing plugins
  • [ ] Here about something else

I am running...

  • Errbot version: 4.3.4
  • OS version: Fedora 24
  • Python version: 3.5.2
  • Using a virtual environment: no

Issue description

The help text for a sub-command displays the method docstring, which can sometimes look good, but most of time time looks plain or cryptic. It would be nice if the help could include generated text based on any arguments specified by the sub-command.

It looks like most of the code is following plain ReStructuredText docstring style. Maybe a tool like Sphinx could help parse the docstring? Then the help rendering function could format the parsed text. The BOT_PREFIX character could also be used in the output instead of relying on everyone using !.

Steps to reproduce

errbot/core_plugins/utils.py turns the docstring into the picture.

    @botcmd(admin_only=True)
    def log_tail(self, msg, args):
        """ Display a tail of the log of n lines or 40 by default
        use : !log tail 10
        """

image

Our command docstring using Google Style turns into the picture.


    @botcmd(split_args_with=' ')
    def spinnaker_pipelineupdate(self, msg, args):
        """Update an application pipeline

        Args:
            url (str): Application git repo URL.

        Example:
            !pipeline update url=forrest/edge
        """

image

Additional info

No more information.

e4r7hbug avatar Jul 12 '17 22:07 e4r7hbug