Skip to content

Commit

Permalink
fix(lhctl): Fix argument indexes on schedule run command (#1198)
Browse files Browse the repository at this point in the history
  • Loading branch information
Snarr authored Dec 16, 2024
1 parent a920642 commit 0a13936
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lhctl/internal/wf_run.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ var scheduleWfCmd = &cobra.Command{

// Now parse variables
if len(args) > 2 {
if len(args)%2 != 1 {
if len(args)%2 == 1 {
log.Fatal(`
If you provide variables, you must provide pairs of <name, val>.
Therefore, you must have an even number of args after the WfSpec Id, for an
Expand All @@ -245,15 +245,15 @@ odd total number of args. See 'lhctl run --help' for details.`)
wfSpec, err = getGlobalClient(cmd).GetLatestWfSpec(
requestContext(cmd),
&lhproto.GetLatestWfSpecRequest{
Name: args[0],
Name: wfSpecName,
MajorVersion: majorVersion,
},
)
} else {
wfSpec, err = getGlobalClient(cmd).GetWfSpec(
requestContext(cmd),
&lhproto.WfSpecId{
Name: args[0],
Name: wfSpecName,
MajorVersion: *majorVersion,
Revision: *revision,
})
Expand All @@ -266,7 +266,7 @@ odd total number of args. See 'lhctl run --help' for details.`)
scheduleWfReq.Variables = make(map[string]*lhproto.VariableValue)
varDefs := littlehorse.GetInputVarDefs(wfSpec)

for i := 1; i+1 < len(args); i += 2 {
for i := 2; i+1 < len(args); i += 2 {
varName := args[i]
varValStr := args[i+1]

Expand Down

0 comments on commit 0a13936

Please sign in to comment.