zodiac icon indicating copy to clipboard operation
zodiac copied to clipboard

Allow ignore of directories

Open cryptorick opened this issue 7 years ago • 3 comments

Before this commit, any line under the [ignore] section of .zod/config matched only filenames, not directory names. This commit allows the user to indicate whole directories to ignore. The user does this by ending the name spec with /.

For instance, using the snippet

[ignore]
Makefile
.hide/

in .zod/config will cause zod to ignore files matching Makefile and directories matching .hide.

Additionally, directories matching .zod and .git are already ignored by default (as a convenience to the user).

cryptorick avatar May 03 '17 23:05 cryptorick

Hi Chase!

The idea behind this change -- which you will have gathered for yourself quickly, but I state here anyway for completeness sake -- is that, when the user indicates a directory spec in the [ignore] section (like .hide/), zod will, in part, emit a find command which looks like this

find "site" -type d \( -name ".zod" -o -name ".git" -o -name ".hide" \) -prune -o -type f \(  ! -name "helpers.awk" ! -name "*.partial" ! -name "*.layout" ! -name "*.meta" ! -name "*.html" ! -name "*.md" ! -name "*.htm" \) -exec zod-copy "/usr/local/lib/zodiac" "site" "www" {} \;

as opposed to the current behavior which would emit something like

find "site" -type f \(  ! -name "helpers.awk" ! -name "*.partial" ! -name "*.layout" ! -name "*.meta" ! -name "*.html" ! -name "*.md" ! -name "*.htm" \) -exec zod-copy "/usr/local/lib/zodiac" "site" "www" {} \;

the difference being the addition of the

-type d \( -name ".zod" -o -name ".git" -o -name ".hide" \) -prune -o

part (clause).

If you like this method and accept it -- I hope you do -- you should be able also to close the related PR #2 and then: no more open PRs. \o/

Also, it was good to get rid of config as an [ignore] spec on the off-chance that zod-copy needed to copy, say, some site resource file named config.

I tried to be thorough (including updating the doc), but please edit/correct anything I missed.

Oh, almost forgot: I tested this in OpenBSD 6.1 base and "Git Bash" on my employer's horrible Windows system they inflict on us. :) I think the latter is based on GNU tools.

Cheers, --Rick

cryptorick avatar May 03 '17 23:05 cryptorick

Bump. (I hope this finds you well and enjoying your summer!)

cryptorick avatar Jul 01 '17 16:07 cryptorick

I'll need to try these changes locally, but looks good.

nuex avatar Oct 06 '17 14:10 nuex