refactor way list command functions
parent
263ba5296d
commit
fb7c510d2b
|
@ -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 "
|
||||
|
||||
|
|
Loading…
Reference in New Issue