diff highlighting in mod command confirmation
This commit is contained in:
parent
90af44e959
commit
35763c7b26
34
t.sh
34
t.sh
|
@ -243,25 +243,6 @@ function dblog() {
|
||||||
[[ $DEBUG -eq 1 ]] && echo "$(date) ${FUNCNAME[1]}() $*" >/dev/stderr
|
[[ $DEBUG -eq 1 ]] && echo "$(date) ${FUNCNAME[1]}() $*" >/dev/stderr
|
||||||
}
|
}
|
||||||
|
|
||||||
if [[ 1 -eq 0 ]]; then
|
|
||||||
function action() {
|
|
||||||
echo -e "$BOLD$GREEN* $PLAIN$GREEN$*$PLAIN"
|
|
||||||
}
|
|
||||||
|
|
||||||
function warn() {
|
|
||||||
echo -e "$BOLD${YELLOW}WARNING: $PLAIN$YELLOW$*$PLAIN" >/dev/stderr
|
|
||||||
}
|
|
||||||
|
|
||||||
function error() {
|
|
||||||
echo -e "$BOLD${RED}ERROR: $PLAIN$RED$*$PLAIN" >/dev/stderr
|
|
||||||
}
|
|
||||||
|
|
||||||
function info() {
|
|
||||||
[[ $AUTOYES -eq 1 ]] && return
|
|
||||||
echo -e "$BOLD${CYAN}>> $PLAIN$CYAN$*$PLAIN"
|
|
||||||
}
|
|
||||||
fi
|
|
||||||
|
|
||||||
function confirm() {
|
function confirm() {
|
||||||
local yn
|
local yn
|
||||||
if [[ $AUTOYES -eq 1 ]]; then
|
if [[ $AUTOYES -eq 1 ]]; then
|
||||||
|
@ -713,7 +694,7 @@ function rename() { # rename uid new name goes here
|
||||||
|
|
||||||
function sedmod() { # sedmod uid 'sed command'
|
function sedmod() { # sedmod uid 'sed command'
|
||||||
local uid sedscript newname sedrv rv file
|
local uid sedscript newname sedrv rv file
|
||||||
local id
|
local id one two cur new
|
||||||
|
|
||||||
uid=$1
|
uid=$1
|
||||||
id=$(getid $uid)
|
id=$(getid $uid)
|
||||||
|
@ -731,8 +712,17 @@ function sedmod() { # sedmod uid 'sed command'
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
info "Current name: ${BOLD}${tasksum[$id]}"
|
cur="${tasksum[$id]}"
|
||||||
info "New name: ${BOLD}${newname}"
|
new="${newname}"
|
||||||
|
if [[ $sedscript =~ ^s\/.*\/.*\/.*$ ]]; then
|
||||||
|
one=$(echo "$sedscript" | awk -F/ '{ print $2 }')
|
||||||
|
two=$(echo "$sedscript" | awk -F/ '{ print $3 }')
|
||||||
|
cur=${cur/$one/$BOLD$STRIKE$RED$one^p^b}
|
||||||
|
new=${new/$two/$BOLD$GREEN$two^b}
|
||||||
|
fi
|
||||||
|
|
||||||
|
info "Current name: ${BOLD}${cur}"
|
||||||
|
info "New name: ${BOLD}${new}"
|
||||||
confirm "Is this correct"
|
confirm "Is this correct"
|
||||||
if [[ $? -ne 0 ]]; then
|
if [[ $? -ne 0 ]]; then
|
||||||
inform "Aborted."
|
inform "Aborted."
|
||||||
|
|
Loading…
Reference in New Issue