cmd: test: would always run testCmdGlobalInit

This commit is contained in:
Christian Schwarz 2017-09-17 23:40:40 +02:00
parent 9cd83399d3
commit 1a62d635a6

View File

@ -16,8 +16,9 @@ import (
)
var testCmd = &cobra.Command{
Use: "test",
Short: "test configuration",
Use: "test",
Short: "test configuration",
PersistentPreRun: testCmdGlobalInit,
}
var testCmdGlobal struct {
@ -51,7 +52,6 @@ var testPrunePolicyCmd = &cobra.Command{
}
func init() {
cobra.OnInitialize(testCmdGlobalInit)
RootCmd.AddCommand(testCmd)
testCmd.AddCommand(testConfigSyntaxCmd)
testCmd.AddCommand(testDatasetMapFilter)
@ -62,7 +62,7 @@ func init() {
testCmd.AddCommand(testPrunePolicyCmd)
}
func testCmdGlobalInit() {
func testCmdGlobalInit(cmd *cobra.Command, args []string) {
testCmdGlobal.log = log.New(os.Stdout, "", 0)