Skip to content
This repository has been archived by the owner on May 3, 2022. It is now read-only.

Commit

Permalink
Return readable format by default from duffle bundle show (#826)
Browse files Browse the repository at this point in the history
Signed-off-by: Radu M <[email protected]>
  • Loading branch information
Radu M authored and itowlson committed Aug 8, 2019
1 parent f39268b commit b464875
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions cmd/duffle/bundle_show.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package main
import (
"fmt"
"io"
"os"

"github.com/docker/go/canonical/json"
"github.com/spf13/cobra"
)

Expand Down Expand Up @@ -58,22 +58,21 @@ func (bsc *bundleShowCmd) run() error {
return err
}

bun, err := loadBundle(bundleFile)
if err != nil {
return err
}

if bsc.raw {
f, err := os.Open(bundleFile)
if err != nil {
return err
}
defer f.Close()
_, err = io.Copy(bsc.w, f)
_, err = bun.WriteTo(bsc.w)
return err
}

bun, err := loadBundle(bundleFile)
d, err := json.MarshalIndent(bun, " ", " ")
if err != nil {
return err
}

_, err = bun.WriteTo(bsc.w)
_, err = bsc.w.Write(d)

return err
}

0 comments on commit b464875

Please sign in to comment.