generated from dogmatiq/template-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
root.go
39 lines (33 loc) 路 823 Bytes
/
root.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
package commands
import (
"os"
"github.com/dogmatiq/dogmacli/cmd/dogma/internal/commands/lsp"
"github.com/dogmatiq/dogmacli/cmd/dogma/internal/commands/visualize"
"github.com/dogmatiq/imbue"
"github.com/spf13/cobra"
)
// Root returns the root "dogma" command.
func Root(con *imbue.Container, ver string) *cobra.Command {
cmd := &cobra.Command{
Use: "dogma",
DisableFlagsInUseLine: true,
Version: ver,
Short: "Dogma command-line",
PersistentPreRun: func(cmd *cobra.Command, args []string) {
imbue.With0(
con,
func(imbue.Context) (*cobra.Command, error) {
return cmd, nil
},
)
},
}
cmd.SetIn(os.Stdin)
cmd.SetOut(os.Stdout)
cmd.SetErr(os.Stderr)
cmd.AddCommand(
lsp.Command(con),
visualize.Command(con),
)
return cmd
}