Procházet zdrojové kódy

Use non-specific global names where possible

Use of app name when naming of global variables and/or mkit tokens makes
upgrade of the saturnin template painful and error-prone, while none of
these variables can be overriden from environment so the namespacing
advantage is vain.
Alois Mahdal před 8 roky
rodič
revize
ac6b62e952
2 změnil soubory, kde provedl 17 přidání a 17 odebrání
  1. 6
    6
      mkit.ini
  2. 11
    11
      src/bin/satcmd.skel

+ 6
- 6
mkit.ini Zobrazit soubor

@@ -37,12 +37,12 @@
37 37
     etc_bc  = /etc/bash_completion.d
38 38
 
39 39
 [vars]
40
-    __SATCMD_CACHE_HOME__       = $HOME/.local/share/satcmd
41
-    __SATCMD_CONFIG_USER__      = $HOME/.satcmd
42
-    __SATCMD_CONFIG_LOCAL__     = [roots:etc]
43
-    __SATCMD_LIBEXEC__          = [roots:libexec]
44
-    __SATCMD_SHARE__            = [roots:share]
45
-    __SATCMD_SHELLFU_DIR__      = [roots:share]/shellfu
40
+    __SATURNIN_CACHE_HOME__     = $HOME/.local/share/satcmd
41
+    __SATURNIN_CONFIG_USER__    = $HOME/.satcmd
42
+    __SATURNIN_CONFIG_LOCAL__   = [roots:etc]
43
+    __SATURNIN_LIBEXEC__        = [roots:libexec]
44
+    __SATURNIN_SHARE__          = [roots:share]
45
+    __SATURNIN_SHELLFU_DIR__    = [roots:share]/shellfu
46 46
 
47 47
 [files:bin]
48 48
     src/bin/satcmd              = satcmd

+ 11
- 11
src/bin/satcmd.skel Zobrazit soubor

@@ -12,18 +12,18 @@ shellfu import pretty
12 12
 
13 13
 SHELLFU_INIGREP_PATH="$(
14 14
     inigrep__mkpath \
15
-        __SATCMD_CONFIG_USER__/ini.d \
16
-        __SATCMD_CONFIG_USER__ \
17
-        __SATCMD_CONFIG_LOCAL__ \
18
-        __SATCMD_SHARE__/ini.d
15
+        __SATURNIN_CONFIG_USER__/ini.d \
16
+        __SATURNIN_CONFIG_USER__ \
17
+        __SATURNIN_CONFIG_LOCAL__ \
18
+        __SATURNIN_SHARE__/ini.d
19 19
 )"
20 20
 
21
-SHELLFU_PATH="__SATCMD_SHELLFU_DIR__"
21
+SHELLFU_PATH="__SATURNIN_SHELLFU_DIR__"
22 22
 SHELLFU_PRETTY_USAGE="subcommand"
23
-SATCMD_CACHE_HOME="__SATCMD_CACHE_HOME__"
24
-SATURNIN_LIBEXEC="__SATCMD_LIBEXEC__"
23
+SATURNIN_CACHE_HOME="__SATURNIN_CACHE_HOME__"
24
+SATURNIN_LIBEXEC="__SATURNIN_LIBEXEC__"
25 25
 SATURNIN_LIBEXEC_PREFIX="satcmd-"
26
-SATCMD_VERSION="__VERSION__"
26
+SATURNIN_APP_VERSION="__VERSION__"
27 27
 
28 28
 #
29 29
 # =====END BUILT PART=====
@@ -32,7 +32,7 @@ SATCMD_VERSION="__VERSION__"
32 32
 shellfu import saturnin
33 33
 
34 34
 export SHELLFU_INIGREP_PATH SHELLFU_PATH SHELLFU_PRETTY_USAGE \
35
-       SATCMD_VERSION SATCMD_CACHE_HOME
35
+       SATURNIN_APP_VERSION SATURNIN_CACHE_HOME
36 36
 
37 37
 usage() {
38 38
     mkusage "[-d|-v] command [args...]" \
@@ -41,7 +41,7 @@ usage() {
41 41
 }
42 42
 
43 43
 version_info() {
44
-    echo "$(basename "$0") (Spirit of your toolbox) $SATCMD_VERSION"
44
+    echo "$(basename "$0") (Spirit of your toolbox) $SATURNIN_APP_VERSION"
45 45
     exit "$SHELLFU_EXIT_OK"
46 46
 }
47 47
 
@@ -49,7 +49,7 @@ while true; do case $1 in
49 49
     -d|--debug)     export SHELLFU_DEBUG=true; shift   ;;
50 50
     -v|--verbose)   export SHELLFU_VERBOSE=true; shift ;;
51 51
     --version)      version_info                    ;;
52
-    --version-semver) echo "$SATCMD_VERSION"; exit ;;
52
+    --version-semver) echo "$SATURNIN_APP_VERSION"; exit ;;
53 53
     -*)             usage;                          ;;
54 54
     --*)            usage;                          ;;
55 55
     --)             shift; break                    ;;