mirror of
https://github.com/docker/compose.git
synced 2026-08-31 23:03:55 +00:00
Allow docker context ls —formatter {{json.}} to not delegate to Moby and include context type in the json
Signed-off-by: Guillaume Tardif <guillaume.tardif@docker.com>
This commit is contained in:
parent
0cea91c555
commit
a1bb2d5abe
4 changed files with 19 additions and 3 deletions
|
|
@ -69,7 +69,8 @@ func runList(cmd *cobra.Command, opts lsOpts) error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if opts.format != "" && opts.format != formatter.JSON && opts.format != formatter.PRETTY {
|
||||
format := strings.ToLower(strings.ReplaceAll(opts.format, " ", ""))
|
||||
if format != "" && format != formatter.JSON && format != formatter.PRETTY && format != formatter.TemplateJSON {
|
||||
mobycli.Exec(cmd.Root())
|
||||
return nil
|
||||
}
|
||||
|
|
@ -93,7 +94,7 @@ func runList(cmd *cobra.Command, opts lsOpts) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
if opts.json {
|
||||
if opts.json || format == formatter.JSON || format == formatter.TemplateJSON {
|
||||
opts.format = formatter.JSON
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue