gridsq/cmd/ft8grid/main.go

46 lines
761 B
Go

package main
import (
"flag"
"fmt"
"git.wntrmute.dev/kyle/goutils/die"
"git.wntrmute.dev/kyle/gridsq/ft8"
"path/filepath"
)
func main() {
defaultDir := ft8.GetDefaultDirectory()
defaultLog := filepath.Join(defaultDir, "ALL.TXT")
var logFile string
flag.StringVar(&logFile, "f", defaultLog, "path to logfile")
flag.Parse()
if flag.NArg() == 0 {
die.With("No callsign specified!")
}
records, err := ft8.ProcessFile(logFile)
die.If(err)
grids := map[string]bool{}
who := flag.Arg(0)
fmt.Println("find grid for ", who)
for _, rec := range records {
if !rec.HasGrid() {
continue
}
if rec.De != who {
continue
}
if grids[rec.Grid] {
continue
}
grids[rec.Grid] = true
fmt.Printf("%s: %s\n", rec.De, rec.Grid)
}
}