diff --git a/Directive.md b/Directive.md index 7f2150c..2e20e86 100644 --- a/Directive.md +++ b/Directive.md @@ -57,6 +57,33 @@ Tell ShellCheck where to find a sourced file (since 0.4.0): . "$(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 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)):