refactor way list command functions
parent
263ba5296d
commit
fb7c510d2b
|
@ -203,18 +203,25 @@ EOF
|
||||||
[[ $Mirror ]] && args+=(--delete-excluded)
|
[[ $Mirror ]] && args+=(--delete-excluded)
|
||||||
|
|
||||||
[[ ! -v PS1 ]] && noconfirm=true
|
[[ ! -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
|
if [[ $insert ]]; then
|
||||||
# todo mirror option
|
# todo mirror option
|
||||||
confirm The contents within $([[ $SHOST ]] && echo $SHOST:)$SPATH will be \
|
confirm The contents within $([[ $SHOST ]] && echo $SHOST:)$SPATH will be \
|
||||||
$([[ $mirror ]] && echo mirrored || echo placed ) inside $([[ $DHOST ]] && echo $DHOST:)$DPATH || return 0
|
$([[ $mirror ]] && echo mirrored || echo placed ) inside $([[ $DHOST ]] && echo $DHOST:)$DPATH || return 0
|
||||||
else
|
else
|
||||||
confirm the directory $(basename $SPATH) of $([[ $SHOST ]] && echo $SHOST:)$SPATH will be \
|
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
|
||||||
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 [[ ! $quiet ]]; then [[ $exec ]] && echo executing the copy command || echo dry run of command, use -r to execute; fi
|
||||||
if eval $cmd; then
|
if eval $cmd; then
|
||||||
[[ ! $quiet ]] && echo copy success!
|
[[ ! $quiet ]] && echo copy success!
|
||||||
|
|
Loading…
Reference in New Issue