cli: fix builder persistent flag

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax
2021-11-04 18:52:11 +01:00
parent 4c938c77ba
commit eab0e6a8fe
34 changed files with 277 additions and 172 deletions

View File

@ -3,7 +3,6 @@ package main
import (
"log"
"os"
"path/filepath"
"github.com/docker/buildx/commands"
clidocstool "github.com/docker/cli-docs-tool"
@ -40,27 +39,28 @@ func gen(opts *options) error {
}
cmd.AddCommand(commands.NewRootCmd("buildx", true, dockerCLI))
clidocstool.DisableFlagsInUseLine(cmd)
cwd, _ := os.Getwd()
source := filepath.Join(cwd, opts.source)
if err = os.MkdirAll(source, 0755); err != nil {
c, err := clidocstool.New(clidocstool.Options{
Root: cmd,
SourceDir: opts.source,
Plugin: true,
})
if err != nil {
return err
}
for _, format := range opts.formats {
switch format {
case "md":
if err = clidocstool.GenMarkdownTree(cmd, source); err != nil {
if err = c.GenMarkdownTree(cmd); err != nil {
return err
}
case "yaml":
if err = clidocstool.GenYamlTree(cmd, source); err != nil {
if err = c.GenYamlTree(cmd); err != nil {
return err
}
default:
return errors.Errorf("unknwown doc format %q", format)
return errors.Errorf("unknown format %q", format)
}
}