Explorar o código

Refactor dockerCli *Format to ConfigFile call

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Vincent Demeester %!s(int64=9) %!d(string=hai) anos
pai
achega
7c8780ea63

+ 0 - 24
api/client/cli.go

@@ -118,30 +118,6 @@ func (cli *DockerCli) CheckTtyInput(attachStdin, ttyMode bool) error {
 	return nil
 }
 
-// PsFormat returns the format string specified in the configuration.
-// String contains columns and format specification, for example {{ID}}\t{{Name}}.
-func (cli *DockerCli) PsFormat() string {
-	return cli.configFile.PsFormat
-}
-
-// ImagesFormat returns the format string specified in the configuration.
-// String contains columns and format specification, for example {{ID}}\t{{Name}}.
-func (cli *DockerCli) ImagesFormat() string {
-	return cli.configFile.ImagesFormat
-}
-
-// NetworksFormat returns the format string specified in the configuration.
-// String contains columns and format specification, for example {{ID}}\t{{Name}}
-func (cli *DockerCli) NetworksFormat() string {
-	return cli.configFile.NetworksFormat
-}
-
-// VolumesFormat returns the format string specified in the configuration.
-// String contains columns and format specification, for example {{ID}}\t{{Name}}
-func (cli *DockerCli) VolumesFormat() string {
-	return cli.configFile.VolumesFormat
-}
-
 func (cli *DockerCli) setRawTerminal() error {
 	if os.Getenv("NORAW") == "" {
 		if cli.isTerminalIn {

+ 2 - 2
api/client/container/ps.go

@@ -101,8 +101,8 @@ func runPs(dockerCli *client.DockerCli, opts *psOptions) error {
 
 	f := opts.format
 	if len(f) == 0 {
-		if len(dockerCli.PsFormat()) > 0 && !opts.quiet {
-			f = dockerCli.PsFormat()
+		if len(dockerCli.ConfigFile().PsFormat) > 0 && !opts.quiet {
+			f = dockerCli.ConfigFile().PsFormat
 		} else {
 			f = "table"
 		}

+ 2 - 2
api/client/image/images.go

@@ -79,8 +79,8 @@ func runImages(dockerCli *client.DockerCli, opts imagesOptions) error {
 
 	f := opts.format
 	if len(f) == 0 {
-		if len(dockerCli.ImagesFormat()) > 0 && !opts.quiet {
-			f = dockerCli.ImagesFormat()
+		if len(dockerCli.ConfigFile().ImagesFormat) > 0 && !opts.quiet {
+			f = dockerCli.ConfigFile().ImagesFormat
 		} else {
 			f = "table"
 		}

+ 2 - 2
api/client/network/list.go

@@ -71,8 +71,8 @@ func runList(dockerCli *client.DockerCli, opts listOptions) error {
 
 	f := opts.format
 	if len(f) == 0 {
-		if len(dockerCli.NetworksFormat()) > 0 && !opts.quiet {
-			f = dockerCli.NetworksFormat()
+		if len(dockerCli.ConfigFile().NetworksFormat) > 0 && !opts.quiet {
+			f = dockerCli.ConfigFile().NetworksFormat
 		} else {
 			f = "table"
 		}

+ 2 - 2
api/client/volume/list.go

@@ -68,8 +68,8 @@ func runList(dockerCli *client.DockerCli, opts listOptions) error {
 
 	f := opts.format
 	if len(f) == 0 {
-		if len(dockerCli.VolumesFormat()) > 0 && !opts.quiet {
-			f = dockerCli.VolumesFormat()
+		if len(dockerCli.ConfigFile().VolumesFormat) > 0 && !opts.quiet {
+			f = dockerCli.ConfigFile().VolumesFormat
 		} else {
 			f = "table"
 		}