@@ -6,8 +6,8 @@ slug: /cli-usage
6
6
7
7
#### Execute a job, run a workflow, adjust logging, maintain adaptors, and save the state.
8
8
9
- You're probably here to run jobs (expressions) or workflows, which the CLI makes
10
- easy. Keep reading for an outline of the basic usage scenarios of the CLI.
9
+ You're probably here to run steps (expressions) or workflows, which the CLI
10
+ makes easy. Keep reading for an outline of the basic usage scenarios of the CLI.
11
11
12
12
---
13
13
@@ -17,25 +17,24 @@ To run a single job, you must explicitly specify which adaptor to use. You can
17
17
find the list of publicly available [ adaptors here] ( /adaptors ) . See examples
18
18
below.
19
19
20
- > Pass the ` -i ` flag to auto-install that adaptor (it's safe to do this
21
- > redundantly).
20
+ > Adaptors are auto-installed if the specified version is not detected.
22
21
23
22
** Use a shorthand (e.g., ` http ` ):**
24
23
25
24
``` bash
26
- openfn path/to/job.js -ia http
25
+ openfn path/to/job.js -a http
27
26
```
28
27
29
28
** Use the full package name (e.g., ` @openfn/language-http ` ):**
30
29
31
30
``` bash
32
- openfn path/to/job.js -ia @openfn/language-http
31
+ openfn path/to/job.js -a @openfn/language-http
33
32
```
34
33
35
34
** Add a specific version:**
36
35
37
36
``` bash
38
- openfn path/to/job.js -
ia [email protected]
37
+ openfn path/to/job.js -
a [email protected]
39
38
```
40
39
41
40
** Pass a path to a locally installed adaptor:**
@@ -54,15 +53,15 @@ it creates an `output.json` next to the job file.
54
53
** You can specify custom paths for the output and state files:**
55
54
56
55
``` bash
57
- openfn path/to/job.js -ia adaptor-name -o path/to/output.json -s path/to/state.json
56
+ openfn path/to/job.js -a adaptor-name -o path/to/output.json -s path/to/state.json
58
57
```
59
58
60
59
### Return resulting state through stdout
61
60
62
61
** Use ` -O ` to return the output through stdout:**
63
62
64
63
``` bash
65
- openfn path/to/job.js -ia adaptor-name -O
64
+ openfn path/to/job.js -a adaptor-name -O
66
65
```
67
66
68
67
---
@@ -98,7 +97,7 @@ export OPENFN_REPO_DIR=/path/to/repo
98
97
** Auto-install adaptors and check if a matching version is found in the repo:**
99
98
100
99
``` bash
101
- openfn path/to/job.js -ia adaptor-name
100
+ openfn path/to/job.js -a adaptor-name
102
101
```
103
102
104
103
** Remove all adaptors from the repo:**
@@ -116,25 +115,31 @@ openfn repo clean
116
115
117
116
``` json
118
117
{
119
- "start" : " a" , // optionally specify the start node (defaults to jobs[0])
120
- "jobs" : [
121
- {
122
- "id" : " a" ,
123
- "expression" : " fn((state) => state)" , // code or a path
124
- "adaptor" :
" @openfn/[email protected] " ,
// specifiy the adaptor to use (version optional)
125
- "data" : {}, // optionally pre-populate the data object (this will be overriden by keys in in previous state)
126
- "configuration" : {}, // Use this to pass credentials
127
- "next" : {
128
- // This object defines which jobs to call next
129
- // All edges returning true will run
130
- // If there are no next edges, the workflow will end
131
- "b" : true ,
132
- "c" : {
133
- "condition" : " !state.error" // Note that this is an expression, not a function
118
+ "options" : {
119
+ "start" : " a" // optionally specify the start node (defaults to steps[0])
120
+ },
121
+ "workflows" : {
122
+ "steps" : [
123
+ {
124
+ "id" : " a" ,
125
+ "expression" : " fn((state) => state)" , // code or a path
126
+ "adaptor" :
" @openfn/[email protected] " ,
// specifiy the adaptor to use (version optional)
127
+ "state" : {
128
+ "data" : {} // optionally pre-populate the data object (this will be overriden by keys in in previous state)
129
+ },
130
+ "configuration" : {}, // Use this to pass credentials
131
+ "next" : {
132
+ // This object defines which steps to call next
133
+ // All edges returning true will run
134
+ // If there are no next edges, the workflow will end
135
+ "b" : true ,
136
+ "c" : {
137
+ "condition" : " !state.error" // Note that this is an expression, not a function
138
+ }
134
139
}
135
140
}
136
- }
137
- ]
141
+ ]
142
+ }
138
143
}
139
144
```
140
145
@@ -143,7 +148,7 @@ openfn repo clean
143
148
** To run a workflow:**
144
149
145
150
``` bash
146
- openfn path/to/workflow.json -i
151
+ openfn path/to/workflow.json -o tmp/output.json
147
152
```
148
153
149
154
Check out this detailed [ tutorial] ( cli-walkthrough#7-running-workflows ) on
0 commit comments