diff options
author | Mike Burns <mike@mike-burns.com> | 2013-08-03 12:23:08 -0400 |
---|---|---|
committer | Mike Burns <mike@mike-burns.com> | 2013-08-03 12:23:08 -0400 |
commit | 5ebd40d8ab1d4806924476a3853edb101ca0a6ff (patch) | |
tree | c9449ad44edc4d95b0013b2eb0569b1b250ab6d8 /bin/rcup | |
parent | 9e16a4aea0dad1909abc78b3f9bc1291917486db (diff) |
Bugfix: support -t and -d again
Due to the awesome refactoring in
fe3244ca9c8c9a38ea700851e36667b1015d11e6, the `-t` and `-d` options were
broken. Fix it by removing the `handle_metadata_flags` function and
inlining the code again, and build the `LS_ARGS` argument differently.
Clearly I need a test suite.
Diffstat (limited to 'bin/rcup')
-rwxr-xr-x | bin/rcup | 36 |
1 files changed, 20 insertions, 16 deletions
@@ -73,33 +73,37 @@ handle_file() { } handle_command_line() { - arg_tags="" - verbosity=0 - version=0 - dotfiles_dirs="" - LS_ARGS= + 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" - LS_ARGS="$LS_ARGS -t $OPTARG" - ;; + t) arg_tags="$arg_tags $OPTARG" ;; v) verbosity=$(($verbosity + 1));; q) verbosity=$(($verbosity - 1));; - d) - dotfiles_dirs="$dotfiles_dirs $OPTARG" - LS_ARGS="$LS_ARGS -d $OPTARG" - ;; + d) dotfiles_dirs="$dotfiles_dirs $OPTARG" ;; V) version=1 esac done shift $(($OPTIND-1)) handle_common_flags rcup $version $verbosity - handle_metadata_flags $arg_tags $dotfiles_dirs - FILES=$@ - LS_ARGS="$LS_ARGS $FILES" + + 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" } |