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
Adds support for INCLUDE.ENV [?!] <file-pattern>
* Variables are immediately available, as if they had been defined in the same place in the Runfile
* Variables are not automatically exported, even if the .env file uses the 'export' keyword
* By default, no errors are generated if .env files are not found
feat: Explicitly make single-file INCLUDE optional
* Use 'INCLUDE?' to explicitly make single-file includes optional
feat: Explicitly make .env includes required
* Use 'INCLUDE.ENV!' to explicitly make .env includes required
chore: Adds config.IncludeEnvCycleMap to avoid including the same .env file multiple times
| `.SHELL` | Contains the shell command that will be used to execute command scripts. See [Script Shells](#script-shells) for more details.
890
-
| `.RUN` | Contains the absolute path of the run binary currently in use. Useful for [Invoking Other Commands & Runfiles](#invoking-other-commands--runfiles).
891
-
| `.RUNFILE` | Contains the absolute path of the **primary** Runfile.
892
-
| `.RUNFILE.DIR` | Contains the absolute path of the parent folder of the **primary** runfile.
893
-
| `.SELF` | Contains the absolute path of the **current** (primary or included) runfile.
894
-
| `.SELF.DIR` | Contains the absolute path of the parent folder of the **current** runfile.
|`.SHELL`| Contains the shell command that will be used to execute command scripts. See [Script Shells](#script-shells) for more details. |
892
+
|`.RUN`| Contains the absolute path of the run binary currently in use. Useful for [Invoking Other Commands & Runfiles](#invoking-other-commands--runfiles). |
893
+
|`.RUNFILE`| Contains the absolute path of the **primary** Runfile. |
894
+
|`.RUNFILE.DIR`| Contains the absolute path of the parent folder of the **primary** runfile. |
895
+
|`.SELF`| Contains the absolute path of the **current** (primary or included) runfile. |
896
+
|`.SELF.DIR`| Contains the absolute path of the parent folder of the **current** runfile. |
896
897
897
898
#### Exporting Attributes
898
899
@@ -1039,12 +1040,12 @@ Hello, Everybody
1039
1040
1040
1041
*Note:* Assertions apply only to commands and are only checked when a command is invoked. Any globally-defined assertions will apply to ALL commands defined after the assertion.
1041
1042
1042
-
------------
1043
-
### Includes
1043
+
-----------------------
1044
+
### Includes - Runfiles
1044
1045
1045
-
Includes let you organize commands across multiple Runfiles.
1046
+
Includes let you organize and configure commands across multiple Runfiles.
1046
1047
1047
-
Includes have the following syntax:
1048
+
You can include other Runfiles using the following syntax:
1048
1049
```
1049
1050
INCLUDE <file pattern> | "<file pattern>" | '<file pattern>'
1050
1051
```
@@ -1110,19 +1111,27 @@ Include names / glob-patterns are resolved relative to the Primary runfile's con
1110
1111
1111
1112
#### File(s) Not Found
1112
1113
1113
-
##### OK For Glob
1114
+
##### Default: OK For Glob
1114
1115
1115
1116
When using a globbing pattern, Run considers it OK if the pattern results in no files being found.
1116
1117
1117
1118
This makes it possible to support features like an optional Runfile include directory, or the ability to start a project folder with no includes but have them automatically picked up as you add them.
1118
1119
1119
1120
_Runfile_
1121
+
```
1122
+
INCLUDE maybe_some_runfiles/Runfile-* # OK if no files found
1123
+
```
1120
1124
1125
+
##### Force Error If No Files Found
1126
+
1127
+
To force an error if no files are found when using a globbing pattern, use `!` :
1128
+
1129
+
_Runfile_
1121
1130
```
1122
-
INCLUDE maybe_some_runfiles/Runfile-* # OK if not no files found
1131
+
INCLUDE ! maybe_some_runfiles/Runfile-* # ERROR if no files found
1123
1132
```
1124
1133
1125
-
##### BAD For Single File
1134
+
##### Default: BAD For Single File
1126
1135
1127
1136
When using a single filename (no globbing), Run considers it an error if the include file is not found.
1128
1137
@@ -1138,6 +1147,15 @@ $ run list
1138
1147
run: include runfile not found: 'Runfile-must-exist'
1139
1148
```
1140
1149
1150
+
##### Skip Error If File Not Found
1151
+
1152
+
To skip generating an error if no file is found when using a single filename, use `?` :
1153
+
1154
+
_Runfile_
1155
+
```
1156
+
INCLUDE ? Runfile-might-exist # OK if file not found
1157
+
```
1158
+
1141
1159
#### Avoiding Include Loops
1142
1160
1143
1161
Run keeps track of already-included runfiles and will silently avoid including the same runfile multiple times.
@@ -1348,6 +1366,60 @@ Commands:
1348
1366
1349
1367
Notice that `command2` is still shown _between_`command1` and `command3`, matching the order in which it was originally registered.
1350
1368
1369
+
-------------------
1370
+
### Includes - .ENV
1371
+
1372
+
`.env` files allow users to manage runfile configuration without modifying the Runfile directly.
1373
+
1374
+
Your Runfile can include .env files using the following syntax:
* Variables are immediately available, as if they had been defined in the same place in the Runfile.
1405
+
* Variables are not automatically exported.
1406
+
* Run uses the [subosito/gotenv](https://github.com/subosito/gotenv) library to parse command output
1407
+
*`#` comments are supported and will be safely ignored
1408
+
*`export` keyword is optional and is (currently) ignored - This may be addressed in a future release
1409
+
* Simple variable references in assignments are supported, **but** variables defined _within_ your Runfile are not (currently) accessible - This may be addressed in a future release
1410
+
* Visit the [gotenv project page](https://github.com/subosito/gotenv) to learn more about which `.env` features are supported
1411
+
1412
+
#### File(s) Not Found
1413
+
1414
+
By default, Run considers it OK no .env file is found (using either a single filename or a globbing pattern).
1415
+
1416
+
To force an error if no file(s) are found, use `!`:
1417
+
1418
+
_Runfile_
1419
+
```
1420
+
INCLUDE.ENV ! Runfile-might-not-exist.env # ERROR if no file(s) found
0 commit comments