Utilities to generate (reference) documentation for the docker CLI
Перейти к файлу
Sebastiaan van Stijn 53293118a8
Merge pull request #55 from thaJeztah/update_deps
update dependencies
2024-07-17 15:21:30 +02:00
.github build(deps): bump docker/bake-action from 4 to 5 2024-06-17 09:52:05 +00:00
annotation
example go.mod: github.com/stretchr/testify v1.9.0 2024-07-15 17:26:49 +02:00
fixtures test: add root flags for tests 2024-07-02 15:03:26 +02:00
.dockerignore
.gitignore
.golangci.yml
Dockerfile
LICENSE
README.md
clidocstool.go fix: generate long desc and examples for root command 2024-07-02 15:03:26 +02:00
clidocstool_man.go add man support 2024-02-22 13:29:38 +01:00
clidocstool_man_test.go test: doc generation for root command 2024-07-02 15:03:26 +02:00
clidocstool_md.go
clidocstool_md_test.go test: doc generation for root command 2024-07-02 15:03:26 +02:00
clidocstool_test.go test: add root flags for tests 2024-07-02 15:03:26 +02:00
clidocstool_yaml.go add man support 2024-02-22 13:29:38 +01:00
clidocstool_yaml_test.go test: doc generation for root command 2024-07-02 15:03:26 +02:00
docker-bake.hcl
go.mod go.mod: github.com/stretchr/testify v1.9.0 2024-07-15 17:26:49 +02:00
go.sum go.mod: github.com/stretchr/testify v1.9.0 2024-07-15 17:26:49 +02:00
markdown.go
markdown_test.go

README.md

PkgGoDev Test Status Go Report Card

About

This is a library containing utilities to generate (reference) documentation for the docker CLI on docs.docker.com.

Disclaimer

This library is intended for use by Docker's CLIs, and is not intended to be a general-purpose utility. Various bits are hard-coded or make assumptions that are very specific to our use-case. Contributions are welcome, but we will not accept contributions to make this a general-purpose module.

Usage

To generate the documentation it's recommended to do so using a Go submodule in your repository.

We will use the example of docker/buildx and create a Go submodule in a docs folder (recommended):

$ mkdir docs
$ cd ./docs
$ go mod init github.com/docker/buildx/docs
$ go get github.com/docker/cli-docs-tool

Your go.mod should look like this:

module github.com/docker/buildx/docs

go 1.16

require (
	github.com/docker/cli-docs-tool v0.0.0
)

Next, create a file named main.go inside that directory containing the following Go code from example/main.go.

Running this example should produce the following output:

$ go run main.go
INFO: Generating Markdown for "docker buildx bake"
INFO: Generating Markdown for "docker buildx build"
INFO: Generating Markdown for "docker buildx create"
INFO: Generating Markdown for "docker buildx du"
...
INFO: Generating YAML for "docker buildx uninstall"
INFO: Generating YAML for "docker buildx use"
INFO: Generating YAML for "docker buildx version"
INFO: Generating YAML for "docker buildx"

Generated docs will be available in the ./docs folder of the project.

Contributing

Want to contribute? Awesome! You can find information about contributing to this project in the CONTRIBUTING.md