See https://github.com/anishathalye/dotbot/issues/282 and
https://github.com/anishathalye/dotbot/issues/315.
This patch simplifies the implementation, removing special-case handling
for the cases of zero matches and one match. Instead, any situation
where `glob: true` is specified and the path contains a glob character
(any of "?", "*", or "[") is treated as a glob case. The reason we check
both `use_glob` and `_has_glob_chars()` is to more gracefully handle the
case where the user has enabled globs by default, but most links do not
contain glob characters and should not be treated as globs.
Note that this does NOT port the following command over:
```shell
git config --global protocol.file.allow always
```
Doing so would change the git configuration of users running
the unit tests locally, and this is not an acceptable outcome.
Instead, the git configuration is modified at the CLI using
the `-c protocol.file.allow=always` argument to accomplish
the same thing without side effects.
The fix for this Git security issue [1] involved disabling the local
clone optimization when the repository contains symbolic links. The
security fix broke this particular test; this patch works around the
fix.
[1]: https://github.com/git/git/security/advisories/GHSA-3wp6-j8xr-qw85
## what
- add feature to run shell command (optionally)
## how
- the shell directive will check if the 'if' property is available.
If it is, it will run the command in 'if' property.
If the command results in a return 0 code or 'true', then the
'command' property will run.
If the condition to run the command is a non 0 code or 'false',
the shell command won't run
- dotbot config example:
```yaml
- shell:
- command: echo "this is running on a MacOS"
if: uname -s | grep -i "Darwin"
```
- dotbot config example: skipping command if false
```yaml
- shell:
- command: echo "This command should be skipped"
if: false
```
## why
- can run the shell command conditionally
- can use multiple dotbot configs to run different OS
- Ex: incorporating it in https://github.com/ecarlson94/dotbot-template
## where
- file changed in `./dotbot/plugins/shell.py`
## usage
Create dotbot config
```yaml
- shell:
- command: echo "this is running on a MacOS"
if: uname -s | grep -i "Darwin"
```
```yaml
- shell:
- command: echo "This command should be skipped"
if: false
```