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/Makefile.am | 2 +- bin/Makefile.in | 2 +- bin/rcdn | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 55 insertions(+), 2 deletions(-) create mode 100755 bin/rcdn (limited to 'bin') diff --git a/bin/Makefile.am b/bin/Makefile.am index 351ea94..46ff33f 100644 --- a/bin/Makefile.am +++ b/bin/Makefile.am @@ -1 +1 @@ -bin_SCRIPTS = lsrc mkrc rcup +bin_SCRIPTS = lsrc mkrc rcup rcdn diff --git a/bin/Makefile.in b/bin/Makefile.in index 5c3880f..42d9875 100644 --- a/bin/Makefile.in +++ b/bin/Makefile.in @@ -167,7 +167,7 @@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -bin_SCRIPTS = lsrc mkrc rcup +bin_SCRIPTS = lsrc mkrc rcup rcdn all: all-am .SUFFIXES: 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