Simplify argument parsing and add usage info
[joid.git] / ci / tools.sh
index ecb2e80..45db67e 100644 (file)
@@ -28,7 +28,7 @@ function echo_info { (
 }
 
 #######################################
-# Echo error
+# Echo error (to stderr)
 # Arguments:
 #   Same as for echo
 # Returns:
@@ -43,3 +43,20 @@ function echo_error { (
     >&2 echo "${@:1:($#-1)}" -e "$red_bold${@: -1}$color_off";
   )
 }
+
+#######################################
+# Echo warning (to stderr)
+# Arguments:
+#   Same as for echo
+# Returns:
+#   None
+#######################################
+function echo_warning { (
+    # don't clutter the script output with the xtrace of the echo command
+    { set +x; } 2> /dev/null
+
+    red_italic='\033[3;91m'
+    color_off='\033[0m'
+    >&2 echo "${@:1:($#-1)}" -e "$red_italic${@: -1}$color_off";
+  )
+}