From 8d6bc1fc7b14d26589a4789dc9da291ef404bd61 Mon Sep 17 00:00:00 2001 From: Christopher Koch Date: Wed, 23 Jul 2014 00:03:27 +0200 Subject: Support rc files without leading dots This adds the `-U` option to lsrc(1), rcup(1), and rcdn(1) commands; its argument is an exclusion pattern. Any file matching this pattern is symlinked without the leading dot. There is also a `-u` option to undo a `-U`. The `UNDOTTED` setting in rcrc(5) can be used to set it permanently. The mkrc(1) command has `-U` and `-u` flags. They take no argument. --- bin/mkrc.in | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'bin/mkrc.in') diff --git a/bin/mkrc.in b/bin/mkrc.in index 8932926..da22a63 100755 --- a/bin/mkrc.in +++ b/bin/mkrc.in @@ -23,7 +23,7 @@ destination() { show_help() { local exit_code=${1:-0} - $PRINT "Usage: mkrc [-ChSsVvqo] [-t TAG] [-d DIR] [-B HOSTNAME] FILES ..." + $PRINT "Usage: mkrc [-ChSsUuVvqo] [-t TAG] [-d DIR] [-B HOSTNAME] FILES ..." $PRINT "see mkrc(1) and rcm(7) for more details" exit $exit_code @@ -44,9 +44,10 @@ in_host=0 version=0 always_copy=0 force_symlink=50 +undotted=50 install_args= -while getopts :ChSsVvqot:d:B: opt; do +while getopts :ChSsUuVvqot:d:B: opt; do case "$opt" in C) always_copy=1 ;; h) show_help ;; @@ -58,6 +59,8 @@ while getopts :ChSsVvqot:d:B: opt; do V) version=1 ;; S) force_symlink=1 ;; s) force_symlink=0 ;; + U) undotted=1 ;; + u) undotted=0 ;; B) in_host=1 hostname="$OPTARG" @@ -93,11 +96,24 @@ elif [ $force_symlink -eq 0 ]; then done fi +if [ $undotted -eq 1 ]; then + for file in $files; do + dedotted="$(de_dot "$file")" + INSTALL="$INSTALL -U $dedotted" + done +elif [ $undotted -eq 0 ]; then + for file in $files; do + dedotted="$(de_dot "$file")" + INSTALL="$INSTALL -u $dedotted" + done +fi + for file in $files; do case "$file" in /*) : ;; *) [ -e "$PWD/$file" ] && file="$PWD/$file" ;; esac + dotless="$(de_dot "$file")" dest="$(destination "$DOTFILES_DIR" "$dotless" $in_host "$tag")" mkdir -p "$dest/$(dirname "$dotless")" -- cgit v1.2.3