diff options
-rw-r--r-- | NEWS.md.in | 1 | ||||
-rw-r--r-- | bin/Makefile.am | 2 | ||||
-rw-r--r-- | bin/Makefile.in | 2 | ||||
-rwxr-xr-x | bin/rcdn | 53 | ||||
-rw-r--r-- | man/Makefile.am | 2 | ||||
-rw-r--r-- | man/Makefile.in | 2 | ||||
-rw-r--r-- | man/lsrc.1 | 1 | ||||
-rw-r--r-- | man/mkrc.1 | 1 | ||||
-rw-r--r-- | man/rcdn.1 | 52 | ||||
-rw-r--r-- | man/rcm.7 | 12 | ||||
-rw-r--r-- | man/rcrc.5 | 1 | ||||
-rw-r--r-- | man/rcup.1 | 1 | ||||
-rw-r--r-- | share/rcm.sh.in | 3 |
13 files changed, 127 insertions, 6 deletions
@@ -2,6 +2,7 @@ rcm (@PACKAGE_VERSION@) unstable; urgency=low * Improved Debian handling. * Introduce mkrc -o to install host-specific dotfiles. + * Add rcdn(1) to remove rc files. -- Mike Burns <mburns@thoughtbot.com> Tue, 01 Aug 2013 16:43:33 +0200 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 diff --git a/man/Makefile.am b/man/Makefile.am index 581184e..0674e27 100644 --- a/man/Makefile.am +++ b/man/Makefile.am @@ -1 +1 @@ -man_MANS = lsrc.1 mkrc.1 rcrc.5 rcup.1 rcm.7 +man_MANS = lsrc.1 mkrc.1 rcdn.1 rcup.1 rcrc.5 rcm.7 diff --git a/man/Makefile.in b/man/Makefile.in index fecc814..51cc9de 100644 --- a/man/Makefile.in +++ b/man/Makefile.in @@ -171,7 +171,7 @@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -man_MANS = lsrc.1 mkrc.1 rcrc.5 rcup.1 rcm.7 +man_MANS = lsrc.1 mkrc.1 rcdn.1 rcup.1 rcrc.5 rcm.7 all: all-am .SUFFIXES: @@ -43,6 +43,7 @@ only list the specified file(s) .Pa ~/.rcrc .Sh SEE ALSO .Xr mkrc 1 , +.Xr rcdn 1 , .Xr rcup 1 , .Xr rcrc 5 , .Xr rcm 7 @@ -39,6 +39,7 @@ install dotfiles into the host-specific directory .Dl mkrc -o ~/.rcrc .Sh SEE ALSO .Xr lsrc 1 , +.Xr rcdn 1 , .Xr rcup 1 , .Xr rcrc 5 , .Xr rcm 7 diff --git a/man/rcdn.1 b/man/rcdn.1 new file mode 100644 index 0000000..65c9bf0 --- /dev/null +++ b/man/rcdn.1 @@ -0,0 +1,52 @@ +.Dd August 2, 2013 +.Dt RCDN 1 +.Os +.Sh NAME +.Nm rcdn +.Nd remove dotfiles +.Sh SYNOPSIS +.Nm rcdn +.Op Fl vq +.Op Fl t Ar tag +.Op Fl d Ar dir +.Op Ar files ... +.Sh DESCRIPTION +This program will remove all the rc files that the +.Xr rcm 7 +suite knows about. This can be further controlled with the +.Fl t +and +.Fl d +flags. +.Bl -tag +.It Fl v +increase verbosity. This can be repeated for extra verbosity. +.It Fl q +decrease verbosity +.It Fl t Ar TAG +remove dotfiles according to +.Ar TAG +.It Fl d Ar DIR +remove dotfiles from the +.Ar DIR . +This can be specified multiple times. +.It Ar files +only remove the specified file(s) +.El +. +.Sh EXAMPLES +.Dl rcdn -v +.Dl rcdn zshrc +.Dl rcdn -t python +.Dl rcdn -d ~/corporate-dotfiles +.Sh FILES +.Pa ~/.dotfiles +.Pa ~/.rcrc +.Sh SEE ALSO +.Xr lsrc 1 , +.Xr mkrc 1 , +.Xr rcup 1 , +.Xr rcrc 5 , +.Xr rcm 7 +.Sh AUTHORS +.An "Mike Burns" Aq mike@mike-burns.com @@ -7,6 +7,7 @@ .Sh SYNOPSIS .Nm lsrc .Nm mkrc +.Nm rcdn .Nm rcup .Sh DESCRIPTION The rcm suite of tools is for managing dotfiles directories. This is a @@ -91,10 +92,16 @@ A less common situation is for all the filenames in your dotfiles directory to be prefixed with a period. These files are skipped by the rcm suite, and thus would result in nothing happening. The only option in this case is to rename all the files, for example by using a shell -command like the following. Note that this will break any existing -symlinks. +command like the following. .Pp .Dl find ~/.dotfiles -name '.*' -exec echo mv {} `echo {} | sed 's/\.//'` \; +.Pp +Note that this will break any existing symlinks. Those can be safely +removed using the +.Xr rcdn 1 +command. +.Pp +.Dl rcdn -v .Ss COMMON PROBLEM: DOTFILES DIRECTORY NOT IN Pa ~/.dotfiles This all assumes that your dotfiles directory is .Pa ~/.dotfiles . @@ -222,6 +229,7 @@ dotfiles, too. .Sh SEE ALSO .Xr lsrc 1 , .Xr mkrc 1 , +.Xr rcdn 1 , .Xr rcup 1 , .Xr rcrc 5 .Sh AUTHORS @@ -44,6 +44,7 @@ canonical source. The default value is .Sh SEE ALSO .Xr lsrc 1 , .Xr mkrc 1 , +.Xr rcdn 1 , .Xr rcup 1 , .Xr rcm 7 .Sh AUTHORS @@ -114,6 +114,7 @@ or from .Sh SEE ALSO .Xr lsrc 1 , .Xr mkrc 1 , +.Xr rcdn 1 , .Xr rcrc 5 , .Xr rcm 7 .Sh AUTHORS diff --git a/share/rcm.sh.in b/share/rcm.sh.in index 3b8b87b..f25665b 100644 --- a/share/rcm.sh.in +++ b/share/rcm.sh.in @@ -51,18 +51,21 @@ handle_common_flags() { VERBOSE=echo PRINT=echo MV="$MV -v" + RM="$RM -v" INSTALL="$INSTALL -vv" elif [ $verbosity -eq 1 ]; then DEBUG=: VERBOSE=echo PRINT=echo MV="$MV -v" + RM="$RM -v" INSTALL="$INSTALL -v" elif [ $verbosity -eq 0 ]; then DEBUG=: VERBOSE=: PRINT=echo MV="$MV -v" + RM="$RM -v" else DEBUG=: VERBOSE=: |