@@ -77,7 +77,7 @@ devspace --dependency my-dependency run any-command --any-command-flag
7777
7878 if rawConfig != nil && rawConfig .Config != nil {
7979 for _ , cmd := range rawConfig .Config .Commands {
80- runCmd .AddCommand (NewSpecificRunCommand (f , globalFlags , cmd , rawConfig . Resolver . ResolvedVariables () ))
80+ runCmd .AddCommand (NewSpecificRunCommand (cmd ))
8181 }
8282 }
8383 runCmd .Flags ().StringVar (& cmd .Dependency , "dependency" , "" , "Run a command from a specific dependency" )
@@ -309,7 +309,7 @@ func ExecuteCommand(ctx context.Context, cmd *latest.CommandConfig, variables ma
309309 return command .CommandWithEnv (ctx , dir , stdout , stderr , stdin , extraEnv , shellCommand , shellArgs ... )
310310}
311311
312- // RunCommandCmd holds the cmd flags of an run command
312+ // RunCommandCmd holds the cmd flags of a run command
313313type RunCommandCmd struct {
314314 * flags.GlobalFlags
315315
@@ -321,15 +321,7 @@ type RunCommandCmd struct {
321321}
322322
323323// NewSpecificRunCommand creates a new run command
324- func NewSpecificRunCommand (f factory.Factory , globalFlags * flags.GlobalFlags , command * latest.CommandConfig , variables map [string ]interface {}) * cobra.Command {
325- cmd := & RunCommandCmd {
326- GlobalFlags : globalFlags ,
327- Command : command ,
328- Variables : variables ,
329- Stdout : os .Stdout ,
330- Stderr : os .Stderr ,
331- }
332-
324+ func NewSpecificRunCommand (command * latest.CommandConfig ) * cobra.Command {
333325 description := command .Description
334326 longDescription := command .Description
335327 if description == "" {
@@ -348,24 +340,9 @@ func NewSpecificRunCommand(f factory.Factory, globalFlags *flags.GlobalFlags, co
348340 Long : longDescription ,
349341 Args : cobra .ArbitraryArgs ,
350342 RunE : func (cobraCmd * cobra.Command , originalArgs []string ) error {
351- args , err := ParseArgs (cobraCmd , cmd .GlobalFlags , f .GetLog ())
352- if err != nil {
353- return err
354- }
355-
356- if cmd .ConfigPath != "" {
357- return cobraCmd .Parent ().RunE (cobraCmd , originalArgs )
358- }
359-
360- plugin .SetPluginCommand (cobraCmd , args )
361- return cmd .Run (f , args )
343+ return cobraCmd .Parent ().RunE (cobraCmd , originalArgs )
362344 },
363345 }
364346 runCmd .DisableFlagParsing = true
365347 return runCmd
366348}
367-
368- func (cmd * RunCommandCmd ) Run (f factory.Factory , args []string ) error {
369- devCtx := devspacecontext .NewContext (context .Background (), cmd .Variables , f .GetLog ())
370- return executeCommandWithAfter (devCtx .Context (), cmd .Command , args , cmd .Variables , devCtx .WorkingDir (), cmd .Stdout , cmd .Stderr , os .Stdin , devCtx .Log ())
371- }
0 commit comments