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