diff options
author | Mike Burns <mike@mike-burns.com> | 2013-08-02 14:27:44 -0400 |
---|---|---|
committer | Mike Burns <mike@mike-burns.com> | 2013-08-02 14:27:44 -0400 |
commit | fe3244ca9c8c9a38ea700851e36667b1015d11e6 (patch) | |
tree | 3c0f61030cc37250844d914c25ffaff672330698 /bin/rcup | |
parent | aacff1b269a39c967f84ab33b68f827febee8891 (diff) |
Extra argument parsing into rcm.sh
Pull the `-V`, `-v`, `-q`, `-t`, and `-d` out into the
`handle_common_flags` and `handle_metadata_flags` functions, shared
between the different programs.
Diffstat (limited to 'bin/rcup')
-rwxr-xr-x | bin/rcup | 52 |
1 files changed, 7 insertions, 45 deletions
@@ -1,22 +1,10 @@ #!/bin/sh -#set -x +: ${RCM_LIB:=`dirname $0`/../share/rcm} +. $RCM_LIB/rcm.sh REPLACE_ALL=0 -DEST_DIR=$HOME -DEBUG=: -PRINT=echo -PROMPT=echo_n -VERBOSE=: -MKDIR=mkdir -LN=ln -RM=rm - -echo_n() { - printf "%s " "$*" -} - link_file() { local src=$1 local dest=$2 @@ -88,8 +76,9 @@ handle_command_line() { arg_tags="" verbosity=0 version=0 - dotfiles_dirs= + dotfiles_dirs="" LS_ARGS= + while getopts Vqvt:d: opt; do case "$opt" in t) @@ -107,44 +96,17 @@ handle_command_line() { done shift $(($OPTIND-1)) - if [ $version -eq 1 ]; then - version rcup - exit 0 - elif [ $verbosity -ge 2 ]; then - DEBUG=echo - VERBOSE=echo - PRINT=echo - elif [ $verbosity -eq 1 ]; then - DEBUG=: - VERBOSE=echo - PRINT=echo - elif [ $verbosity -eq 0 ]; then - DEBUG=: - VERBOSE=: - PRINT=echo - else - DEBUG=: - VERBOSE=: - PRINT=: - fi - - if [ "x$arg_tags" != "x" ]; then - TAGS=$arg_tags - fi - - if [ "x$dotfiles_dirs" != "x" ]; then - DOTFILES_DIRS=$dotfiles_dirs - fi - + handle_common_flags rcup $version $verbosity + handle_metadata_flags $arg_tags $dotfiles_dirs FILES=$@ LS_ARGS="$LS_ARGS $FILES" + $DEBUG "LS_ARGS: $LS_ARGS" } if [ -e $HOME/.rcrc ]; then . $HOME/.rcrc fi -. `dirname $0`/../share/rcm/rcm.sh handle_command_line $* for dest_and_src in `lsrc $LS_ARGS`; do |