From 63b50643b0ffd287d0070e494625056a05081ce8 Mon Sep 17 00:00:00 2001 From: Mike Burns Date: Sun, 4 Aug 2013 10:35:14 -0400 Subject: Introduce exclusion patterns The lsrc(1), rcup(1), and rcdn(1) commands now take any number of `-e` flags, used to specify an exclusion pattern. This can also be controlled via rcrc(5), the `EXCLUDES` variable. An exclusion pattern specifies a file glob to skip. In the case of lsrc(1), any file matching the glob is not listed; in rcup(1) it is not symlinked; and in rcdn(1) it is not removed. The file glob can be preceded by the name of a dotfiles directory (separated from the file glob by a colon) to increase the specificity. Useful for: rcdn -e rcrc rcup -d work-dotfiles -e bashrc rcup -d ~/.dotfiles -d wife-dotfiles -d sys-dotfiles -e wife-dotfiles:tigrc --- bin/rcdn | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'bin/rcdn') diff --git a/bin/rcdn b/bin/rcdn index 8695c63..66e064f 100755 --- a/bin/rcdn +++ b/bin/rcdn @@ -9,9 +9,11 @@ handle_command_line() { local version=0 local dotfiles_dirs= local files= + local excludes= - while getopts Vqvt:d: opt; do + while getopts Vqve:t:d: opt; do case "$opt" in + e) excludes="$excludes $OPTARG";; t) arg_tags="$arg_tags $OPTARG" ;; v) verbosity=$(($verbosity + 1));; q) verbosity=$(($verbosity - 1));; @@ -33,6 +35,9 @@ handle_command_line() { for dotfiles_dir in $dotfiles_dirs; do LS_ARGS="$LS_ARGS -d $dotfiles_dir" done + for exclude in $excludes; do + LS_ARGS="$LS_ARGS -e $exclude" + done LS_ARGS="$LS_ARGS $files" $DEBUG "LS_ARGS: $LS_ARGS" -- cgit v1.2.3