Refactor dockerCli *Format to ConfigFile call

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
This commit is contained in:
Vincent Demeester 2016-08-04 15:00:00 +02:00
parent a488ad1a09
commit 7c8780ea63
No known key found for this signature in database
GPG key ID: 083CC6FD6EB699A3
5 changed files with 8 additions and 32 deletions

View file

@ -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 {

View file

@ -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"
}

View file

@ -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"
}

View file

@ -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"
}

View file

@ -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"
}