diff --git a/modules/utility/copy.lib b/modules/utility/copy.lib index df25678..15400a9 100644 --- a/modules/utility/copy.lib +++ b/modules/utility/copy.lib @@ -203,18 +203,25 @@ EOF [[ $Mirror ]] && args+=(--delete-excluded) [[ ! -v PS1 ]] && noconfirm=true - if [[ ! $noconfirm && ! $list ]]; then + + cmd="$usesudo $(which rsync) ${args[*]} $SRC$([[ $insert ]] && echo "/") $DEST" + [[ $list ]] && echo "$cmd" + + if [[ ! $noconfirm ]]; then if [[ $insert ]]; then # todo mirror option confirm The contents within $([[ $SHOST ]] && echo $SHOST:)$SPATH will be \ $([[ $mirror ]] && echo mirrored || echo placed ) inside $([[ $DHOST ]] && echo $DHOST:)$DPATH || return 0 else confirm the directory $(basename $SPATH) of $([[ $SHOST ]] && echo $SHOST:)$SPATH will be \ - $([[ $mirror ]] && echo mirrored || echo put ) at destination $([[ $DHOST ]] && echo $DHOST:)$DPATH/$(basename $SPATH)? || return 0 + $([[ $mirror ]] && echo mirrored || echo put ) at destination $([[ $DHOST ]] && echo $DHOST:)$DPATH/$(basename $SPATH) || return 0 fi fi - cmd="$usesudo $(which rsync) ${args[*]} $SRC$([[ $insert ]] && echo "/") $DEST" - [[ $list ]] && echo "$cmd" && return 0 + + if [[ $list && ! $noconfirm ]]; then + confirm list command during dry run, do you want to continue with dry run || return 0 + fi + if [[ ! $quiet ]]; then [[ $exec ]] && echo executing the copy command || echo dry run of command, use -r to execute; fi if eval $cmd; then [[ ! $quiet ]] && echo copy success! @@ -224,7 +231,7 @@ EOF >&2 echo $cmd return 1 fi - } + } alias fcpy="copy -r -q -i -n -a "