/** * Yats - yats * * This file is licensed under the Affero General Public License version 3 or * later. See the COPYING file. * * @author Paolo Lulli * @copyright Paolo Lulli 2024 */ package main import ( "fmt" "os" "yats/config" flag "github.com/spf13/pflag" ) type YatsClient struct { config config.ClientConfiguration } func main() { var configPath string if len(os.Args) == 1 { fmt.Printf("For usage: %s --help\n", os.Args[0]) os.Exit(1) } fmt.Println("Loading default config") configPath = os.Getenv("HOME") + "/.yats-client.json" cfg := config.GetClientConfig(configPath) var yatsClient = YatsClient{config: cfg} isMetricOption := flag.BoolP("isMetric", "m", false, "Select Metric") fromOption := flag.Int64("from", 0, "From tstamp") toOption := flag.Int64("to", 0, "To tstamp") metricNameOption := flag.StringP("metricName", "n", "", "Metric name") flag.Parse() if *isMetricOption { listResponse := yatsClient.MetricList(*metricNameOption, *fromOption, *toOption) fmt.Printf("Metric list: %s", listResponse) } else { listEvents := yatsClient.EventList(*fromOption, *toOption) fmt.Printf("Event list: %s", listEvents) } }