TheMathemagicians/sevenkeys/main.go

45 lines
839 B
Go
Raw Normal View History

2024-05-28 14:29:13 +00:00
package main
import (
"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
)
type ModeOfOperation string
const (
ModeImport ModeOfOperation = "import"
ModeInteractive = "interactive"
)
2024-05-28 14:29:13 +00:00
func main() {
2024-09-12 12:29:43 +00:00
var profile string
flag.StringVar(&profile, "profile", "production", "the database profile to use")
2024-06-10 12:32:45 +00:00
modePtr := flag.String("mode", "interactive", "the mode of operation")
flag.Parse()
mode := ModeOfOperation(*modePtr)
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
switch mode {
case ModeImport:
// TODO: Get filename, run import code
break
case ModeInteractive:
cli.MainCliLoop(db)
break
default:
fmt.Fprintf(os.Stderr, "Unrecognized mode: %s\n", mode)
break
}
2024-05-28 14:29:13 +00:00
}