From 4b163f5565269faadc64995a3a903fa28c65f7b3 Mon Sep 17 00:00:00 2001 From: patrick brisbin Date: Mon, 9 Dec 2013 15:47:42 -0500 Subject: Prefer RCRC environment variable over ~/.rcrc * Centralize configuration loading in rcm.sh(.in) * Check for readability, not just existence Add RCRC notes to all manpages. Putting the environment variables in a table lines them up more neatly and definitively, across all output formats, and also follows the examples used by e.g. BSD ls(1). --- bin/lsrc | 4 ---- bin/mkrc | 4 ---- bin/rcdn | 4 ---- bin/rcup | 4 ---- man/lsrc.1 | 6 ++++++ man/mkrc.1 | 6 ++++++ man/rcdn.1 | 6 ++++++ man/rcrc.5 | 5 +++-- man/rcup.1 | 6 ++++++ share/rcm.sh.in | 6 ++++++ 10 files changed, 33 insertions(+), 18 deletions(-) diff --git a/bin/lsrc b/bin/lsrc index 6f719e3..3496a17 100755 --- a/bin/lsrc +++ b/bin/lsrc @@ -242,10 +242,6 @@ handle_command_line() { DEST_STACK= -if [ -e $HOME/.rcrc ]; then - . $HOME/.rcrc -fi - handle_command_line $* : ${DOTFILES_DIRS:=$DOTFILES_DIRS $DEFAULT_DOTFILES_DIR} diff --git a/bin/mkrc b/bin/mkrc index 9bd9fba..c78d10b 100755 --- a/bin/mkrc +++ b/bin/mkrc @@ -18,10 +18,6 @@ destination() { fi } -if [ -e $HOME/.rcrc ]; then - . $HOME/.rcrc -fi - show_help() { local exit_code=${1:-0} diff --git a/bin/rcdn b/bin/rcdn index 1f44fa2..ebd5dea 100755 --- a/bin/rcdn +++ b/bin/rcdn @@ -79,10 +79,6 @@ handle_command_line() { LS_ARGS=-F -if [ -e $HOME/.rcrc ]; then - . $HOME/.rcrc -fi - handle_command_line $* : ${DOTFILES_DIRS:=$DOTFILES_DIRS $DEFAULT_DOTFILES_DIR} diff --git a/bin/rcup b/bin/rcup index 67e3a01..f5c9459 100755 --- a/bin/rcup +++ b/bin/rcup @@ -155,10 +155,6 @@ handle_command_line() { LS_ARGS=-F -if [ -e $HOME/.rcrc ]; then - . $HOME/.rcrc -fi - handle_command_line $* : ${DOTFILES_DIRS:=$DOTFILES_DIRS $DEFAULT_DOTFILES_DIR} diff --git a/man/lsrc.1 b/man/lsrc.1 index b733873..6070428 100644 --- a/man/lsrc.1 +++ b/man/lsrc.1 @@ -93,6 +93,12 @@ Or more simply: .Pp .Dl bash_profile .Pp +.Sh ENVIRONMENT +.Bl -tag -width ".Ev RCRC" +.It Ev RCRC +User configuration file. Defaults to +.Pa ~/.rcrc . +.El .Sh FILES .Pa ~/.dotfiles .Pa ~/.rcrc diff --git a/man/mkrc.1 b/man/mkrc.1 index f5e1918..384b485 100644 --- a/man/mkrc.1 +++ b/man/mkrc.1 @@ -33,6 +33,12 @@ install dotfiles according to tag .It Fl v increase verbosity. This can be repeated for extra verbosity. .El +.Sh ENVIRONMENT +.Bl -tag -width ".Ev RCRC" +.It Ev RCRC +User configuration file. Defaults to +.Pa ~/.rcrc . +.El .Sh FILES .Pa ~/.dotfiles .Pa ~/.rcrc diff --git a/man/rcdn.1 b/man/rcdn.1 index d6737cf..43780ca 100644 --- a/man/rcdn.1 +++ b/man/rcdn.1 @@ -86,6 +86,12 @@ only remove the specified file(s) .Dl rcdn -t python .Dl rcdn -d ~/corporate-dotfiles .Dl rcdn -e '*:.zshrc' +.Sh ENVIRONMENT +.Bl -tag -width ".Ev RCRC" +.It Ev RCRC +User configuration file. Defaults to +.Pa ~/.rcrc . +.El .Sh FILES .Pa ~/.rcrc .Sh SEE ALSO diff --git a/man/rcrc.5 b/man/rcrc.5 index c7f300a..ec6ef9a 100644 --- a/man/rcrc.5 +++ b/man/rcrc.5 @@ -17,8 +17,9 @@ .Sh DESCRIPTION The rcm dotfile manager can be configured using a .Pa .rcrc -file in your home directory. The format is POSIX shell. It is -sourced in by the +file in your home directory. This location can be changed by setting the +.Pa RCRC +environment variable. The format is POSIX shell. It is sourced in by the .Xr lsrc 1 , .Xr mkrc 1 , .Xr rcdn 1 , diff --git a/man/rcup.1 b/man/rcup.1 index 9b2aa08..8839159 100644 --- a/man/rcup.1 +++ b/man/rcup.1 @@ -170,6 +170,12 @@ or from The post-up hook is run. .El . +.Sh ENVIRONMENT +.Bl -tag -width ".Ev RCRC" +.It Ev RCRC +User configuration file. Defaults to +.Pa ~/.rcrc . +.El .Sh FILES .Pa ~/.dotfiles .Pa ~/.rcrc diff --git a/share/rcm.sh.in b/share/rcm.sh.in index e01ec59..2af2418 100644 --- a/share/rcm.sh.in +++ b/share/rcm.sh.in @@ -116,3 +116,9 @@ run_hooks() { done fi } + +: ${RCRC:=$HOME/.rcrc} + +if [ -r "$RCRC" ]; then + . "$RCRC" +fi -- cgit v1.2.3