mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
pretty print json in inspect
This commit is contained in:
parent
fc29f01528
commit
842cb8909e
1 changed files with 8 additions and 1 deletions
|
@ -457,7 +457,14 @@ func CmdInspect(args ...string) error {
|
|||
return err
|
||||
}
|
||||
}
|
||||
fmt.Printf("%s\n", obj)
|
||||
|
||||
indented := new(bytes.Buffer)
|
||||
if err = json.Indent(indented, obj, "", " "); err != nil {
|
||||
return err
|
||||
}
|
||||
if _, err := io.Copy(os.Stdout, indented); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue