diff --git a/t.sh b/t.sh index 9046f8f..19876a2 100755 --- a/t.sh +++ b/t.sh @@ -243,25 +243,6 @@ function dblog() { [[ $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() { local yn if [[ $AUTOYES -eq 1 ]]; then @@ -713,7 +694,7 @@ function rename() { # rename uid new name goes here function sedmod() { # sedmod uid 'sed command' local uid sedscript newname sedrv rv file - local id + local id one two cur new uid=$1 id=$(getid $uid) @@ -731,8 +712,17 @@ function sedmod() { # sedmod uid 'sed command' return 1 fi - info "Current name: ${BOLD}${tasksum[$id]}" - info "New name: ${BOLD}${newname}" + cur="${tasksum[$id]}" + 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" if [[ $? -ne 0 ]]; then inform "Aborted."