blob: 25f48378ce4d6f57099f95b904c36487a8d5526c (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
// SPDX-License-Identifier: GPL-3.0-or-later
// krino-gui is a GTK4 window for krino: review a directory's plan and apply
// the files you choose, look back over runs and undo them, and write rules.
// Every decision is the engine's; see docs/gui-design.md.
package main
import (
"flag"
"fmt"
"os"
"github.com/diamondburned/gotk4/pkg/gtk/v4"
"krino/gui/internal/ui"
"krino/internal/engine"
)
// version is stamped at build time, as krino's is.
var version = "dev"
func main() {
conf := flag.String("c", "", "use FILE instead of ~/.config/krino/krino.conf")
showVersion := flag.Bool("version", false, "print the version and exit")
flag.Parse()
if *showVersion {
fmt.Println("krino-gui " + version)
return
}
e, diags := engine.Load(mainFile(*conf))
if len(diags) > 0 {
printDiags(diags)
os.Exit(2)
}
e.CacheDir = cacheDir()
ui.Version = version
app := gtk.NewApplication("xyz.labunix.krino", 0)
app.ConnectActivate(func() { ui.NewWindow(app, e).Show() })
if code := app.Run(nil); code != 0 {
os.Exit(code)
}
}
|