-
Notifications
You must be signed in to change notification settings - Fork 3
/
main.go
51 lines (43 loc) · 1.1 KB
/
main.go
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
45
46
47
48
49
50
51
package main
import (
"fmt"
"runtime"
"strings"
"github.com/alecthomas/kong"
"github.com/falzm/fsdiff/internal/version"
)
func init() {
}
func main() {
rootCmd := struct {
Snapshot snapshotCmd `cmd:"" aliases:"snap" help:"Scan file tree and record object properties."`
Diff diffCmd `cmd:"" help:"Show the differences between 2 snapshots."`
Dump dumpCmd `cmd:"" help:"Dump snapshot information."`
Version kong.VersionFlag `short:"v" help:"Print version information and quit."`
}{}
app := kong.Parse(
&rootCmd,
kong.Name("fsdiff"),
kong.Description(
"fsdiff reports what changes occurred in a filesystem tree.",
),
kong.ConfigureHelp(kong.HelpOptions{
Compact: true,
FlagsLast: true,
}),
kong.UsageOnError(),
kong.Vars{
"diff_file_properties": strings.Join(diffFileProperties, ", "),
"version": fmt.Sprintf(
"fsdiff %s (commit: %s) %s\nbuild info: Go %s (%s)",
version.Version,
version.Commit,
version.BuildDate,
runtime.Version(),
runtime.Compiler,
),
},
)
app.BindTo(*app, (*kong.Context)(nil))
app.FatalIfErrorf(app.Run())
}