Skip to content

Commit a8501a6

Browse files
committed
Add negation
1 parent 769c0a1 commit a8501a6

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

src-tsp/main.tsp

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,17 @@ model ModuleIf {
222222
*/
223223
`os-release`?: Record<FlexVal | Array<FlexVal>>;
224224

225+
/**
226+
* Check if the values in the `/etc/os-release` file
227+
* don't match. This is useful for checking the type/version
228+
* of the OS before executing the module.
229+
*
230+
* A single value or an array of values can be passed in.
231+
* If an array is passed in, a successful check means all
232+
* values don't match.
233+
*/
234+
`not-os-release`?: Record<FlexVal | Array<FlexVal>>;
235+
225236
/**
226237
* Checks for the existance or non-existance of
227238
* environment variables at build-time before
@@ -272,6 +283,19 @@ model ModuleIf {
272283
* prevent scripts from operating outside of the repo directory.
273284
*/
274285
`host-exec`?: ModuleIfHostExec;
286+
287+
/**
288+
* Executes a command on the host machine to determine
289+
* if the module should be templated. If the command fails,
290+
* then the module is templated.
291+
*
292+
* Execution will be performed in the repo directory.
293+
*
294+
* CAUTION: This allows arbitrary code execution on the host machine.
295+
* Be sure to trust the code you are executing by this function. We cannot
296+
* prevent scripts from operating outside of the repo directory.
297+
*/
298+
`not-host-exec`?: ModuleIfHostExec;
275299
}
276300

277301
model ModuleIfHostFile {
@@ -312,6 +336,12 @@ model ModuleIfEnv {
312336
* one or any listed string.
313337
*/
314338
equals: Record<string | Array<string>>;
339+
340+
/**
341+
* Checks if an environment variable doesn't equal
342+
* any listed string.
343+
*/
344+
`not-equals`: Record<string | Array<string>>;
315345
}
316346

317347
model ModuleIfHostExec {

0 commit comments

Comments
 (0)