Option to suppress verbose output

This commit is contained in:
Shteryana Shopova 2019-07-20 15:06:13 +03:00
parent fa5b07036c
commit 46f994e190
1 changed files with 7 additions and 2 deletions

View File

@ -26,6 +26,7 @@ func main() {
ghTeam := parser.String("t", "team", &argparse.Options{Required: false, Help: "Github Team name", Default: "NOC"}) 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"}) 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}) 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 // Parse input
err := parser.Parse(os.Args) err := parser.Parse(os.Args)
@ -106,7 +107,9 @@ func main() {
} }
for _, user := range nocMembers { for _, user := range nocMembers {
if *quiet == false {
fmt.Println("Fetching keys for ", *user) fmt.Println("Fetching keys for ", *user)
}
var sshKeys bytes.Buffer var sshKeys bytes.Buffer
for nextPage := 0; ; { for nextPage := 0; ; {
@ -125,7 +128,9 @@ func main() {
} }
for _, key := range keys { for _, key := range keys {
if *quiet == false {
fmt.Println(*key.Key) fmt.Println(*key.Key)
}
sshKeys.WriteString(*key.Key) sshKeys.WriteString(*key.Key)
sshKeys.WriteString("\n") sshKeys.WriteString("\n")
} }