github.com/sijibomii/docker@v0.0.0-20231230191044-5cf6ca554647/docker/client.go (about)

     1  package main
     2  
     3  import (
     4  	"path/filepath"
     5  
     6  	"github.com/docker/docker/cli"
     7  	"github.com/docker/docker/cliconfig"
     8  	flag "github.com/docker/docker/pkg/mflag"
     9  	"github.com/docker/docker/utils"
    10  )
    11  
    12  var clientFlags = &cli.ClientFlags{FlagSet: new(flag.FlagSet), Common: commonFlags}
    13  
    14  func init() {
    15  	client := clientFlags.FlagSet
    16  	client.StringVar(&clientFlags.ConfigDir, []string{"-config"}, cliconfig.ConfigDir(), "Location of client config files")
    17  
    18  	clientFlags.PostParse = func() {
    19  		clientFlags.Common.PostParse()
    20  
    21  		if clientFlags.ConfigDir != "" {
    22  			cliconfig.SetConfigDir(clientFlags.ConfigDir)
    23  		}
    24  
    25  		if clientFlags.Common.TrustKey == "" {
    26  			clientFlags.Common.TrustKey = filepath.Join(cliconfig.ConfigDir(), defaultTrustKeyFile)
    27  		}
    28  
    29  		if clientFlags.Common.Debug {
    30  			utils.EnableDebug()
    31  		}
    32  	}
    33  }