Browse Source

Solve or mute last ShellCheck issues

Alois Mahdal 6 years ago
parent
commit
094657164f

+ 1
- 0
src/bin/sfdoc View File

@@ -1,4 +1,5 @@
1 1
 #!/bin/bash
2
+#shellcheck disable=SC1090
2 3
 
3 4
 . "$(sfpath)" || exit 3
4 5
 

+ 4
- 0
src/bin/sfembed View File

@@ -1,4 +1,5 @@
1 1
 #!/bin/bash
2
+#shellcheck disable=SC1090
2 3
 
3 4
 . "$(sfpath)" || exit 3
4 5
 
@@ -41,6 +42,7 @@ mkmodules() {
41 42
     (
42 43
         SHELLFU_EMBEDTMP="$modlist" "$ScriptFullPath" >&2
43 44
     )
45
+    #shellcheck disable=SC2030
44 46
     awk '!x[$0]++' "$modlist" \
45 47
       | while read -r Module;
46 48
         do
@@ -60,6 +62,7 @@ mkfoot() {
60 62
     echo "#"
61 63
 }
62 64
 
65
+#shellcheck disable=SC2031
63 66
 mkmodule() {
64 67
     #
65 68
     # Print single module body
@@ -110,6 +113,7 @@ do_embed() {
110 113
 
111 114
 main() {
112 115
     local Script        # script to embed libraries into
116
+    #shellcheck disable=SC2034
113 117
     while true; do case "$1" in
114 118
         -d) PRETTY_DEBUG=true; shift ;;
115 119
         -v) PRETTY_VERBOSE=true; shift ;;

+ 2
- 0
src/include-bash/_pretty_color.sh View File

@@ -24,6 +24,8 @@ __shellfu__pretty_color__init() {
24 24
 
25 25
 _pretty__debug() {
26 26
     local decor="()"
27
+    local caller_is_main=${caller_is_main:-false}
28
+    local caller=${caller:-UNKNOWN}
27 29
     $caller_is_main && decor=
28 30
     while IFS= read -r line;
29 31
     do echo -ne "${_PRETTY_COLOR_DEBUG}debug:$caller$decor:$_PRETTY_COLOR_OFF"

+ 2
- 0
src/include-bash/_pretty_html.sh View File

@@ -3,6 +3,8 @@
3 3
 
4 4
 _pretty__debug() {
5 5
     local class=caller_fn
6
+    local caller_is_main=${caller_is_main:-false}
7
+    local caller=${caller:-UNKNOWN}
6 8
     $caller_is_main && class=caller_bin
7 9
     echo -n "<pre class='debug'><span class='$class'>$caller</span>"
8 10
     cat

+ 2
- 0
src/include-bash/_pretty_journald.sh View File

@@ -3,6 +3,8 @@
3 3
 
4 4
 _pretty__debug() {
5 5
     local decor="()"
6
+    local caller_is_main=${caller_is_main:-false}
7
+    local caller=${caller:-UNKNOWN}
6 8
     $caller_is_main && decor=
7 9
     sed "s/^/debug:$caller$decor: /" | systemd-cat -p debug -t "${0##*/}"
8 10
 }

+ 2
- 0
src/include-bash/_pretty_notify.sh View File

@@ -3,6 +3,8 @@
3 3
 
4 4
 _pretty__debug() {
5 5
     local decor="()"
6
+    local caller_is_main=${caller_is_main:-false}
7
+    local caller=${caller:-UNKNOWN}
6 8
     $caller_is_main && decor=
7 9
     notify-send -u low -a "${0##*/}" debug "debug:$caller$decor: $(cat)"
8 10
 }

+ 2
- 0
src/include-bash/_pretty_plain.sh View File

@@ -3,6 +3,8 @@
3 3
 
4 4
 _pretty__debug() {
5 5
     local decor="()"
6
+    local caller_is_main=${caller_is_main:-false}
7
+    local caller=${caller:-UNKNOWN}
6 8
     $caller_is_main && decor=
7 9
     while IFS= read -r line;
8 10
     do echo "debug:$caller$decor: $line"; done

+ 4
- 2
src/include-bash/pretty.sh View File

@@ -350,8 +350,9 @@ _pretty__echo() {
350 350
     local caller_is_main    # true if caller was main script or main() in it
351 351
     local provider          # which provider (_pretty__echo_*()) to use
352 352
     frontend="$(_pretty__get_frontend)" || exit_usage
353
-    read caller_nidx caller <<<$(_pretty__get_caller)
353
+    read -r caller_nidx caller <<<"$(_pretty__get_caller)"
354 354
     test "$frontend" = debug && _pretty__is_excluded "$caller" && return 0
355
+    #shellcheck disable=SC2034
355 356
     case $caller_nidx:$caller in
356 357
         0:*)        caller_is_main=true; caller="${0##*/}" ;;
357 358
         1:main)     caller_is_main=true; caller="${0##*/}" ;;
@@ -543,6 +544,7 @@ _pretty__is_word() {
543 544
     # Check if $1 contains only alphanumeric chars or _
544 545
     #
545 546
     local tainted="$1"
546
-    local clean=$(tr -c -d '_[:alnum:]' <<< "$tainted")
547
+    local clean
548
+    clean=$(tr -c -d '_[:alnum:]' <<< "$tainted")
547 549
     test "$tainted" = "$clean"
548 550
 }

+ 1
- 0
src/include-sh/charmenu.sh View File

@@ -1,4 +1,5 @@
1 1
 #!/bin/sh
2
+#shellcheck disable=SC2039
2 3
 
3 4
 
4 5
 CHARMENU_FILE="${CHARMENU_FILE:-}"

+ 1
- 0
src/include-sh/mdfmt.sh View File

@@ -1,4 +1,5 @@
1 1
 #!/bin/sh
2
+#shellcheck disable=SC2039
2 3
 
3 4
 #
4 5
 # mdfmt - Markdown formatted output from your shell scripts

+ 1
- 0
src/include-sh/termcolors.sh View File

@@ -1,4 +1,5 @@
1 1
 #!/bin/sh
2
+#shellcheck disable=SC2034
2 3
 
3 4
 #
4 5
 # Color definitions