/
ns_exec.qmd
46 lines (37 loc) · 2.89 KB
/
ns_exec.qmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
---
title: "Viash Ns Exec"
search: true
---
Execute a command for all found Viash components.
The syntax of this command is inspired by `find . -exec echo {} \;`.
The following fields are automatically replaced:
* `{}` | `{path}`: path to the config file
* `{abs-path}`: absolute path to the config file
* `{dir}`: path to the parent directory of the config file
* `{abs-dir}`: absolute path to the directory of the config file
* `{main-script}`: path to the main script (if any)
* `{abs-main-script}`: absolute path to the main script (if any)
* `{functionality-name}`: name of the component
* `{namespace}`: namespace of the component
* `{platform}`: selected platform id (only when --apply_platform is used)
* `{output}`: path to the destination directory when building the component
* `{abs-output}`: absolute path to the destination directory when building the component
A command suffixed by `\;` (or nothing) will execute one command for each
of the Viash components, whereas a command suffixed by `+` will execute one
command for all Viash components.
**Usage:**
`viash ns exec 'echo {path} \\;'`
`viash ns exec 'chmod +x {main-script} +'`
| Argument | Description | Type |
|-|:----|-:
| `--apply_platform`, `-a` | Fills in the {platform} and {output} field by applying each platform to the config separately. Note that this results in the provided command being applied once for every platform that matches the --platform regex. | `Boolean` |
| `--cmd` | The command to execute for each viash config file in the namespace. **This is a required argument.** | `String` |
| `--config_mod`, `-c` | Modify a viash config at runtime using [dynamic config modding](/reference/config_mods/#). | `List[String]` |
| `--dry_run`, `-d` | Perform a dry run. | `Boolean` |
| `--parallel`, `-l` | Whether or not to run the process in parallel. | `Boolean` |
| `--platform`, `-p` | Acts as a regular expression to filter the platform ids specified in the found config files. If this is not provided, all platforms will be used. If no platforms are defined in a config, the native platform will be used. In addition, the path to a platform yaml file can also be specified. | `String` |
| `--query`, `-q` | Filter which components get selected by component and [namespace](/guide/project/structure.html#grouping-components-in-namespaces) name. Can be a regex. Example: "^mynamespace/component1\$". | `String` |
| `--query_name` | Filter which components get selected by component name. Can be a regex. Example: "^component1". | `String` |
| `--query_namespace`, `-n` | Filter which namespaces get selected by [namespace](/guide/project/structure.html#grouping-components-in-namespaces) name. Can be a regex. Example: "^mynamespace\$". | `String` |
| `--src`, `-s` | A source directory containing viash config files, possibly structured in a hierarchical folder structure. Default: src/. | `String` |
| `--help`, `-h` | Show help message | |