Browse Source

Move version printing routine to saturnin.sh module

Alois Mahdal 8 years ago
parent
commit
99770e4f06
2 changed files with 11 additions and 6 deletions
  1. 2
    6
      src/bin/satcmd.skel
  2. 9
    0
      src/shellfu/saturnin.sh

+ 2
- 6
src/bin/satcmd.skel View File

@@ -24,6 +24,7 @@ SATURNIN_CACHE_HOME="__SATURNIN_CACHE_HOME__"
24 24
 SATURNIN_LIBEXEC="__SATURNIN_LIBEXEC__"
25 25
 SATURNIN_LIBEXEC_PREFIX="satcmd-"
26 26
 SATURNIN_APP_VERSION="__MKIT_PROJ_VERSION__"
27
+SATURNIN_APP_TAGLINE="__MKIT_PROJ_TAGLINE__"
27 28
 
28 29
 #
29 30
 # =====END BUILT PART=====
@@ -40,15 +41,10 @@ usage() {
40 41
             "--version"
41 42
 }
42 43
 
43
-version_info() {
44
-    echo "$(basename "$0") (Spirit of your toolbox) $SATURNIN_APP_VERSION"
45
-    exit "$SHELLFU_EXIT_OK"
46
-}
47
-
48 44
 while true; do case $1 in
49 45
     -d|--debug)     export SHELLFU_DEBUG=true; shift   ;;
50 46
     -v|--verbose)   export SHELLFU_VERBOSE=true; shift ;;
51
-    --version)      version_info                    ;;
47
+    --version)      saturnin__version; exit            ;;
52 48
     --version-semver) echo "$SATURNIN_APP_VERSION"; exit ;;
53 49
     -*)             usage;                          ;;
54 50
     --*)            usage;                          ;;

+ 9
- 0
src/shellfu/saturnin.sh View File

@@ -68,6 +68,15 @@ saturnin__runsc() {
68 68
     "$binpath" "$@"
69 69
 }
70 70
 
71
+saturnin__version() {
72
+    #
73
+    # Print version info
74
+    #
75
+    local tagline=${SATURNIN_APP_TAGLINE:-Some app with default tagline}
76
+    echo "$(basename "$0") ($tagline) $SATURNIN_APP_VERSION"
77
+    return "$SHELLFU_EXIT_OK"
78
+}
79
+
71 80
 saturnin__wraphook() {
72 81
     #
73 82
     # Wrap command "$@" in hooks