TheMathemagicians/sevenkeys/main.go

45 lines
839 B
Go

package main
import (
"flag"
"fmt"
"os"
"sevenkeys/cli"
"sevenkeys/database"
"sevenkeys/figlet"
)
type ModeOfOperation string
const (
ModeImport ModeOfOperation = "import"
ModeInteractive = "interactive"
)
func main() {
var profile string
flag.StringVar(&profile, "profile", "production", "the database profile to use")
modePtr := flag.String("mode", "interactive", "the mode of operation")
flag.Parse()
mode := ModeOfOperation(*modePtr)
db := database.GetDatabaseFromConfig("config." + profile + ".json")
figlet.ReadFigletFonts()
cli.ShowSplashScreen()
cli.RunUpdateCheck(db)
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
}
}