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>
This commit is contained in:
parent
89bd4892b3
commit
62a27385fd
|
@ -15,6 +15,7 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bufio"
|
"bufio"
|
||||||
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
|
@ -258,12 +259,26 @@ func glob_to_regex(glob string) string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
var files []string
|
var (
|
||||||
var maint bool
|
files []string
|
||||||
var debug bool
|
err error
|
||||||
var err error
|
debug = flag.Bool("debug", false, "emit additional debug output")
|
||||||
|
)
|
||||||
|
flag.Parse()
|
||||||
|
|
||||||
args := os.Args[1:]
|
/* 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 {
|
if len(args) == 0 {
|
||||||
/* get the filenames */
|
/* get the filenames */
|
||||||
files, err = get_git_files()
|
files, err = get_git_files()
|
||||||
|
@ -271,33 +286,15 @@ func main() {
|
||||||
log.Fatalf("Oops.")
|
log.Fatalf("Oops.")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
maint = false
|
for _, file := range files {
|
||||||
|
find_unmaintained(file)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
files = args
|
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 */
|
/* Find maintainers for each file */
|
||||||
for _, file := range files {
|
for _, file := range files {
|
||||||
find_maintainer(file)
|
find_maintainer(file)
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
for _, file := range files {
|
|
||||||
find_unmaintained(file)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue