f015d3 Update Functions/cli_printMessage.sh.

Authored and Committed by areguera 13 years ago
    Update Functions/cli_printMessage.sh.
    
        
Scripts/Functions/cli_printMessage.sh CHANGED
@@ -142,8 +142,13 @@ function cli_printMessage {
142
142
;;
143
143
144
144
--as-error-line )
145
- # This option is used to print error messsages.
146
- echo "${CLI_PROGRAM} ($(caller 1 | gawk '{ print $2 " " $1 }')): ${MESSAGE}" > /dev/stderr
145
+ # Define where the error was originated inside the
146
+ # centos-art.sh script. Print out the function name and
147
+ # line from the caller.
148
+ local ORIGIN="${CLI_PROGRAM} ($(caller 1 | gawk '{ print $2 " " $1 }'))"
149
+
150
+ # Build the error message.
151
+ cli_printMessage "${ORIGIN}: ${MESSAGE}" --as-stderr-line
147
152
cli_printMessage "${FUNCDIRNAM}" --as-toknowmore-line
148
153
;;
149
154
@@ -198,16 +203,20 @@ function cli_printMessage {
198
203
echo "$MESSAGE"
199
204
;;
200
205
206
+ --as-stderr-line )
207
+ echo "$MESSAGE" > /dev/stderr
208
+ ;;
209
+
201
210
* )
202
211
echo "$MESSAGE" \
203
212
| awk 'BEGIN { FS=": " }
204
213
{
205
- if ( $0 ~ /^-+$/ )
214
+ if ( $0 ~ /^-+$/ )
206
215
print $0
207
216
else
208
- printf "%-15s\t%s\n", $1, $2
209
- }
210
- END {}' > /dev/stderr
217
+ printf "%-15s\t%s\n", $1, $2
218
+ }
219
+ END {}' > /dev/stderr
211
220
;;
212
221
213
222
esac