Generate CLI docs from Go code
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
longandexampledocs in Go commands - [x] Configure
mkdocs.ymlto 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.mdis an artifact of the build process. How do we get it checked into the repo?
Resolves https://github.com/replicate/cog/issues/433
Possibly useful prior art mentioned by @marcusmartins:
https://github.com/infrahq/infra/blob/a7a3b3b48c58b999dc5cc88fcd467b975dafffdf/internal/docgen/cli.go#L102
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.
Converting this back to a draft. Still worth pursuing, but not a high priority.
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!
Removing @replicate/cog as the reviewers for the moment as this currently shows up in the review reminders and is non-actionable.