@@ -3,7 +3,6 @@ package cmd
3
3
import (
4
4
"strings"
5
5
6
- "github.com/apex/log"
7
6
"github.com/spf13/cobra"
8
7
"github.com/tarantool/tt/cli/modules"
9
8
)
@@ -50,8 +49,7 @@ func configureNonExistentCmd(rootCmd *cobra.Command,
50
49
51
50
externalCmdPath := rootCmd .Name () + " " + externalCmd
52
51
if _ , found := (* modulesInfo )[externalCmdPath ]; found {
53
- rootCmd .AddCommand (newExternalCommand (modulesInfo , externalCmd ,
54
- externalCmdPath ))
52
+ rootCmd .AddCommand (newExternalCmd (externalCmd ))
55
53
}
56
54
}
57
55
@@ -65,20 +63,14 @@ func externalCmdHelpFunc(cmd *cobra.Command, args []string) {
65
63
cmd .Print (helpMsg )
66
64
}
67
65
68
- // newExternalCommand returns a pointer to a new external
66
+ // newExternalCmd returns a pointer to a new external
69
67
// command that will call modules.RunCmd.
70
- func newExternalCommand (modulesInfo * modules.ModulesInfo ,
71
- cmdName , cmdPath string ) * cobra.Command {
72
- cmd := & cobra.Command {
73
- Use : cmdName ,
74
- Run : func (cmd * cobra.Command , args []string ) {
75
- cmdCtx .Cli .ForceInternal = false
76
- if err := modules .RunCmd (& cmdCtx , cmdPath , modulesInfo , nil , args ); err != nil {
77
- log .Fatalf (err .Error ())
78
- }
79
- },
68
+ func newExternalCmd (cmdName string ) * cobra.Command {
69
+ var cmd = & cobra.Command {
70
+ Use : cmdName ,
71
+ Run : RunModuleFunc (nil ),
72
+ DisableFlagParsing : true ,
80
73
}
81
- cmd .DisableFlagParsing = true
82
74
cmd .SetHelpFunc (externalCmdHelpFunc )
83
75
return cmd
84
76
}
0 commit comments