From 22b4bd5555fb8c56aa3137c19ec24704ddc3f64f Mon Sep 17 00:00:00 2001 From: Mike Burns Date: Fri, 2 Aug 2013 17:37:41 -0400 Subject: Add rcdn This program will remove all your rc files that are symlinked. This can be further controlled by `-d` and `-t`. For example, you can feel comfortable trying new rc files because you can quickly remove them again with `-d`. rcup -d thoughtbot-dotfiles rcdn -d thoughtbot-dotfiles Likewise, when you're done with Python just drop it: rcdn -t python --- bin/rcdn | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100755 bin/rcdn (limited to 'bin/rcdn') diff --git a/bin/rcdn b/bin/rcdn new file mode 100755 index 0000000..8695c63 --- /dev/null +++ b/bin/rcdn @@ -0,0 +1,53 @@ +#!/bin/sh + +: ${RCM_LIB:=`dirname $0`/../share/rcm} +. $RCM_LIB/rcm.sh + +handle_command_line() { + local arg_tags= + local verbosity=0 + local version=0 + local dotfiles_dirs= + local files= + + while getopts Vqvt:d: opt; do + case "$opt" in + t) arg_tags="$arg_tags $OPTARG" ;; + v) verbosity=$(($verbosity + 1));; + q) verbosity=$(($verbosity - 1));; + d) dotfiles_dirs="$dotfiles_dirs $OPTARG" ;; + V) version=1 + esac + done + shift $(($OPTIND-1)) + + handle_common_flags rcup $version $verbosity + + tags=${arg_tags:-$TAGS} + dotfiles_dirs=${dotfiles_dirs:-$DOTFILES_DIRS} + files=$@ + + for tag in $tags; do + LS_ARGS="$LS_ARGS -t $tag" + done + for dotfiles_dir in $dotfiles_dirs; do + LS_ARGS="$LS_ARGS -d $dotfiles_dir" + done + LS_ARGS="$LS_ARGS $files" + + $DEBUG "LS_ARGS: $LS_ARGS" +} + +if [ -e $HOME/.rcrc ]; then + . $HOME/.rcrc +fi + +handle_command_line $* + +for dest_and_src in `lsrc $LS_ARGS`; do + dest=`echo $dest_and_src | sed 's/:.*//'` + src=`echo $dest_and_src | sed 's/.*://'` + + $RM -rf $dest + rmdir -p `dirname $dest` 2>/dev/null +done -- cgit v1.2.3