Add a new optional flag "-r|--root ROOTPATHS", where ROOTPATHS is a
colon separated list of paths, that will look for external sources in
alternate roots.
This is particular useful when the run-time environment does not fully
match the development environment. The #shellcheck source=file directive
is useful, but has its limitations in certain scenarios. Also, in many
cases the directive could be removed from scripts when the root flag is
used.
Script example.bash:
#!/bin/bash
source /etc/foo/config
Example usage where etc/foo/config exists in skel/foo:
# shellcheck -x -r skel/foo:skel/core example.bash
This is motivated by the fact that the popularity of bats is increasing
since the creation of bats-core/bats-core.
The code is a cherry-pick of koalaman/shellcheck/bats branch.
Fixkoalaman/shellcheck#417.
This does the necessary work to emit end columns on AST analyses. SC2086
is made to emit a correct end column as an illustrative example.
For example:
```
$ shellcheck -s bash -f json /dev/stdin <<< 'echo $1'
[{"file":"/dev/stdin","line":1,"endLine":1,"column":6,"endColumn":8,"level":"info","code":2086,"message":"Double quote to prevent globbing and word splitting."}]
```
This change deprecates the parser's getNextId and getNextIdAt, replacing
it with a new withNextId function. This function has the type signature:
withNextId :: Monad m => ParsecT s UserState (SCBase m) (Id -> b) -> ParsecT s UserState (SCBase m) b
Specifically, it should be used to wrap read* functions and will pass in
a newly generated Id which should be used to represent that node.
Sub-parsers will need their own call to withNextId in order to get a
unique Id.
In doing this, withNextId can now track both the entry and exit position
of every read* parser which uses it, enabling the tracking of end
columns throughout the application.