@@ -16,7 +16,7 @@ The expression language supports standard comparison and logical operators:
1616- String: ` + ` (concatenation), ` matches ` (regex matching)
1717- Length: ` len() `
1818
19- See the [ Expr Language Definition] ( https://expr-lang.org/docs/language-definition ) for all available operators and functions.
19+ ** See the [ Expr Language Definition] ( https://expr-lang.org/docs/language-definition ) for all available operators and functions.**
2020
2121### Basic Conditions <!-- {docsify-ignore} -->
2222
@@ -63,6 +63,27 @@ executables:
6363 cmd : npm test
6464` ` `
6565
66+ ### File System Conditions <!-- {docsify-ignore} -->
67+ Check for files or directories to control execution:
68+
69+ ` ` ` yaml
70+ executables :
71+ - verb : deploy
72+ name : app
73+ serial :
74+ execs :
75+ # Only run if config file exists
76+ - if : fileExists("config.yaml")
77+ cmd : kubectl apply -f config.yaml
78+
79+ # Abort deployment if no Dockerfile found
80+ - if : not fileExists("Dockerfile")
81+ cmd : echo "No Dockerfile found"; exit 1
82+
83+ # Run deployment if Dockerfile exists
84+ - cmd : docker build -t myapp .
85+ ` ` `
86+
6687### Data-Driven Conditions <!-- {docsify-ignore} -->
6788
6889Use stored data to control execution flow:
@@ -106,6 +127,19 @@ Conditions have access to extensive runtime information:
106127- ` ctx.flowFilePath` - Path to current flow file
107128- ` ctx.flowFileDir` - Directory containing current flow file
108129
130+ Additionally the following functions are provided alongside the Expr language definition :
131+
132+ - ` fileExists(path)` - Check if file/directory exists
133+ - ` dirExists(path)` - Check if path is a directory
134+ - ` isFile(path)` - Check if path is a file
135+ - ` isDir(path)` - Check if path is a directory
136+ - ` basename(path)` - Get filename from path
137+ - ` dirname(path)` - Get directory from path
138+ - ` readFile(path)` - Read file contents as string
139+ - ` fileSize(path)` - Get file size in bytes
140+ - ` fileModTime(path)` - Get file modification time
141+ - ` fileAge(path)` - Get duration since last modified
142+
109143# # Managing State
110144
111145Persist data across executions and share information between workflow steps.
0 commit comments