1
0
Fork 0
mirror of synced 2024-11-13 20:28:58 -05:00
dotbot/test/tests/link-prefix.bash
Eric Engstrom 6c044208fa
feat: Add prefix: 'string' option to linking when glob: true.
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
2021-05-27 12:07:17 -05:00

23 lines
425 B
Bash

test_description='link prefix'
. '../test-lib.bash'
test_expect_success 'setup' '
mkdir ${DOTFILES}/conf &&
echo "apple" > ${DOTFILES}/conf/a &&
echo "banana" > ${DOTFILES}/conf/b &&
echo "cherry" > ${DOTFILES}/conf/c
'
test_expect_success 'test glob w/ prefix' '
run_dotbot -v <<EOF
- link:
~/:
glob: true
path: conf/*
prefix: '.'
EOF
grep "apple" ~/.a &&
grep "banana" ~/.b &&
grep "cherry" ~/.c
'