cog icon indicating copy to clipboard operation
cog copied to clipboard

Generate CLI docs from Go code

Open zeke opened this issue 1 year ago • 5 comments

This PR generate CLI reference docs programmatically from the Go source code using cobra/doc.

View the docs

https://github.com/replicate/cog/blob/077efdfda59d207ed58601c2b4513e33cda10e00/docs/cli.md

Generate the docs

script/build-cli-docs

To Do

  • [x] Figure out how to get cobra/docs to fold all CLI docs into one markdown file.
  • [x] Improve existing long and example docs in Go commands
  • [x] Configure mkdocs.yml to include CLI docs in https://cog.run site nav
  • [ ] Figure out if we can do all the shell-script silliness in a single Go script instead and maybe a make command
  • [ ] Update build process (and CONTRIBUTING docs) to generate docs
  • [ ] docs/cli.md is an artifact of the build process. How do we get it checked into the repo?

Resolves https://github.com/replicate/cog/issues/433

zeke avatar May 29 '24 00:05 zeke

Possibly useful prior art mentioned by @marcusmartins:

https://github.com/infrahq/infra/blob/a7a3b3b48c58b999dc5cc88fcd467b975dafffdf/internal/docgen/cli.go#L102

zeke avatar May 29 '24 00:05 zeke

This is ready for eyes!

It works, but there a few outstanding issues to get it over the finish line. Could use some help from someone with Gopher skills and knowledge of where this new docs build process should slot into the dev/release cycle.

zeke avatar May 31 '24 22:05 zeke

Converting this back to a draft. Still worth pursuing, but not a high priority.

zeke avatar Jun 18 '24 00:06 zeke

Asking kindly for someone to push this across the finish line. As a newbie to cog, the lack of systematic docs makes it a bit confusing to get started. Everything centers around the cog CLI, but there's no proper reference for it. It would help a lot to get a better understanding of the cog capabilities, plus I'd really like to know what a command will do before I execute it in my shell. Thanks!

aknoerig avatar Aug 29 '24 11:08 aknoerig

Removing @replicate/cog as the reviewers for the moment as this currently shows up in the review reminders and is non-actionable.

aron avatar Oct 16 '24 09:10 aron