@@ -72,7 +72,11 @@ function clog {
72
72
;;
73
73
esac
74
74
75
- echo -e " ${COL}${TYPEOUT}${NC} $MSG "
75
+ if [[ " $NO_COLOR_OUTPUT " == " 0" ]] ; then
76
+ echo -e " ${COL}${TYPEOUT}${NC} $MSG "
77
+ else
78
+ echo -e " ${TYPEOUT} $MSG "
79
+ fi
76
80
}
77
81
78
82
#
@@ -215,21 +219,40 @@ function cleanup {
215
219
# MAIN
216
220
# ############################################################################
217
221
222
+ # Check for if we need to turn off colors in our output
223
+ NO_COLOR_OUTPUT=0
224
+ if [[ " $1 " == " --no-color-output" || " $1 " == " -n" ]] ; then
225
+ NO_COLOR_OUTPUT=1
226
+ shift
227
+ fi
228
+
218
229
# We need a project directory and configuration file
219
230
CFG=$1
220
231
PROJECT_DIR=$2
221
232
222
233
if [[ " $CFG " == " help" || " $CFG " == " --help" || " $CFG " == " -?" || " $CFG " == " ?" ]] ; then
223
- echo " Usage: mtechdocs [help|clean|init]"
234
+ echo " Usage: mtechdocs [-n|--no-color-output] [help|clean|init]"
235
+ echo " The optional -n or --no-color-output argument suppresses coloring"
236
+ echo " in output to the terminal, useful for jenkins builds or other places"
237
+ echo " where bash coloring information is not interpreted."
238
+ echo " "
224
239
echo " help : Display this help message"
225
240
echo " clean: Remove temporary build files"
226
241
echo " init : Create a new MkTechDocs project in the current directory"
227
242
echo
228
- echo " Usage: mtechdocs"
243
+ echo " Usage: mtechdocs [-n|--no-color-output]"
244
+ echo " The optional -n or --no-color-output argument suppresses coloring"
245
+ echo " in output to the terminal, useful for jenkins builds or other places"
246
+ echo " where bash coloring information is not interpreted."
247
+ echo " "
229
248
echo " Builds the MkTechDocs project in the current directory. Assumes"
230
249
echo " that a mktechdocs.conf file and master.md file are present."
231
250
echo
232
- echo " Usage: mtechdocs <config> <directory>"
251
+ echo " Usage: mtechdocs [-n|--no-color-output] <config> <directory>"
252
+ echo " The optional -n or --no-color-output argument suppresses coloring"
253
+ echo " in output to the terminal, useful for jenkins builds or other places"
254
+ echo " where bash coloring information is not interpreted."
255
+ echo " "
233
256
echo " Builds the MkTechDocs project in the given directory using the"
234
257
echo " given configuration."
235
258
exit 0
0 commit comments