2024-05-28 14:29:13 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2024-09-25 10:48:01 +00:00
|
|
|
"flag"
|
|
|
|
"fmt"
|
2024-09-12 12:29:43 +00:00
|
|
|
"os"
|
2024-06-10 15:34:16 +00:00
|
|
|
"sevenkeys/cli"
|
2024-06-10 12:32:45 +00:00
|
|
|
"sevenkeys/database"
|
2024-06-10 15:34:16 +00:00
|
|
|
"sevenkeys/figlet"
|
2024-05-28 14:29:13 +00:00
|
|
|
)
|
|
|
|
|
2024-09-25 10:48:01 +00:00
|
|
|
const (
|
2024-09-25 16:49:01 +00:00
|
|
|
ImportSubcommand string = "import"
|
2024-09-25 10:48:01 +00:00
|
|
|
)
|
|
|
|
|
2024-05-28 14:29:13 +00:00
|
|
|
func main() {
|
2024-09-25 16:49:01 +00:00
|
|
|
profile := os.Getenv("SEVENKEYS_PROFILE")
|
2024-09-25 10:48:01 +00:00
|
|
|
|
|
|
|
db := database.GetDatabaseFromConfig("config." + profile + ".json")
|
2024-09-05 11:22:02 +00:00
|
|
|
figlet.ReadFigletFonts()
|
2024-06-10 15:34:16 +00:00
|
|
|
cli.ShowSplashScreen()
|
|
|
|
cli.RunUpdateCheck(db)
|
2024-05-28 14:29:13 +00:00
|
|
|
|
2024-09-25 16:49:01 +00:00
|
|
|
// TODO: Decide in what form we need to retain this functionality if any
|
|
|
|
//cli.MainCliLoop(db)
|
|
|
|
|
|
|
|
importCmd := flag.NewFlagSet("import", flag.ExitOnError)
|
|
|
|
storageArea := importCmd.String("storagearea", "", "The name of the StorageArea where cards should be imported.")
|
|
|
|
|
|
|
|
if len(os.Args) < 2 {
|
|
|
|
fmt.Fprintln(os.Stderr, "Please specify a subcommand.")
|
|
|
|
os.Exit(1)
|
|
|
|
}
|
|
|
|
|
|
|
|
switch os.Args[1] {
|
|
|
|
case ImportSubcommand:
|
2024-09-25 10:48:01 +00:00
|
|
|
// TODO: Get filename, run import code
|
2024-09-25 16:49:01 +00:00
|
|
|
importCmd.Parse(os.Args[2:])
|
|
|
|
//storageAreaId := logic.GetStorageAreaIdByName(db, *storageArea)
|
|
|
|
|
|
|
|
fmt.Printf("Filename: %s\n", importCmd.Args()[0])
|
2024-09-25 10:48:01 +00:00
|
|
|
break
|
|
|
|
default:
|
2024-09-25 16:49:01 +00:00
|
|
|
fmt.Fprintf(os.Stderr, "Unrecognized subcommand: %s\n", os.Args[1])
|
2024-09-25 10:48:01 +00:00
|
|
|
break
|
|
|
|
}
|
2024-05-28 14:29:13 +00:00
|
|
|
}
|