mirror of https://github.com/docker/buildx.git
vendor: github.com/docker/cli-docs-tool v0.7.0
Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
This commit is contained in:
parent
c9d1c41d20
commit
ce66d8830d
2
go.mod
2
go.mod
|
@ -14,7 +14,7 @@ require (
|
|||
github.com/creack/pty v1.1.18
|
||||
github.com/distribution/reference v0.5.0
|
||||
github.com/docker/cli v25.0.2+incompatible
|
||||
github.com/docker/cli-docs-tool v0.6.0
|
||||
github.com/docker/cli-docs-tool v0.7.0
|
||||
github.com/docker/docker v25.0.2+incompatible
|
||||
github.com/docker/go-units v0.5.0
|
||||
github.com/gofrs/flock v0.8.1
|
||||
|
|
4
go.sum
4
go.sum
|
@ -123,8 +123,8 @@ github.com/distribution/reference v0.5.0 h1:/FUIFXtfc/x2gpa5/VGfiGLuOIdYa1t65IKK
|
|||
github.com/distribution/reference v0.5.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E=
|
||||
github.com/docker/cli v25.0.2+incompatible h1:6GEdvxwEA451/+Y3GtqIGn/MNjujQazUlxC6uGu8Tog=
|
||||
github.com/docker/cli v25.0.2+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8=
|
||||
github.com/docker/cli-docs-tool v0.6.0 h1:Z9x10SaZgFaB6jHgz3OWooynhSa40CsWkpe5hEnG/qA=
|
||||
github.com/docker/cli-docs-tool v0.6.0/go.mod h1:zMjqTFCU361PRh8apiXzeAZ1Q/xupbIwTusYpzCXS/o=
|
||||
github.com/docker/cli-docs-tool v0.7.0 h1:M2Da98Unz2kz3A5d4yeSGbhyOge2mfYSNjAFt01Rw0M=
|
||||
github.com/docker/cli-docs-tool v0.7.0/go.mod h1:zMjqTFCU361PRh8apiXzeAZ1Q/xupbIwTusYpzCXS/o=
|
||||
github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
|
||||
github.com/docker/distribution v2.8.2+incompatible h1:T3de5rq0dB1j30rp0sA2rER+m322EBzniBPB6ZIzuh8=
|
||||
github.com/docker/distribution v2.8.2+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
|
||||
|
|
|
@ -241,7 +241,7 @@ func mdCmdOutput(cmd *cobra.Command, old string) (string, error) {
|
|||
name += mdMakeLink("`--"+f.Name+"`", f.Name, f, isLink)
|
||||
|
||||
var ftype string
|
||||
if f.Value.Type() != "bool" {
|
||||
if f.Value.Type() != "bool" || (f.Value.Type() == "bool" && f.DefValue == "true") {
|
||||
ftype = "`" + f.Value.Type() + "`"
|
||||
}
|
||||
|
||||
|
@ -253,7 +253,7 @@ func mdCmdOutput(cmd *cobra.Command, old string) (string, error) {
|
|||
} else if cd, ok := cmd.Annotations[annotation.CodeDelimiter]; ok {
|
||||
defval = strings.ReplaceAll(defval, cd, "`")
|
||||
}
|
||||
} else if f.DefValue != "" && (f.Value.Type() != "bool" && f.DefValue != "true") && f.DefValue != "[]" {
|
||||
} else if f.DefValue != "" && ((f.Value.Type() != "bool" && f.DefValue != "true") || (f.Value.Type() == "bool" && f.DefValue == "true")) && f.DefValue != "[]" {
|
||||
defval = "`" + f.DefValue + "`"
|
||||
}
|
||||
|
||||
|
|
|
@ -29,6 +29,9 @@ var (
|
|||
// for our use-case; DO NOT consider using this as a generic regex, or at least
|
||||
// not before reading https://stackoverflow.com/a/1732454/1811501.
|
||||
htmlAnchor = regexp.MustCompile(`<a\s+(?:name|id)="?([^"]+)"?\s*></a>\s*`)
|
||||
// relativeLink matches parts of internal links between .md documents
|
||||
// e.g. "](buildx_build.md)"
|
||||
relativeLink = regexp.MustCompile(`\]\((\.\/)?[a-z-_]+\.md(#.*)?\)`)
|
||||
)
|
||||
|
||||
// getSections returns all H2 sections by title (lowercase)
|
||||
|
@ -58,6 +61,16 @@ func cleanupMarkDown(mdString string) (md string, anchors []string) {
|
|||
mdString = strings.ReplaceAll(mdString, "\t", " ")
|
||||
mdString = strings.ReplaceAll(mdString, "https://docs.docker.com", "")
|
||||
|
||||
// Rewrite internal links, replacing relative paths with absolute path
|
||||
// e.g. from [docker buildx build](buildx_build.md#build-arg)
|
||||
// to [docker buildx build](/reference/cli/docker/buildx/build/#build-arg)
|
||||
mdString = relativeLink.ReplaceAllStringFunc(mdString, func(link string) string {
|
||||
link = strings.TrimLeft(link, "](./")
|
||||
link = strings.ReplaceAll(link, "_", "/")
|
||||
link = strings.ReplaceAll(link, ".md", "/")
|
||||
return "](/reference/cli/docker/" + link
|
||||
})
|
||||
|
||||
var id string
|
||||
// replace trailing whitespace per line, and handle custom anchors
|
||||
lines := strings.Split(mdString, "\n")
|
||||
|
|
|
@ -245,7 +245,7 @@ github.com/docker/cli/cli/trust
|
|||
github.com/docker/cli/cli/version
|
||||
github.com/docker/cli/opts
|
||||
github.com/docker/cli/templates
|
||||
# github.com/docker/cli-docs-tool v0.6.0
|
||||
# github.com/docker/cli-docs-tool v0.7.0
|
||||
## explicit; go 1.18
|
||||
github.com/docker/cli-docs-tool
|
||||
github.com/docker/cli-docs-tool/annotation
|
||||
|
|
Loading…
Reference in New Issue