From 9424d4d5f22520792b25dce04108ecfe1414d200 Mon Sep 17 00:00:00 2001 From: Cezar Craciunoiu Date: Tue, 12 Dec 2023 14:18:59 +0200 Subject: [PATCH] feat(cmd): Do not use pager renderer if not needed Signed-off-by: Cezar Craciunoiu --- cmd/governctl/pr/check/patch.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/cmd/governctl/pr/check/patch.go b/cmd/governctl/pr/check/patch.go index ad65583..ccf44e3 100644 --- a/cmd/governctl/pr/check/patch.go +++ b/cmd/governctl/pr/check/patch.go @@ -186,12 +186,14 @@ func (opts *Patch) Run(cmd *cobra.Command, args []string) error { os.RemoveAll(pull.Workdir()) } - err = iostreams.G(ctx).StartPager() - if err != nil { - log.G(ctx).Errorf("error starting pager: %v", err) - } + if !kitcfg.G[config.Config](ctx).NoRender { + err = iostreams.G(ctx).StartPager() + if err != nil { + log.G(ctx).Errorf("error starting pager: %v", err) + } - defer iostreams.G(ctx).StopPager() + defer iostreams.G(ctx).StopPager() + } err = table.Render(iostreams.G(ctx).Out) if err != nil { @@ -199,7 +201,7 @@ func (opts *Patch) Run(cmd *cobra.Command, args []string) error { } if errors > 0 || warnings > 0 { - return fmt.Errorf("checkpatch failed with %d errors and %d warnings", errors, warnings) + return fmt.Errorf("summary: checkpatch failed with %d errors and %d warnings", errors, warnings) } return nil