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
@@ -20,7 +20,8 @@ To use Metafacture on the commandline we can download the latest distribution e.
20
20
21
21
Hint: If 7.0.0 is not published yet use the runner version of the [prerelease 7.0.0-rc1](https://github.com/metafacture/metafacture-core/releases/tag/metafacture-core-7.0.0-rc1).
22
22
23
-
Download `metafacture-core-$VERSION-dist.tar.gz` or the zip version and extract the archive.
23
+
Download `metafacture-core-$VERSION-dist.tar.gz` or the zip version and extract the archive to your choosen folder.
24
+
In the folder you find the `flux.bat` and `flux.sh`
24
25
25
26
The code below assumes you moved the resulting folder to your home directory and renamed it to `'metafacture'`
26
27
@@ -49,17 +50,19 @@ The playground has a nice feature to export and import Metafacture Workflows.
49
50
50
51
[So lets go to the Playground.](https://metafacture.org/playground/?flux=%22https%3A//openlibrary.org/books/OL2838758M.json%22%0A%7C+open-http%0A%7C+as-lines%0A%7C+decode-json%0A%7C+encode-yaml%0A%7C+print%0A%3B)
51
52
52
-
Export the workflow with the Export Button and lets run the flux.
53
+
Export the workflow with the Export Button:
53
54
54
55

55
56
57
+
Open your terminal and and lets run the flux with the following command:
58
+
56
59
Linux:
57
60
58
61
```bash
59
62
~/metafacture/flux.sh downloads/playground.flux
60
63
```
61
64
62
-
or Windows:
65
+
Windows:
63
66
64
67
```bash
65
68
~/metafacture/flux.bat downloads/playground.flux
@@ -68,30 +71,32 @@ or Windows:
68
71
The result of running the Flux-Script via CLI should be the same as with the Playground.
69
72
70
73
The Metafacture CLI Tool expects a flux file for every workflow.
71
-
Our runned workflow only has the following flux and no additional files since it i querring data from the web and it has no fix transformations.
74
+
Our runned workflow only has the following flux and no additional files since it is fetching data from the web and it has no fix transformations.
75
+
76
+
The downloaded file should have the following content, defining the playground specific variables and the flux workflow that you also saw in the playground. You can delete the playground specific variables since they are not needed here.
72
77
73
78
```default
74
79
"https://openlibrary.org/books/OL2838758M.json"
75
80
| open-http
76
81
| as-lines
77
82
| decode-json
78
-
| encode-yaml
83
+
| encode-json(prettyPrinting="true")
79
84
| print
80
85
;
81
86
```
82
87
83
88
## Use local files for transformation
84
89
85
90
If you want to load a local file instead of fetching data from the web we need to change the flux a little bit with an texteditor.
86
-
Download the following file [11942150X.json](/home/tobias/git/metafacture-tutorial/sample-scripts/lesson_06/11942150X.json)
91
+
Download the following file [11942150X.json](./sample-scripts/lesson_06/11942150X.json)
87
92
and adjust the path to your file.
88
93
89
-
Adjust your `downloads/playground.flux` script:
94
+
Adjust your `downloads/playground.flux` script, so that it does not load data from the web, but opens a local file with `open-file` and read it `as-recrods` since the json file is pretty printed:
90
95
91
96
```default
92
97
"path/to/your/file/11942150X.json" // Adjust your path!
93
98
| open-file
94
-
| as-lines
99
+
| as-records
95
100
| decode-json
96
101
| encode-yaml
97
102
| print
@@ -100,7 +105,177 @@ Adjust your `downloads/playground.flux` script:
100
105
101
106
Run it again as shown above.
102
107
103
-
If we want to use fix we need to refrence the fix file that in the playground we only refrenced via `|fix`
0 commit comments