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

Commit

Permalink
ref(list): display bundles in table form by default (#531)
Browse files Browse the repository at this point in the history
Signed-off-by: Matthew Fisher <[email protected]>
  • Loading branch information
Matthew Fisher authored Nov 29, 2018
1 parent c56b9a9 commit 62543a5
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions cmd/duffle/bundle_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func (n *NamedRepository) IsSigned() bool {
}

func newBundleListCmd(w io.Writer) *cobra.Command {
var long bool
var short bool
cmd := &cobra.Command{
Use: "list",
Aliases: []string{"ls"},
Expand All @@ -75,24 +75,24 @@ func newBundleListCmd(w io.Writer) *cobra.Command {
return err
}
sort.Sort(references)
if long {
table := uitable.New()
table.AddRow("NAME", "VERSION", "DIGEST", "SIGNED?")
if short {
for _, ref := range references {
table.AddRow(ref.Name(), ref.Tag(), ref.Digest(), ref.IsSigned())
fmt.Println(ref.Name())
}
fmt.Fprintln(w, table)
return nil
}

table := uitable.New()
table.AddRow("NAME", "VERSION", "DIGEST", "SIGNED?")
for _, ref := range references {
fmt.Println(ref.Name())
table.AddRow(ref.Name(), ref.Tag(), ref.Digest(), ref.IsSigned())
}
fmt.Fprintln(w, table)

return nil
},
}
cmd.Flags().BoolVarP(&long, "long", "l", false, "output longer listing format")
cmd.Flags().BoolVarP(&short, "short", "s", false, "output shorter listing format")

return cmd
}
Expand Down

0 comments on commit 62543a5

Please sign in to comment.