Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: modifying how tasks are selected in run command #37

Merged
merged 1 commit into from
Feb 9, 2024

Conversation

ddneilson
Copy link
Contributor

@ddneilson ddneilson commented Feb 9, 2024

What was the problem/requirement? (What/Why)

The way that tasks were selected for running in the run subcommand was ambiguous. For example openjd run -tp Foo=Bar template.json -tp Buz=Baz ... We allowed multiple values to a single -tp argument, and that makes it less clear whether the 'template.json' in there is intended to be the positionl argument or an incorrectly formed -tp value.

What was the solution? (How)

Reworked the way that tasks are selected. We now have:

openjd run template.json --task-param Foo=Bar --task-param Buz=Baz ... # -> Run a single task
openjd run template.json --tasks file://params.json # -> one or more tasks as defined in the file
openjd run template.json --tasks '[{ ... inline json...}]' # -> one or more tasks

That is, the --task-param/-tp option is now exclusively for the case where you want to run a single task, and must be provided once for each task parameter that needs to be defined.

Furthermore, the --task-param/-tp, --tasks, and --maximum-tasks options have been made mutually exclusive.

What is the impact of this change?

A, hopefully, more intuitive interface.

How was this change tested?

I've run it locally as well as updated & added unit tests.

Was this change documented?

Yes, in the README.

Is this a breaking change?

Yes, the CLI options have changed.


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@ddneilson ddneilson requested a review from a team as a code owner February 9, 2024 17:01
@ddneilson ddneilson force-pushed the ddneilson/16562 branch 2 times, most recently from ef7ca9d to 4bf96f0 Compare February 9, 2024 17:32
src/openjd/cli/_run/_run_command.py Outdated Show resolved Hide resolved
Problem:

The way that tasks were selected for running in the `run` subcommand
was ambiguous. For example `openjd run -tp Foo=Bar template.json -tp
Buz=Baz ...` We allowed multiple values to a single `-tp` argument, and
that makes it less clear whether the 'template.json' in there is
intended to be the positionl argument or an incorrectly formed -tp
value.

Solution:

Reworked the way that tasks are selected. We now have:

```bash
openjd run template.json --task-param Foo=Bar --task-param Buz=Baz ... # -> Run a single task
openjd run template.json --tasks file://params.json # -> one or more tasks as defined in the file
openjd run template.json --tasks '[{ ... inline json...}]' # -> one or more tasks

```

That is, the `--task-param/-tp` option is now exclusively for the case
where you want to run a single task, and must be provided once for each
task parameter that needs to be defined.

Furthermore, the `--task-param/-tp`, `--tasks`, and `--maximum-tasks`
options have been made mutually exclusive.

Signed-off-by: Daniel Neilson <53624638+ddneilson@users.noreply.github.com>
@ddneilson ddneilson merged commit 59c41d9 into mainline Feb 9, 2024
15 checks passed
@ddneilson ddneilson deleted the ddneilson/16562 branch February 9, 2024 21:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants