Settings

Theme

Show HN: Parse2docs, turn Python Argparsers into usage documentation

github.com

14 points by brauhaus 2 years ago · 3 comments

Reader

brauhausOP 2 years ago

This is the first person library I've published! :)

I was getting tired of creating command line interfaces in Python whose contents I would then copy to create the Usage documentation. Now I pass the path to the script the ArgumentParser is located and it generates the markdown for me.

Currently, it can only find parsers located either in the module scope out that are returned by a function.

It doesn't handle subparsers yet, but I'm thinking about leaving like that for now. As of next steps, I wanted to add an option to generate docs in .rst format or wrap the library as a plugin for mkdocs.

I'm here for all feedback - bugs, feature suggestions, and usability comments. You can comment, open a GitHub issue, or reach out directly.

Ofc, I'm also welcoming any contributions. Please test parse2docs and send me your suggestions!

musicale 2 years ago

There's also help2man, which turns help output into man pages.

  • brauhausOP 2 years ago

    Hm, they took an interesting approach where they capture the echoed help messages using shell scripts.

    I was struggling to capture the python nodes and that would bypass it completely. It could even work with other python libraries, such as Click.

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection