mirror of https://github.com/k3s-io/k3s
Merge pull request #32092 from asalkeld/get-strange-output
Automatic merge from submit-queue Improve the get output for completed pods **What this PR does / why we need it**: - rename FinishPrint() to AfterPrint() - add a newline to separate it from the table - remove the "objects" and () - assume plural **Which issue this PR fixes** fixes #31160 **Special notes for your reviewer**: None **Release note**: ```release-note Improve the get output for completed pods ```pull/6/head
commit
64f5d9c3f4
|
@ -168,7 +168,7 @@ func (t *testPrinter) HandledResources() []string {
|
||||||
return []string{}
|
return []string{}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *testPrinter) FinishPrint(output io.Writer, res string) error {
|
func (t *testPrinter) AfterPrint(output io.Writer, res string) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -235,7 +235,7 @@ func RunGet(f *cmdutil.Factory, out io.Writer, errOut io.Writer, cmd *cobra.Comm
|
||||||
if err := printer.PrintObj(obj, out); err != nil {
|
if err := printer.PrintObj(obj, out); err != nil {
|
||||||
return fmt.Errorf("unable to output the provided object: %v", err)
|
return fmt.Errorf("unable to output the provided object: %v", err)
|
||||||
}
|
}
|
||||||
printer.FinishPrint(errOut, mapping.Resource)
|
printer.AfterPrint(errOut, mapping.Resource)
|
||||||
}
|
}
|
||||||
|
|
||||||
// print watched changes
|
// print watched changes
|
||||||
|
@ -253,7 +253,7 @@ func RunGet(f *cmdutil.Factory, out io.Writer, errOut io.Writer, cmd *cobra.Comm
|
||||||
}
|
}
|
||||||
err := printer.PrintObj(e.Object, out)
|
err := printer.PrintObj(e.Object, out)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
printer.FinishPrint(errOut, mapping.Resource)
|
printer.AfterPrint(errOut, mapping.Resource)
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
})
|
})
|
||||||
|
@ -315,7 +315,7 @@ func RunGet(f *cmdutil.Factory, out io.Writer, errOut io.Writer, cmd *cobra.Comm
|
||||||
if err := printer.PrintObj(obj, out); err != nil {
|
if err := printer.PrintObj(obj, out); err != nil {
|
||||||
allErrs = append(allErrs, err)
|
allErrs = append(allErrs, err)
|
||||||
}
|
}
|
||||||
printer.FinishPrint(errOut, res)
|
printer.AfterPrint(errOut, res)
|
||||||
return utilerrors.NewAggregate(allErrs)
|
return utilerrors.NewAggregate(allErrs)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -382,7 +382,7 @@ func RunGet(f *cmdutil.Factory, out io.Writer, errOut io.Writer, cmd *cobra.Comm
|
||||||
if printer == nil || lastMapping == nil || mapping == nil || mapping.Resource != lastMapping.Resource {
|
if printer == nil || lastMapping == nil || mapping == nil || mapping.Resource != lastMapping.Resource {
|
||||||
if printer != nil {
|
if printer != nil {
|
||||||
w.Flush()
|
w.Flush()
|
||||||
printer.FinishPrint(errOut, lastMapping.Resource)
|
printer.AfterPrint(errOut, lastMapping.Resource)
|
||||||
}
|
}
|
||||||
printer, err = f.PrinterForMapping(cmd, mapping, allNamespaces)
|
printer, err = f.PrinterForMapping(cmd, mapping, allNamespaces)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -422,7 +422,7 @@ func RunGet(f *cmdutil.Factory, out io.Writer, errOut io.Writer, cmd *cobra.Comm
|
||||||
}
|
}
|
||||||
w.Flush()
|
w.Flush()
|
||||||
if printer != nil {
|
if printer != nil {
|
||||||
printer.FinishPrint(errOut, lastMapping.Resource)
|
printer.AfterPrint(errOut, lastMapping.Resource)
|
||||||
}
|
}
|
||||||
return utilerrors.NewAggregate(allErrs)
|
return utilerrors.NewAggregate(allErrs)
|
||||||
}
|
}
|
||||||
|
|
|
@ -155,7 +155,7 @@ type CustomColumnsPrinter struct {
|
||||||
NoHeaders bool
|
NoHeaders bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *CustomColumnsPrinter) FinishPrint(w io.Writer, res string) error {
|
func (s *CustomColumnsPrinter) AfterPrint(w io.Writer, res string) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -150,7 +150,7 @@ type ResourcePrinter interface {
|
||||||
HandledResources() []string
|
HandledResources() []string
|
||||||
//Can be used to print out warning/clarifications if needed
|
//Can be used to print out warning/clarifications if needed
|
||||||
//after all objects were printed
|
//after all objects were printed
|
||||||
FinishPrint(io.Writer, string) error
|
AfterPrint(io.Writer, string) error
|
||||||
}
|
}
|
||||||
|
|
||||||
// ResourcePrinterFunc is a function that can print objects
|
// ResourcePrinterFunc is a function that can print objects
|
||||||
|
@ -166,7 +166,7 @@ func (fn ResourcePrinterFunc) HandledResources() []string {
|
||||||
return []string{}
|
return []string{}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (fn ResourcePrinterFunc) FinishPrint(io.Writer, string) error {
|
func (fn ResourcePrinterFunc) AfterPrint(io.Writer, string) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -187,7 +187,7 @@ func NewVersionedPrinter(printer ResourcePrinter, converter runtime.ObjectConver
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *VersionedPrinter) FinishPrint(w io.Writer, res string) error {
|
func (p *VersionedPrinter) AfterPrint(w io.Writer, res string) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -214,7 +214,7 @@ type NamePrinter struct {
|
||||||
Typer runtime.ObjectTyper
|
Typer runtime.ObjectTyper
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *NamePrinter) FinishPrint(w io.Writer, res string) error {
|
func (p *NamePrinter) AfterPrint(w io.Writer, res string) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -266,7 +266,7 @@ func (p *NamePrinter) HandledResources() []string {
|
||||||
type JSONPrinter struct {
|
type JSONPrinter struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *JSONPrinter) FinishPrint(w io.Writer, res string) error {
|
func (p *JSONPrinter) AfterPrint(w io.Writer, res string) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -300,7 +300,7 @@ type YAMLPrinter struct {
|
||||||
converter runtime.ObjectConvertor
|
converter runtime.ObjectConvertor
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *YAMLPrinter) FinishPrint(w io.Writer, res string) error {
|
func (p *YAMLPrinter) AfterPrint(w io.Writer, res string) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -447,9 +447,9 @@ func (h *HumanReadablePrinter) HandledResources() []string {
|
||||||
return keys
|
return keys
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *HumanReadablePrinter) FinishPrint(output io.Writer, res string) error {
|
func (h *HumanReadablePrinter) AfterPrint(output io.Writer, res string) error {
|
||||||
if !h.options.NoHeaders && !h.options.ShowAll && h.hiddenObjNum > 0 {
|
if !h.options.NoHeaders && !h.options.ShowAll && h.hiddenObjNum > 0 {
|
||||||
_, err := fmt.Fprintf(output, " info: %d completed object(s) was(were) not shown in %s list. Pass --show-all to see all objects.\n\n", h.hiddenObjNum, res)
|
_, err := fmt.Fprintf(output, "\ninfo: %d completed %s were not shown in the list. Pass --show-all to see all.\n\n", h.hiddenObjNum, res)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
@ -2256,7 +2256,7 @@ func NewTemplatePrinter(tmpl []byte) (*TemplatePrinter, error) {
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *TemplatePrinter) FinishPrint(w io.Writer, res string) error {
|
func (p *TemplatePrinter) AfterPrint(w io.Writer, res string) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2407,7 +2407,7 @@ func NewJSONPathPrinter(tmpl string) (*JSONPathPrinter, error) {
|
||||||
return &JSONPathPrinter{tmpl, j}, nil
|
return &JSONPathPrinter{tmpl, j}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (j *JSONPathPrinter) FinishPrint(w io.Writer, res string) error {
|
func (j *JSONPathPrinter) AfterPrint(w io.Writer, res string) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ type SortingPrinter struct {
|
||||||
Decoder runtime.Decoder
|
Decoder runtime.Decoder
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *SortingPrinter) FinishPrint(w io.Writer, res string) error {
|
func (s *SortingPrinter) AfterPrint(w io.Writer, res string) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue