You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add support for --with CLI flag for task inputs (#184)
## Description
Re-introduced the `--with` command line flag to allow passing task
inputs directly via the CLI. Updated the runner logic, tests, and
documentation to ensure proper handling and validation of inputs
provided through this flag. This enhances flexibility when defining and
running tasks.
...
## Related Issue
Fixes#17
## Type of change
- [ ] Bug fix (non-breaking change which fixes an issue)
- [X] New feature (non-breaking change which adds functionality)
- [ ] Other (security config, docs update, etc)
## Checklist before merging
- [X] Test, docs, adr added or updated as needed
- [X] [Contributor Guide
Steps](https://github.com/defenseunicorns/maru-runner/blob/main/CONTRIBUTING.md)
followed
---------
Co-authored-by: zamaz <[email protected]>
Co-authored-by: Wayne Starr <[email protected]>
Copy file name to clipboardExpand all lines: README.md
+18-1
Original file line number
Diff line number
Diff line change
@@ -217,6 +217,10 @@ Variables can be defined in several ways:
217
217
setVariables:
218
218
- name: FOO
219
219
- cmd: echo ${FOO}
220
+
# Or drop the curly brackets
221
+
- cmd: echo $FOO
222
+
# Or use template syntax
223
+
- cmd: echo ${{ .variables.FOO }}
220
224
```
221
225
222
226
1. As an environment variable prefixed with `MARU_`. In the example above, if you create an env var `MARU_FOO=bar`, then the`FOO` variable would be set to `bar`.
@@ -374,6 +378,8 @@ tasks:
374
378
actions:
375
379
# to use the input, reference it using INPUT_<INPUT_NAME> in all caps
376
380
- cmd: echo $INPUT_HELLO_INPUT
381
+
# or use template syntax
382
+
- cmd: echo ${{ .inputs.hello-input }}
377
383
378
384
- name: use-echo-var
379
385
actions:
@@ -412,4 +418,15 @@ tasks:
412
418
hello-input: hello unicorn
413
419
```
414
420
415
-
Running `run len` will print the length of the inputs to `hello-input` and `another-input` to the console.
421
+
Running `maru run len` will print the length of the inputs to `hello-input` and `another-input` to the console.
422
+
423
+
#### Command Line Flags
424
+
425
+
> [!NOTE]
426
+
> The `--with` command line flag is experimental and likely to change as part of a comprehensive overhaul of the inputs/variables design.
427
+
428
+
When creating a task with `inputs` you can also use the `--with` command line flag. Given the `length-of-inputs` task documented above, you can also run:
429
+
430
+
```shell
431
+
maru run length-of-inputs --with hello-input="hello unicorn"
0 commit comments