dict @ a588d9d52b32193dd24329aec21befaf3f8c3c32

 1package main
 2
 3import (
 4	"fmt"
 5	"log/slog"
 6	"os"
 7	"path/filepath"
 8
 9	"github.com/urfave/cli/v2"
10
11	"git.gabrielgio.me/dict/cmd/importer"
12	"git.gabrielgio.me/dict/cmd/server"
13	"git.gabrielgio.me/dict/cmd/ui"
14	"git.gabrielgio.me/dict/db"
15)
16
17var Version = "local"
18
19func main() {
20	app := &cli.App{
21		Name:  "dict",
22		Usage: "interactive dictionary",
23		Commands: []*cli.Command{
24			importer.ImportCommand,
25			ui.UICommand,
26			server.ServeCommand,
27			{
28				Name:  "version",
29				Usage: "print current version",
30				Flags: []cli.Flag{},
31				Action: func(cCtx *cli.Context) error {
32					fmt.Printf("%s - %s\n\n", filepath.Base(os.Args[0]), Version)
33					fmt.Printf("Spellfix locaton: %s.so", db.LibPath)
34					return nil
35				},
36			},
37		},
38	}
39
40	if err := app.Run(os.Args); err != nil {
41		slog.Error("Error running application", "error", err)
42		os.Exit(1)
43	}
44}