2020-12-24 15:02:19 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/alecthomas/kong"
|
|
|
|
"github.com/mickael-menu/zk/cmd"
|
|
|
|
)
|
|
|
|
|
2021-01-02 11:08:58 +00:00
|
|
|
var Version = "dev"
|
|
|
|
var Build = "dev"
|
|
|
|
|
2020-12-24 15:02:19 +00:00
|
|
|
var cli struct {
|
2021-01-03 13:43:27 +00:00
|
|
|
Index cmd.Index `cmd help:"Index the notes in the given directory to be searchable"`
|
2021-01-02 11:08:58 +00:00
|
|
|
Init cmd.Init `cmd help:"Create a slip box in the given directory"`
|
2021-01-02 17:01:30 +00:00
|
|
|
New cmd.New `cmd help:"Create a new note in the given slip box directory"`
|
2021-01-02 11:08:58 +00:00
|
|
|
Version kong.VersionFlag `help:"Print zk version"`
|
2020-12-24 15:02:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func main() {
|
2020-12-28 12:15:56 +00:00
|
|
|
// Create the dependency graph.
|
|
|
|
container := cmd.NewContainer()
|
2020-12-27 17:58:22 +00:00
|
|
|
|
2021-01-02 11:08:58 +00:00
|
|
|
ctx := kong.Parse(&cli,
|
|
|
|
kong.Name("zk"),
|
|
|
|
kong.Vars{
|
|
|
|
"version": Version,
|
|
|
|
},
|
|
|
|
)
|
2020-12-28 12:15:56 +00:00
|
|
|
err := ctx.Run(container)
|
2020-12-24 15:02:19 +00:00
|
|
|
ctx.FatalIfErrorf(err)
|
|
|
|
}
|