summaryrefslogtreecommitdiff
path: root/bin/rcup
diff options
context:
space:
mode:
authorGravatar Pablo Olmos de Aguilera Corradini and Mike Burns <pablo@glatelier.org>2013-10-27 17:16:30 -0300
committerGravatar Mike Burns <mike@mike-burns.com>2014-02-18 16:57:01 +0100
commit3700be9ce6802653df30c413179d93316bf0b291 (patch)
tree5e78da946c28e12b4a5fb760779d8e8689c02540 /bin/rcup
parent83c4875e23bb7595689ddd228a9825264b15f318 (diff)
Force some directories to be symlinks
Typically a directory structure is copied instead of symlinked, while files are symlinked. However, some cases require symlinked dirs: git submodules, vim plugins, and so on. This introduces a `SYMLINK_DIRS` option for rcrc(5) that takes a space-separated list of "exclude patterns". Any directory matching these patterns is symlinked. This also introduces a `-S` argument for lsrc(1), rcup(1), and rcdn(1). This argument takes a pattern, for one-off directory symlinking. It can be repeated. This also introduces `-S` and `-s` for mkrc(1). `-S` will re-install the files as symlinks, and `-s` will not. This does work with `-C`, though perhaps unintuitively - we don't know what the user means in this case. However, it will not crash. Bug: `-s` does not work right if `SYMLINK_DIRS` is set. Bug #36 addresses this.
Diffstat (limited to 'bin/rcup')
-rwxr-xr-xbin/rcup7
1 files changed, 6 insertions, 1 deletions
diff --git a/bin/rcup b/bin/rcup
index f5c9459..5ba4822 100755
--- a/bin/rcup
+++ b/bin/rcup
@@ -104,9 +104,10 @@ handle_command_line() {
local excludes=
local includes=
local always_copy=0
+ local symlink_dirs=
REPLACE_ALL=0
- while getopts CVqvfhikKI:x:t:d: opt; do
+ while getopts CVqvfhikKI:x:S:t:d: opt; do
case "$opt" in
C) always_copy=1 ;;
d) dotfiles_dirs="$dotfiles_dirs $OPTARG" ;;
@@ -118,6 +119,7 @@ handle_command_line() {
K) run_hooks=0 ;;
q) verbosity=$(($verbosity - 1)) ;;
t) arg_tags="$arg_tags $OPTARG" ;;
+ S) symlink_dirs="$symlink_dirs $OPTARG";;
v) verbosity=$(($verbosity + 1)) ;;
V) version=1 ;;
x) excludes="$excludes $OPTARG" ;;
@@ -148,6 +150,9 @@ handle_command_line() {
for include in $includes; do
LS_ARGS="$LS_ARGS -I $include"
done
+ for symlink_dir in $symlink_dirs; do
+ LS_ARGS="$LS_ARGS -S $symlink_dir"
+ done
LS_ARGS="$LS_ARGS $files"
$DEBUG "LS_ARGS: $LS_ARGS"