summaryrefslogtreecommitdiff
path: root/bin/rcdn.in
diff options
context:
space:
mode:
authorGravatar Christopher Koch <ckoch@cs.nmt.edu>2014-07-23 00:03:27 +0200
committerGravatar Mike Burns <mike@mike-burns.com>2014-11-19 15:20:30 -0800
commit8d6bc1fc7b14d26589a4789dc9da291ef404bd61 (patch)
tree9429cd6340cd0436bb678a6ab16ed882aac6fef2 /bin/rcdn.in
parent6f011c7fab8d407ec0cd091e9cbeb03c276372ce (diff)
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.
Diffstat (limited to 'bin/rcdn.in')
-rwxr-xr-xbin/rcdn.in15
1 files changed, 13 insertions, 2 deletions
diff --git a/bin/rcdn.in b/bin/rcdn.in
index 91223fa..90cfcd6 100755
--- a/bin/rcdn.in
+++ b/bin/rcdn.in
@@ -21,7 +21,7 @@ remove_link() {
show_help() {
local exit_code=${1:-0}
- $PRINT "Usage: rcdn [-hKkqVv] [-B HOSTNAME] [-d DOT_DIR] [-I EXCL_PAT] [-S EXCL_PAT] [-s EXCL_PAT] [-t TAG] [-x EXCL_PAT]"
+ $PRINT "Usage: rcdn [-hqVv] [-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 rcdn(1) and rcm(7) for more details"
exit $exit_code
@@ -38,9 +38,11 @@ handle_command_line() {
local includes=
local symlink_dirs=
local never_symlink_dirs=
+ local undotted=
+ local never_undotted=
local hostname=
- while getopts :VqvhKkI:x:S:s:t:d:B: opt; do
+ while getopts :VqvhIKk:x:S:s:U:u:t:d:B: opt; do
case "$opt" in
h) show_help ;;
B) hostname="$OPTARG" ;;
@@ -50,6 +52,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));;
q) verbosity=$(($verbosity - 1));;
d) dotfiles_dirs="$dotfiles_dirs $OPTARG" ;;
@@ -86,6 +90,13 @@ handle_command_line() {
for never_symlink_dir in $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"