Added another cla

This commit is contained in:
Mihalis Tsoukalos 2019-06-13 09:39:39 +03:00
commit d2c545bee3

View file

@ -31,8 +31,8 @@ func meanValue(x []float64) float64 {
func main() {
flag.Parse()
if len(flag.Args()) == 0 {
fmt.Printf("usage: stats filename\n")
if len(flag.Args()) != 2 {
fmt.Printf("usage: stats filename limit\n")
return
}
@ -44,6 +44,12 @@ func main() {
}
defer f.Close()
limit, err := strconv.ParseFloat(flag.Args()[1], 64)
if err == nil {
fmt.Println(err)
return
}
data := make([]float64, 0)
r := bufio.NewReader(f)
for {