Skip to content

Commit b0b323e

Browse files
committed
refactor: allow arbitrary pipeline args
1 parent 49248e6 commit b0b323e

4 files changed

Lines changed: 4 additions & 14 deletions

File tree

cmd/deploy.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ devspace deploy
2828
devspace deploy -n some-namespace
2929
devspace deploy --kube-context=deploy-context
3030
#######################################################`,
31-
Args: cobra.NoArgs,
3231
RunE: func(cobraCmd *cobra.Command, args []string) error {
3332
return cmd.Run(cobraCmd, args, f, "deployCommand")
3433
},

cmd/dev.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ func NewDevCmd(f factory.Factory, globalFlags *flags.GlobalFlags, rawConfig *Raw
2323
#######################################################
2424
Starts your project in development mode
2525
#######################################################`,
26-
Args: cobra.NoArgs,
2726
RunE: func(cobraCmd *cobra.Command, args []string) error {
2827
return cmd.Run(cobraCmd, args, f, "devCommand")
2928
},

cmd/purge.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ Deletes the deployed kubernetes resources:
2626
2727
devspace purge
2828
#######################################################`,
29-
Args: cobra.NoArgs,
3029
RunE: func(cobraCmd *cobra.Command, args []string) error {
3130
return cmd.Run(cobraCmd, args, f, "purgeCommand")
3231
},

cmd/run_pipeline.go

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -210,18 +210,11 @@ func (cmd *RunPipelineCmd) RunDefault(f factory.Factory) error {
210210

211211
// Run executes the command logic
212212
func (cmd *RunPipelineCmd) Run(cobraCmd *cobra.Command, args []string, f factory.Factory, hookName string) error {
213-
dashArgs := []string{}
214-
if cobraCmd != nil && cobraCmd.ArgsLenAtDash() > -1 {
215-
dashArgs = args[cobraCmd.ArgsLenAtDash():]
216-
args = args[:cobraCmd.ArgsLenAtDash()]
217-
}
218-
219-
if len(args) > 1 {
220-
return fmt.Errorf("please specify only 1 pipeline to execute (got %v). E.g. devspace run-pipeline my-pipe -- other args", args)
221-
} else if len(args) == 0 && cmd.Pipeline == "" {
213+
if len(args) == 0 && cmd.Pipeline == "" {
222214
return fmt.Errorf("please specify a pipeline through --pipeline or argument")
223-
} else if len(args) == 1 && cmd.Pipeline == "" {
215+
} else if len(args) > 0 && cmd.Pipeline == "" {
224216
cmd.Pipeline = args[0]
217+
args = args[1:]
225218
}
226219

227220
if cmd.Log == nil {
@@ -259,7 +252,7 @@ func (cmd *RunPipelineCmd) Run(cobraCmd *cobra.Command, args []string, f factory
259252
}
260253

261254
return runWithHooks(ctx, hookName, func() error {
262-
return runPipeline(ctx, dashArgs, options)
255+
return runPipeline(ctx, args, options)
263256
})
264257
}
265258

0 commit comments

Comments
 (0)