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/rcup.in | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'bin/rcup.in') diff --git a/bin/rcup.in b/bin/rcup.in index c990ac7..e5c5cdb 100755 --- a/bin/rcup.in +++ b/bin/rcup.in @@ -171,7 +171,7 @@ handle_file() { show_help() { local exit_code=${1:-0} - $PRINT "Usage: rcup [-CfghiKkqVv] [-B HOSTNAME] [-d DOT_DIR] [-I EXCL_PAT] [-S EXCL_PAT] [-s EXCL_PAT] [-t TAG] [-x EXCL_PAT]" + $PRINT "Usage: rcup [-CfhiKkqVv] [-B HOSTNAME] [-d DOT_DIR] [-I EXCL_PAT] [-S EXCL_PAT] [-s EXCL_PAT] [-t TAG] [-U EXCL_PAT] [-u EXCL_PAT] [-x EXCL_PAT]" $PRINT "see rcup(1) and rcm(7) for more details" exit $exit_code @@ -192,10 +192,12 @@ handle_command_line() { local hostname= local generate=0 local args=$* + local undotted= + local never_undotted= REPLACE_ALL=0 GENERATE= - while getopts :CVqvfghikKI:x:S:s:t:d:B: opt; do + while getopts :CVqvfghikKI:x:S:s:U:u:t:d:B: opt; do case "$opt" in B) hostname="$OPTARG" ;; C) always_copy=1 ;; @@ -211,6 +213,8 @@ handle_command_line() { t) arg_tags="$arg_tags $OPTARG" ;; S) symlink_dirs="$symlink_dirs $OPTARG";; s) never_symlink_dirs="$never_symlink_dirs $OPTARG";; + U) undotted="$undotted $OPTARG";; + u) never_undotted="$never_undotted $OPTARG";; v) verbosity=$(($verbosity + 1)) ;; V) version=1 ;; x) excludes="$excludes $OPTARG" ;; @@ -259,6 +263,13 @@ handle_command_line() { for never_symlink_dir in $never_symlink_dirs; do LS_ARGS="$LS_ARGS -s $never_symlink_dir" done + for undot in $undotted; do + LS_ARGS="$LS_ARGS -U $undot" + done + for never_undot in $never_undotted; do + LS_ARGS="$LS_ARGS -u $never_undot" + done + LS_ARGS="$LS_ARGS -B $hostname $files" $DEBUG "LS_ARGS: $LS_ARGS" -- cgit v1.2.3