-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
52 lines (43 loc) · 1.08 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
52
package main
import (
"log"
"github.com/spf13/cobra"
"github.com/iftechio/jki/pkg/cmd/build"
"github.com/iftechio/jki/pkg/cmd/completion"
"github.com/iftechio/jki/pkg/cmd/config"
"github.com/iftechio/jki/pkg/cmd/cp"
"github.com/iftechio/jki/pkg/cmd/deploy"
"github.com/iftechio/jki/pkg/cmd/pull"
"github.com/iftechio/jki/pkg/cmd/transferimage"
"github.com/iftechio/jki/pkg/cmd/upgrade"
"github.com/iftechio/jki/pkg/cmd/version"
"github.com/iftechio/jki/pkg/configflags"
"github.com/iftechio/jki/pkg/factory"
)
type Commander func(factory.Factory) *cobra.Command
func main() {
cf := configflags.New()
f := factory.New(cf)
rootCmd := cobra.Command{
Use: "jki",
}
cf.AddFlags(rootCmd.PersistentFlags())
commanders := []Commander{
build.NewCmdBuild,
completion.NewCmdCompletion,
config.NewCmdConfig,
cp.NewCmdCp,
deploy.NewCmdDeploy,
pull.NewCmdPull,
transferimage.NewCmdTransferImage,
upgrade.NewCmdUpgrade,
version.NewCmdVersion,
}
for _, c := range commanders {
rootCmd.AddCommand(c(f))
}
err := rootCmd.Execute()
if err != nil {
log.Fatal(err)
}
}