[coreboot-gerrit] Change in coreboot[master]: util/scripts/maintainers.go: Introduce command line argument handling

Patrick Georgi (Code Review) gerrit at coreboot.org
Mon Nov 12 18:50:16 CET 2018


Patrick Georgi has uploaded this change for review. ( https://review.coreboot.org/29606


Change subject: util/scripts/maintainers.go: Introduce command line argument handling
......................................................................

util/scripts/maintainers.go: Introduce command line argument handling

First new option is -debug.

Change-Id: Ia6e9b3675449a0b1e6f5d7526ee999f925eaadb2
Signed-off-by: Patrick Georgi <pgeorgi at google.com>
---
M util/scripts/maintainers.go
1 file changed, 20 insertions(+), 24 deletions(-)



  git pull ssh://review.coreboot.org:29418/coreboot refs/changes/06/29606/1

diff --git a/util/scripts/maintainers.go b/util/scripts/maintainers.go
index 843a794..6d91b90 100644
--- a/util/scripts/maintainers.go
+++ b/util/scripts/maintainers.go
@@ -15,6 +15,7 @@
 
 import (
 	"bufio"
+	"flag"
 	"fmt"
 	"log"
 	"os"
@@ -287,11 +288,24 @@
 
 func main() {
 	var files []string
-	var maint bool
-	var debug bool
 	var err error
 
-	args := os.Args[1:]
+	var debug = flag.Bool("debug", false, "emit additional debug output")
+	flag.Parse()
+
+	/* get and build subsystem database */
+	maintainers, err := get_maintainers()
+	if err != nil {
+		log.Fatalf("Oops.")
+		return
+	}
+	build_maintainers(maintainers)
+
+	if *debug {
+		print_maintainers()
+	}
+
+	args := flag.Args()
 	if len(args) == 0 {
 		/* get the filenames */
 		files, err = get_git_files()
@@ -299,33 +313,15 @@
 			log.Fatalf("Oops.")
 			return
 		}
-		maint = false
+		for _, file := range files {
+			find_unmaintained(file)
+		}
 	} else {
 		files = args
-		maint = true
-	}
 
-	maintainers, err := get_maintainers()
-	if err != nil {
-		log.Fatalf("Oops.")
-		return
-	}
-
-	/* build subsystem database */
-	build_maintainers(maintainers)
-
-	if debug {
-		print_maintainers()
-	}
-
-	if maint {
 		/* Find maintainers for each file */
 		for _, file := range files {
 			find_maintainer(file)
 		}
-	} else {
-		for _, file := range files {
-			find_unmaintained(file)
-		}
 	}
 }

-- 
To view, visit https://review.coreboot.org/29606
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia6e9b3675449a0b1e6f5d7526ee999f925eaadb2
Gerrit-Change-Number: 29606
Gerrit-PatchSet: 1
Gerrit-Owner: Patrick Georgi <pgeorgi at google.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20181112/9dc9c615/attachment-0001.html>


More information about the coreboot-gerrit mailing list