map-dots/main.go

52 lines
2.0 KiB
Go

package main
import (
"flag"
"fmt"
"git.fjla.uk/fred.boniface/map-dots/log"
"git.fjla.uk/fred.boniface/map-dots/run"
)
var (
showHelp bool
)
func main() {
flag.BoolVar(&showHelp, "help", false, "Show extended help")
flag.Usage = run.HelpText
serverMode := flag.Bool("server", false, "Run as an API server - Omit all other flags if running as server")
height := flag.Uint64("height", 600, "Output image height")
width := flag.Uint64("width", 800, "Output image width")
style := flag.String("style", "circles", "Output image style")
format := flag.String("format", "png", "Output image format")
input := flag.String("in", "traccar", "Input source - can be 'filepath' or 'traccar'")
flag.Parse()
if showHelp {
flag.Usage()
return
}
if *serverMode {
run.Server()
} else {
run.CLI(*height, *width, *style, *format, *input)
}
}
func init() {
log.Msg.Info("Starting map-dots")
fmt.Print(ascii)
fmt.Println("Creating art from location data")
}
const ascii string = `
███╗ ███╗ █████╗ ██████╗ ██████╗ ██████╗ ████████╗███████╗
████╗ ████║██╔══██╗██╔══██╗ ██╔══██╗██╔═══██╗╚══██╔══╝██╔════╝
██╔████╔██║███████║██████╔╝█████╗██║ ██║██║ ██║ ██║ ███████╗
██║╚██╔╝██║██╔══██║██╔═══╝ ╚════╝██║ ██║██║ ██║ ██║ ╚════██║
██║ ╚═╝ ██║██║ ██║██║ ██████╔╝╚██████╔╝ ██║ ███████║
╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═════╝ ╚═════╝ ╚═╝ ╚══════╝
`