Document source-path / source-path=SCRIPTDIR

Stavros Ntentos
2021-09-07 14:01:01 +03:00
parent a0e1cd6e4c
commit 5e1189fc82

@@ -57,6 +57,33 @@ Tell ShellCheck where to find a sourced file (since 0.4.0):
. "$(locate_config)" . "$(locate_config)"
``` ```
### source-path
Give ShellCheck a path on where to search sourced file (since 0.x.x):
```sh
# shellcheck source-path=src/examples
. "$(locate_config)"
```
(similar to the example above)
Additionally, with `source-path=SCRIPTPATH` you can do things like:
```sh
#!/bin/sh
# file: scripts/test.sh
# shellcheck source-path=SCRIPTPATH
. "$(dirname "$(realpath "$0")")/utils.sh"
```
for file layout:
```
.
└── scripts
├── test.sh
└── utils.sh
```
### shell ### shell
Specify the shell for a script (similar to the shebang, if you for any reason don't want to add one) (since [0.4.5](https://github.com/koalaman/shellcheck/issues/581#issuecomment-249437837)): Specify the shell for a script (similar to the shebang, if you for any reason don't want to add one) (since [0.4.5](https://github.com/koalaman/shellcheck/issues/581#issuecomment-249437837)):