2023-08-11 14:32:44 +01:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"flag"
|
|
|
|
"fmt"
|
|
|
|
|
2023-08-11 14:38:49 +01:00
|
|
|
"git.fjla.uk/fred.boniface/map-dots/log"
|
|
|
|
"git.fjla.uk/fred.boniface/map-dots/run"
|
2023-08-11 14:32:44 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
|
|
|
showHelp bool
|
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
flag.BoolVar(&showHelp, "help", false, "Show extended help")
|
2023-08-11 14:38:49 +01:00
|
|
|
flag.Usage = run.HelpText
|
2023-08-11 14:32:44 +01:00
|
|
|
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() {
|
2023-08-11 14:38:49 +01:00
|
|
|
log.Msg.Info("Starting map-dots")
|
2023-08-11 14:32:44 +01:00
|
|
|
fmt.Println("\n" + ascii)
|
|
|
|
fmt.Println("Creating art from location data")
|
|
|
|
}
|
|
|
|
|
2023-08-11 14:38:49 +01:00
|
|
|
const ascii string = `███╗ ███╗ █████╗ ██████╗ ██████╗ ██████╗ ████████╗███████╗
|
|
|
|
████╗ ████║██╔══██╗██╔══██╗ ██╔══██╗██╔═══██╗╚══██╔══╝██╔════╝
|
|
|
|
██╔████╔██║███████║██████╔╝█████╗██║ ██║██║ ██║ ██║ ███████╗
|
|
|
|
██║╚██╔╝██║██╔══██║██╔═══╝ ╚════╝██║ ██║██║ ██║ ██║ ╚════██║
|
|
|
|
██║ ╚═╝ ██║██║ ██║██║ ██████╔╝╚██████╔╝ ██║ ███████║
|
|
|
|
╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═════╝ ╚═════╝ ╚═╝ ╚══════╝`
|