From 46f994e190cb6945b0e343402a37a0f624ad3ebb Mon Sep 17 00:00:00 2001 From: Shteryana Shopova Date: Sat, 20 Jul 2019 15:06:13 +0300 Subject: [PATCH] Option to suppress verbose output --- access/fetch-keys/main.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/access/fetch-keys/main.go b/access/fetch-keys/main.go index 1c1d973..eaff0f3 100644 --- a/access/fetch-keys/main.go +++ b/access/fetch-keys/main.go @@ -26,6 +26,7 @@ func main() { ghTeam := parser.String("t", "team", &argparse.Options{Required: false, Help: "Github Team name", Default: "NOC"}) ghOrganization := parser.String("o", "org", &argparse.Options{Required: false, Help: "Github Organization name", Default: "OpenFest"}) authToken := parser.String("a", "authtoken", &argparse.Options{Required: false, Help: "Github Auth token", Default: AuthToken}) + quiet := parser.Flag("q", "quiet", &argparse.Options{Required: false, Help: "Skip output to stdout", Default: false}) // Parse input err := parser.Parse(os.Args) @@ -106,7 +107,9 @@ func main() { } for _, user := range nocMembers { - fmt.Println("Fetching keys for ", *user) + if *quiet == false { + fmt.Println("Fetching keys for ", *user) + } var sshKeys bytes.Buffer for nextPage := 0; ; { @@ -125,7 +128,9 @@ func main() { } for _, key := range keys { - fmt.Println(*key.Key) + if *quiet == false { + fmt.Println(*key.Key) + } sshKeys.WriteString(*key.Key) sshKeys.WriteString("\n") }