From 493b29afbf76d950a580ba6db7f68c0f4c611e16 Mon Sep 17 00:00:00 2001 From: Jake Hillion Date: Fri, 26 Jul 2024 16:21:07 +0000 Subject: [PATCH] context: move human readable note to stderr (#636) The NOTE shown when an explicit login isn't provided is output on Stdout instead of Stderr. This messes up the output of any commands when piping them to a tool such as `yq`. Move this human readable information to Stderr so it doesn't break any automated parsing. Reviewed-on: https://gitea.com/gitea/tea/pulls/636 Co-authored-by: Jake Hillion Co-committed-by: Jake Hillion --- modules/context/context.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/context/context.go b/modules/context/context.go index 995ba25..393b10f 100644 --- a/modules/context/context.go +++ b/modules/context/context.go @@ -142,7 +142,7 @@ and then run your command again.`) } os.Exit(1) } - fmt.Printf("NOTE: no gitea login detected, falling back to login '%s'\n", c.Login.Name) + fmt.Fprintf(os.Stderr, "NOTE: no gitea login detected, falling back to login '%s'\n", c.Login.Name) } // parse reposlug (owner falling back to login owner if reposlug contains only repo name)