Parcourir la source

Make saturnin__version() smarter

Only print tagline if defined (similar to codename); do not make it up
with silly string.

Also we can do away without any local variables *and* very safely inside
79 character width recommendation.
Alois Mahdal il y a 7 ans
Parent
révision
7843f2d0c1
1 fichiers modifiés avec 7 ajouts et 4 suppressions
  1. 7
    4
      src/saturnin.sh.skel

+ 7
- 4
src/saturnin.sh.skel Voir le fichier

@@ -364,10 +364,13 @@ saturnin__version() {
364 364
     #
365 365
     # Print version info
366 366
     #
367
-    local tagline=${SATURNIN_APP_TAGLINE:-Some app with default tagline}
368
-    local maybe_codename=""
369
-    test -n "$SATURNIN_APP_CODENAME" && maybe_codename=" - $SATURNIN_APP_CODENAME"
370
-    echo "$(basename "$0") ($tagline) $SATURNIN_APP_VERSION$maybe_codename"
367
+    echo -n "$(basename "$0")"
368
+    test -n "$SATURNIN_APP_TAGLINE" \
369
+     && echo -n " ($SATURNIN_APP_TAGLINE)"
370
+    echo -n " $SATURNIN_APP_VERSION"
371
+    test -n "$SATURNIN_APP_CODENAME" \
372
+     && echo -n " - $SATURNIN_APP_CODENAME"
373
+    echo
371 374
     return "$EXIT_OK"
372 375
 }
373 376