package main import ( "fmt" "log/slog" "git.andreafazzi.eu/andrea/probo/lib/store/file" "github.com/urfave/cli/v2" ) func importCSV(cCtx *cli.Context) error { path := cCtx.Args().First() if path == "" { return cli.Exit("Path for the CSV file not given.", 1) } pStore, err := file.NewParticipantDefaultFileStore() if err != nil { return cli.Exit(fmt.Sprintf("An error occurred: %v", err), 1) } participants, err := pStore.ImportCSV(path) if err != nil { return cli.Exit(fmt.Sprintf("An error occurred: %v", err), 1) } slog.Info("Imported participants from csv file", "nParticipants", len(participants)) return nil }