Browse code

Refactor dockerCli *Format to ConfigFile call

Signed-off-by: Vincent Demeester <vincent@sbr.pm>

Vincent Demeester authored on 2016/08/04 22:00:00
Showing 5 changed files
... ...
@@ -118,30 +118,6 @@ func (cli *DockerCli) CheckTtyInput(attachStdin, ttyMode bool) error {
118 118
 	return nil
119 119
 }
120 120
 
121
-// PsFormat returns the format string specified in the configuration.
122
-// String contains columns and format specification, for example {{ID}}\t{{Name}}.
123
-func (cli *DockerCli) PsFormat() string {
124
-	return cli.configFile.PsFormat
125
-}
126
-
127
-// ImagesFormat returns the format string specified in the configuration.
128
-// String contains columns and format specification, for example {{ID}}\t{{Name}}.
129
-func (cli *DockerCli) ImagesFormat() string {
130
-	return cli.configFile.ImagesFormat
131
-}
132
-
133
-// NetworksFormat returns the format string specified in the configuration.
134
-// String contains columns and format specification, for example {{ID}}\t{{Name}}
135
-func (cli *DockerCli) NetworksFormat() string {
136
-	return cli.configFile.NetworksFormat
137
-}
138
-
139
-// VolumesFormat returns the format string specified in the configuration.
140
-// String contains columns and format specification, for example {{ID}}\t{{Name}}
141
-func (cli *DockerCli) VolumesFormat() string {
142
-	return cli.configFile.VolumesFormat
143
-}
144
-
145 121
 func (cli *DockerCli) setRawTerminal() error {
146 122
 	if os.Getenv("NORAW") == "" {
147 123
 		if cli.isTerminalIn {
... ...
@@ -101,8 +101,8 @@ func runPs(dockerCli *client.DockerCli, opts *psOptions) error {
101 101
 
102 102
 	f := opts.format
103 103
 	if len(f) == 0 {
104
-		if len(dockerCli.PsFormat()) > 0 && !opts.quiet {
105
-			f = dockerCli.PsFormat()
104
+		if len(dockerCli.ConfigFile().PsFormat) > 0 && !opts.quiet {
105
+			f = dockerCli.ConfigFile().PsFormat
106 106
 		} else {
107 107
 			f = "table"
108 108
 		}
... ...
@@ -79,8 +79,8 @@ func runImages(dockerCli *client.DockerCli, opts imagesOptions) error {
79 79
 
80 80
 	f := opts.format
81 81
 	if len(f) == 0 {
82
-		if len(dockerCli.ImagesFormat()) > 0 && !opts.quiet {
83
-			f = dockerCli.ImagesFormat()
82
+		if len(dockerCli.ConfigFile().ImagesFormat) > 0 && !opts.quiet {
83
+			f = dockerCli.ConfigFile().ImagesFormat
84 84
 		} else {
85 85
 			f = "table"
86 86
 		}
... ...
@@ -71,8 +71,8 @@ func runList(dockerCli *client.DockerCli, opts listOptions) error {
71 71
 
72 72
 	f := opts.format
73 73
 	if len(f) == 0 {
74
-		if len(dockerCli.NetworksFormat()) > 0 && !opts.quiet {
75
-			f = dockerCli.NetworksFormat()
74
+		if len(dockerCli.ConfigFile().NetworksFormat) > 0 && !opts.quiet {
75
+			f = dockerCli.ConfigFile().NetworksFormat
76 76
 		} else {
77 77
 			f = "table"
78 78
 		}
... ...
@@ -68,8 +68,8 @@ func runList(dockerCli *client.DockerCli, opts listOptions) error {
68 68
 
69 69
 	f := opts.format
70 70
 	if len(f) == 0 {
71
-		if len(dockerCli.VolumesFormat()) > 0 && !opts.quiet {
72
-			f = dockerCli.VolumesFormat()
71
+		if len(dockerCli.ConfigFile().VolumesFormat) > 0 && !opts.quiet {
72
+			f = dockerCli.ConfigFile().VolumesFormat
73 73
 		} else {
74 74
 			f = "table"
75 75
 		}