123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- package main
- import (
- "log"
- "log/slog"
- "os"
- "time"
- "git.andreafazzi.eu/andrea/probo/pkg/store/file"
- "github.com/lmittmann/tint"
- "github.com/urfave/cli"
- )
- func main() {
- slog.SetDefault(slog.New(
- tint.NewHandler(os.Stdout, &tint.Options{
- Level: slog.LevelInfo,
- TimeFormat: time.Kitchen,
- }),
- ))
- _, err := os.Stat(file.DefaultBaseDir)
- if err != nil {
- slog.Info("Base directory not found. Creating the folder structure...")
- for _, dir := range file.Dirs {
- err := os.MkdirAll(dir, os.ModePerm)
- if err != nil {
- log.Fatal(err)
- }
- slog.Info("Create", "directory", dir)
- }
- slog.Info("Folder structure created without issues.")
- os.Exit(0)
- }
- app := &cli.App{
- Name: "probo-cli",
- Usage: "Quiz Management System for Hackers!",
- Commands: []*cli.Command{
- {
- Name: "session",
- Aliases: []string{"s"},
- Usage: "options for command 'session'",
- Subcommands: []*cli.Command{
- {
- Name: "push",
- Usage: "Create a new exam session",
- Action: push,
- },
- {
- Name: "pull",
- Usage: "Download responses from a session",
- Action: pull,
- },
- {
- Name: "scores",
- Usage: "Show the scores for the given session",
- Action: scores,
- },
- },
- },
- {
- Name: "participant",
- Aliases: []string{"p"},
- Usage: "options for command 'participant'",
- Subcommands: []*cli.Command{
- {
- Name: "import",
- Usage: "Import participants from a CSV file",
- Action: importCSV,
- },
- },
- },
- },
- }
- if err := app.Run(os.Args); err != nil {
- log.Fatal(err)
- }
- }
|