X-Git-Url: https://ruderich.org/simon/gitweb/?a=blobdiff_plain;f=cmd%2Fsafcm-remote%2Fmain.go;fp=cmd%2Fsafcm-remote%2Fmain.go;h=64889c5a16180a06387754f8e68071439d913eed;hb=77197f737073b551e216e55e30c41ebac53a0219;hp=9c58d3af8175c337aa60a2b47bc1383105cc0226;hpb=3b727d74f76503b1306a81318025ed7772c884c3;p=safcm%2Fsafcm.git diff --git a/cmd/safcm-remote/main.go b/cmd/safcm-remote/main.go index 9c58d3a..64889c5 100644 --- a/cmd/safcm-remote/main.go +++ b/cmd/safcm-remote/main.go @@ -29,19 +29,31 @@ import ( "ruderich.org/simon/safcm/cmd/safcm-remote/sync" ) +func usage() { + log.Fatalf("usage: %[1]s sync\n"+ + "usage: %[1]s ainsl [options] ", + os.Args[0]) +} + func main() { // Timestamps are added by `safcm` log.SetFlags(0) + if len(os.Args) < 2 { + usage() + } + var err error - if len(os.Args) == 1 { + switch os.Args[1] { + case "sync": + if len(os.Args) != 2 { + usage() + } err = mainLoop() - } else if len(os.Args) >= 2 && os.Args[1] == "ainsl" { + case "ainsl": err = ainsl.Main(os.Args) - } else { - log.Fatalf("usage: %[1]s\n"+ - "usage: %[1]s ainsl [options] ", - os.Args[0]) + default: + usage() } if err != nil {