oceanpkg / ocean

A package manager
https://www.oceanpkg.org
GNU Affero General Public License v3.0
19 stars 0 forks source link

Generate Markdown for CLI Commands #1

Open nvzqz opened 4 years ago

nvzqz commented 4 years ago

Possible CLI commands should be available to read in .md files.

It may be possible to generate markdown for commands with information passed into clap. Or at least when that info is being passed to clap.

zicklag commented 4 years ago

Hey there, I just found this issue and thought I'd point you to something similar that I did for the Lucky project.

There is a Cargo feature flag used to build the CLI as a doc generator that will pull the CLI information and generate mdbook pages: https://katharostech.github.io/lucky/cli/lucky.html. That is then run in CI before publishing the book to GitHub pages.

This may be far departed from what you are going for. Because Lucky has a rather vast and nested CLI I developed a custom command trait to wrap each subcommand and a system for associating the markdown documentation with the subcommands. The documentation can also be rendered in the terminal:

(GIF Image, 1088 × 664 pixels)

Anyway, just throwing this out there if you are interested in anything similar. :)