summaryrefslogtreecommitdiff
path: root/util/scripts
diff options
context:
space:
mode:
authorPatrick Georgi <pgeorgi@google.com>2018-11-12 18:48:40 +0100
committerPatrick Georgi <pgeorgi@google.com>2018-11-13 17:44:23 +0000
commit62a27385fdf770113972793bfffa8514d602144d (patch)
tree0503807f2687d1bbf98bac0f88ce9efbbf3448a3 /util/scripts
parent89bd4892b3f0dc2039bf1d02eabce5c7f1825585 (diff)
downloadcoreboot-62a27385fdf770113972793bfffa8514d602144d.tar.xz
util/scripts/maintainers.go: Introduce command line argument handling
First new option is -debug. Change-Id: Ia6e9b3675449a0b1e6f5d7526ee999f925eaadb2 Signed-off-by: Patrick Georgi <pgeorgi@google.com> Reviewed-on: https://review.coreboot.org/29606 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Diffstat (limited to 'util/scripts')
-rw-r--r--util/scripts/maintainers.go47
1 files changed, 22 insertions, 25 deletions
diff --git a/util/scripts/maintainers.go b/util/scripts/maintainers.go
index 4d6cb7d822..e4c2387398 100644
--- a/util/scripts/maintainers.go
+++ b/util/scripts/maintainers.go
@@ -15,6 +15,7 @@ package main
import (
"bufio"
+ "flag"
"fmt"
"log"
"os"
@@ -258,46 +259,42 @@ func glob_to_regex(glob string) string {
}
func main() {
- var files []string
- var maint bool
- var debug bool
- var err error
-
- args := os.Args[1:]
- if len(args) == 0 {
- /* get the filenames */
- files, err = get_git_files()
- if err != nil {
- log.Fatalf("Oops.")
- return
- }
- maint = false
- } else {
- files = args
- maint = true
- }
+ var (
+ files []string
+ err error
+ 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 subsystem database */
build_maintainers(maintainers)
- if debug {
+ if *debug {
print_maintainers()
}
- if maint {
- /* Find maintainers for each file */
+ args := flag.Args()
+ if len(args) == 0 {
+ /* get the filenames */
+ files, err = get_git_files()
+ if err != nil {
+ log.Fatalf("Oops.")
+ return
+ }
for _, file := range files {
- find_maintainer(file)
+ find_unmaintained(file)
}
} else {
+ files = args
+
+ /* Find maintainers for each file */
for _, file := range files {
- find_unmaintained(file)
+ find_maintainer(file)
}
}
}