GitOps for k8s
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

format.go 613B

12345678910111213141516171819202122232425262728293031
  1. package main
  2. import (
  3. "bytes"
  4. "fmt"
  5. "os"
  6. "strings"
  7. "text/tabwriter"
  8. "github.com/spf13/cobra"
  9. )
  10. type outputOpts struct {
  11. verbosity int
  12. }
  13. func AddOutputFlags(cmd *cobra.Command, opts *outputOpts) {
  14. cmd.Flags().CountVarP(&opts.verbosity, "verbose", "v", "include skipped (and ignored, with -vv) workloads in output")
  15. }
  16. func newTabwriter() *tabwriter.Writer {
  17. return tabwriter.NewWriter(os.Stdout, 0, 2, 2, ' ', 0)
  18. }
  19. func makeExample(examples ...string) string {
  20. var buf bytes.Buffer
  21. for _, ex := range examples {
  22. fmt.Fprintf(&buf, " "+ex+"\n")
  23. }
  24. return strings.TrimSuffix(buf.String(), "\n")
  25. }