| 1 |
$ . "$TESTDIR/helper.sh" |
| 2 |
|
| 3 |
Should exclude items with -x |
| 4 |
|
| 5 |
$ touch .dotfiles/example |
| 6 |
> touch .dotfiles/excluded |
| 7 |
|
| 8 |
$ lsrc -x excluded |
| 9 |
/*/.example:/*/.dotfiles/example (glob) |
| 10 |
|
| 11 |
Should accept directory:file syntax |
| 12 |
|
| 13 |
$ mkdir .other-dotfiles |
| 14 |
> touch .other-dotfiles/included |
| 15 |
> touch .other-dotfiles/excluded |
| 16 |
|
| 17 |
$ lsrc -d .dotfiles -d .other-dotfiles -x other-dotfiles:excluded |
| 18 |
/*/.example:/*/.dotfiles/example (glob) |
| 19 |
/*/.excluded:/*/.dotfiles/excluded (glob) |
| 20 |
/*/.included:/*/.other-dotfiles/included (glob) |
| 21 |
|
| 22 |
Should accept directory:file syntax with wildcard directory |
| 23 |
|
| 24 |
$ lsrc -d .dotfiles -d .other-dotfiles -x *:excluded |
| 25 |
/*/.example:/*/.dotfiles/example (glob) |
| 26 |
/*/.included:/*/.other-dotfiles/included (glob) |
| 27 |
|
| 28 |
Should handle excludes with globs |
| 29 |
|
| 30 |
$ mkdir -p fresh/hola/chao |
| 31 |
> touch fresh/hola/chao/wo |
| 32 |
> touch fresh/hola/chao/nemo |
| 33 |
> touch fresh/hola/tossala |
| 34 |
> touch fresh/hola/s |
| 35 |
> touch fresh/s |
| 36 |
|
| 37 |
$ lsrc -d fresh -x 'hola/chao/*' -x s |
| 38 |
/*/.hola/tossala:/*/fresh/hola/tossala (glob) |
| 39 |
|
| 40 |
$ lsrc -d fresh -x 'hola/chao' -x s |
| 41 |
/*/.hola/tossala:/*/fresh/hola/tossala (glob) |
| 42 |
|
| 43 |
Should support wildcards in the excludes, including Emacs backup |
| 44 |
files, and wildcards in directory specifier. |
| 45 |
|
| 46 |
$ rm -rf .dotfiles |
| 47 |
$ ( mkdir .dotfiles && cd .dotfiles && touch included README.md included~ README.md~ ) |
| 48 |
|
| 49 |
Should exclude multiple patterns including globs and plain names using -x argument |
| 50 |
|
| 51 |
$ lsrc -x README.md -x "*~" |
| 52 |
/*/.included:/*/.dotfiles/included (glob) |
| 53 |
|
| 54 |
And the with directory tagged globs using -x with sole exclude |
| 55 |
|
| 56 |
$ lsrc -x "*:*~" | grep -v README.md |
| 57 |
/*/.included:/*/.dotfiles/included (glob) |
| 58 |
|
| 59 |
And the with directory tagged globs using -x |
| 60 |
|
| 61 |
$ lsrc -x README.md -x "*:*~" |
| 62 |
/*/.included:/*/.dotfiles/included (glob) |
| 63 |
|
| 64 |
And sanity check that directory tagged this work with just one exclude |
| 65 |
|
| 66 |
$ lsrc -x "*~" | grep -v README.md |
| 67 |
/*/.included:/*/.dotfiles/included (glob) |