## 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
```
Allows one to store files in a directory or git-repo without the leading
`.`, as in:
```
dotconf:
├── README.md
├── bin
│ ├── dotbot
│ ├── look
│ ├── pbfile
│ └── ...
├── dot
│ ├── bashrc
│ ├── gitconfig
│ ├── gitignore
│ ├── gorc
│ ├── login
│ ├── ...
│ ├── zshrc
│ └── zshenv
```
Can take a many-line dotbot.yml listing **each** file in `dotconf/dot`,
reducing it to five lines:
```
- link:
~/:
path: dotconf/dot/*
glob: true
prefix: '.'
```
FIXES: #259
For example, will handle an entire directory tree of files, linking all
files:
```
- link:
~/.config/:
path: dotconf/config/**
glob: true
```
NOTE, this feature requires newer versions of `glob()` (Python >= 3.5),
and `dotbot` will throw an error if using an earlier version of python.
For testing purposes, added:
- ability to skip tests in test harness
- added testing for older Python(s).
FIXES: #270
- Added `exclude` parameter to _link_. Now, an array of glob patterns
can be given that will be used to remove items from a glob match.
This parameter will only have an effect when `glob` is `true`.
- Updated README to add description for `exclude` and add in examples.
Resolves#247
This forces Dotbot to produce colored output, regardless of whether it
is outputting to a TTY.
This is useful to support use cases such as piping colored Dotbot output
into another program for formatting (e.g. I want to indent the output as
part of a larger installation script); this was not previously easy to
do as this would cause the output to lose its colored formatting.
This option cannot be provided at the same time as the existing
`--no-color` option, as there's no logical interpretation of what effect
providing both of these should have.
As part of this change I've refactored some existing code determining
whether output should be colored to where options are parsed, as this
made this change simpler and I think it makes sense for all this logic
to be performed in the same place.