func generateManPages(path string) error { header := &doc.GenManHeader{ Title: "DOCKER", Section: "1", Source: "Docker Community", } flags := &cliflags.ClientFlags{ Common: cliflags.InitCommonFlags(), } cmd := cobraadaptor.NewCobraAdaptor(flags).GetRootCommand() cmd.DisableAutoGenTag = true return doc.GenManTreeFromOpts(cmd, doc.GenManTreeOptions{ Header: header, Path: path, CommandSeparator: "-", }) }
// NewDaemonCli returns a pre-configured daemon CLI func NewDaemonCli() *DaemonCli { // TODO(tiborvass): remove InstallFlags? daemonConfig := new(daemon.Config) daemonConfig.LogConfig.Config = make(map[string]string) daemonConfig.ClusterOpts = make(map[string]string) if runtime.GOOS != "linux" { daemonConfig.V2Only = true } daemonConfig.InstallFlags(flag.CommandLine, presentInHelp) configFile := flag.CommandLine.String([]string{daemonConfigFileFlag}, defaultDaemonConfigFile, "Daemon configuration file") flag.CommandLine.Require(flag.Exact, 0) return &DaemonCli{ Config: daemonConfig, commonFlags: cliflags.InitCommonFlags(), configFile: configFile, } }
package main import ( "path/filepath" "github.com/docker/docker/cli" cliflags "github.com/docker/docker/cli/flags" "github.com/docker/docker/cliconfig" flag "github.com/docker/docker/pkg/mflag" "github.com/docker/docker/utils" ) var ( commonFlags = cliflags.InitCommonFlags() clientFlags = &cli.ClientFlags{FlagSet: new(flag.FlagSet), Common: commonFlags} ) func init() { client := clientFlags.FlagSet client.StringVar(&clientFlags.ConfigDir, []string{"-config"}, cliconfig.ConfigDir(), "Location of client config files") clientFlags.PostParse = func() { clientFlags.Common.PostParse() if clientFlags.ConfigDir != "" { cliconfig.SetConfigDir(clientFlags.ConfigDir) } if clientFlags.Common.TrustKey == "" { clientFlags.Common.TrustKey = filepath.Join(cliconfig.ConfigDir(), cliflags.DefaultTrustKeyFile)