Parcourir la source

Add saturnin__bug() to help developers help users report bugs

Alois Mahdal il y a 7 ans
Parent
révision
89f01badef
1 fichiers modifiés avec 19 ajouts et 0 suppressions
  1. 19
    0
      src/saturnin.sh

+ 19
- 0
src/saturnin.sh Voir le fichier

@@ -67,6 +67,25 @@ SATURNIN_LIBEXEC="${SATURNIN_LIBEXEC:-}"
67 67
 SATURNIN_LIBEXEC_PREFIX="${SATURNIN_LIBEXEC_PREFIX:-}"
68 68
 
69 69
 
70
+saturnin__bug() {
71
+    #
72
+    # Warn about bug in your software
73
+    #
74
+    # Issue warning using warn() from pretty but also add application
75
+    # version.  This is useful when an assertion in your application
76
+    # fails such that it is certain that there is a bug inside it.
77
+    #
78
+    # In such cases, it makes sense to print also version information
79
+    # to help users with reporting.
80
+    #
81
+    local msg
82
+    for msg in "$@";
83
+    do
84
+        warn "bug: $msg"
85
+    done
86
+    warn "bug in $(basename "$0") version: $SATURNIN_APP_VERSION"
87
+}
88
+
70 89
 saturnin__conf() {
71 90
     #
72 91
     # inigrep smart loader