512 classes[c]*100/len(items)) |
512 classes[c]*100/len(items)) |
513 } |
513 } |
514 } |
514 } |
515 |
515 |
516 func main() { |
516 func main() { |
517 inFile := flag.String([]string{"-input-file", "i"}, "", "Input JSON file") |
517 inFile := flag.StringP("input-file", "i", "", "Input JSON file") |
518 outFile := flag.String([]string{"-output-file", "o"}, "", "Output JSON file") |
518 outFile := flag.StringP("output-file", "o", "", "Output JSON file") |
519 limit := flag.Uint([]string{"-limit", "l"}, 0, "Limit number of items to N first") |
519 limit := flag.UintP("limit", "l", 0, "Limit number of items to N first") |
520 toDate := flag.String([]string{"-to-date"}, "", |
520 toDate := flag.String("to-date", "", "Filter records before date (YYYY-mm-dd HH:MM:SS)") |
521 "Filter records before date (YYYY-mm-dd HH:MM:SS)") |
521 fromDate := flag.String("from-date", "", "Filter records from date (YYYY-mm-dd HH:MM:SS)") |
522 fromDate := flag.String([]string{"-from-date", "-since"}, "", |
522 format := flag.StringP("format", "f", "", "Output format (csv, json)") |
523 "Filter records from date (YYYY-mm-dd HH:MM:SS)") |
523 avg := flag.BoolP("average", "a", false, "Compute average") |
524 format := flag.String([]string{"-format", "f"}, "", "Output format (csv, json)") |
524 stats := flag.Bool("stats", false, "Compute statistics") |
525 avg := flag.Bool([]string{"-average", "a"}, false, "Compute average") |
525 whoClass := flag.BoolP("class", "c", false, "Display WHO classification") |
526 stats := flag.Bool([]string{"-stats"}, false, "Compute statistics") |
526 merge := flag.BoolP("merge", "m", false, "Try to merge input JSON file with fetched data") |
527 whoClass := flag.Bool([]string{"-class", "c"}, false, "Display WHO classification") |
527 device := flag.StringP("device", "d", "/dev/ttyUSB0", "Serial device") |
528 merge := flag.Bool([]string{"-merge", "m"}, false, |
528 fromTime := flag.String("from-time", "", "Select records after time (HH:MM)") |
529 "Try to merge input JSON file with fetched data") |
529 toTime := flag.String("to-time", "", "Select records bofore time (HH:MM)") |
530 device := flag.String([]string{"-device", "d"}, "/dev/ttyUSB0", "Serial device") |
530 |
531 fromTime := flag.String([]string{"-from-time"}, "", "Select records after time (HH:MM)") |
531 flag.StringVar(fromDate, "since", "", "Same as --from-date") |
532 toTime := flag.String([]string{"-to-time"}, "", "Select records bofore time (HH:MM)") |
|
533 |
532 |
534 var startTime, endTime simpleTime |
533 var startTime, endTime simpleTime |
535 |
534 |
536 flag.Parse() |
535 flag.Parse() |
537 |
536 |