pm5conv/cmd/pm5conv.go
2019-01-01 19:05:48 +01:00

29 lines
458 B
Go

package main
import (
"encoding/json"
"fmt"
"git.gutmet.org/pm5conv.git"
"os"
)
func printUsage() {
fmt.Fprintf(os.Stderr, "Usage: %s PATH_TO_LOGBOOK\n", os.Args[0])
os.Exit(-1)
}
func main() {
if len(os.Args) != 2 {
printUsage()
}
m, errs := pm5conv.ConvWorkouts(os.Args[1])
if len(errs) == 0 {
j, _ := json.MarshalIndent(m, "", " ")
fmt.Println(string(j))
} else {
for _, err := range errs {
fmt.Fprintln(os.Stderr, err)
}
}
}