Refactor dockerCli *Format to ConfigFile call
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
This commit is contained in:
parent
a488ad1a09
commit
7c8780ea63
5 changed files with 8 additions and 32 deletions
|
@ -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 {
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue