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

Commit

Permalink
Delete headers for list-images and list-workloads
Browse files Browse the repository at this point in the history
  • Loading branch information
ogerbron committed Jan 27, 2020
1 parent fca827c commit 58dc171
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
13 changes: 9 additions & 4 deletions cmd/fluxctl/list_images_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ import (

type imageListOpts struct {
*rootOpts
namespace string
workload string
limit int
namespace string
workload string
limit int
noHeaders bool

// Deprecated
controller string
Expand All @@ -39,6 +40,7 @@ func (opts *imageListOpts) Command() *cobra.Command {
cmd.Flags().StringVarP(&opts.namespace, "namespace", "n", "", "Namespace")
cmd.Flags().StringVarP(&opts.workload, "workload", "w", "", "Show images for this workload")
cmd.Flags().IntVarP(&opts.limit, "limit", "l", 10, "Number of images to show (0 for all)")
cmd.Flags().BoolVar(&opts.noHeaders, "no-headers", false, "Don't print headers (default print headers)")

// Deprecated
cmd.Flags().StringVarP(&opts.controller, "controller", "c", "", "Show images for this controller")
Expand Down Expand Up @@ -83,7 +85,10 @@ func (opts *imageListOpts) RunE(cmd *cobra.Command, args []string) error {

out := newTabwriter()

fmt.Fprintln(out, "WORKLOAD\tCONTAINER\tIMAGE\tCREATED")
if !opts.noHeaders {
fmt.Fprintln(out, "WORKLOAD\tCONTAINER\tIMAGE\tCREATED")
}

for _, workload := range workloads {
if len(workload.Containers) == 0 {
fmt.Fprintf(out, "%s\t\t\t\n", workload.ID)
Expand Down
7 changes: 6 additions & 1 deletion cmd/fluxctl/list_workloads_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ type workloadListOpts struct {
*rootOpts
namespace string
allNamespaces bool
noHeaders bool
}

func newWorkloadList(parent *rootOpts) *workloadListOpts {
Expand All @@ -32,6 +33,7 @@ func (opts *workloadListOpts) Command() *cobra.Command {
}
cmd.Flags().StringVarP(&opts.namespace, "namespace", "n", "", "Confine query to namespace")
cmd.Flags().BoolVarP(&opts.allNamespaces, "all-namespaces", "a", false, "Query across all namespaces")
cmd.Flags().BoolVar(&opts.noHeaders, "no-headers", false, "Don't print headers (default print headers)")
return cmd
}

Expand All @@ -57,7 +59,10 @@ func (opts *workloadListOpts) RunE(cmd *cobra.Command, args []string) error {
sort.Sort(workloadStatusByName(workloads))

w := newTabwriter()
fmt.Fprintf(w, "WORKLOAD\tCONTAINER\tIMAGE\tRELEASE\tPOLICY\n")
if !opts.noHeaders {
fmt.Fprintf(w, "WORKLOAD\tCONTAINER\tIMAGE\tRELEASE\tPOLICY\n")
}

for _, workload := range workloads {
if len(workload.Containers) > 0 {
c := workload.Containers[0]
Expand Down

0 comments on commit 58dc171

Please sign in to comment.