inline measure glob

This commit is contained in:
Mark McGranaghan 2012-10-01 19:13:07 -07:00
parent e84e68b481
commit afefc4e649
4 changed files with 6 additions and 13 deletions

2
.gitignore vendored
View File

@ -1,5 +1,5 @@
build
tool/build-html-inner
tool/number
tool/measure-inner
tool/measure

View File

@ -4,4 +4,4 @@ set -e
go build -o tool/build-html-inner tool/src/build-html-inner.go
go build -o tool/number tool/src/number.go
go build -o tool/measure-inner tool/src/measure-inner.go
go build -o tool/measure tool/src/measure.go

View File

@ -1,6 +0,0 @@
#!/bin/bash
set -e
set -o pipefail
ls src/0*/*.{go,sh} | xargs tool/measure-inner

View File

@ -4,6 +4,7 @@ import (
"fmt"
"io/ioutil"
"os"
"path/filepath"
"strings"
)
@ -20,12 +21,10 @@ func readLines(path string) []string {
}
func main() {
if len(os.Args) <= 1 {
fmt.Fprintln(os.Stderr, "usage: tool/measure *.{go,sh}")
os.Exit(1)
}
sourcePaths, err := filepath.Glob("./src/0*/*")
check(err)
foundLongFile := false
for _, sourcePath := range os.Args[1:] {
for _, sourcePath := range sourcePaths {
foundLongLine := false
lines := readLines(sourcePath)
for _, line := range lines {