Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

do not show warning on shift when nothing to shift

  • Loading branch information...
commit ddb249bdd7f1aab897d1875e72d4a76d7f3f7b45 1 parent 2913d9a
Michal Papis mpapis authored

Showing 56 changed files with 213 additions and 213 deletions. Show diff stats Hide diff stats

  1. +14 14 core/api/shell/array/functions
  2. +4 4 core/api/shell/command/functions
  3. +5 5 core/api/shell/config/functions
  4. +3 3 core/api/shell/database/extensions
  5. +5 5 core/api/shell/date/functions
  6. +2 2 core/api/shell/extensions/functions
  7. +12 12 core/api/shell/files/functions
  8. +2 2 core/api/shell/hash/functions
  9. +1 1  core/api/shell/interactive/functions
  10. +2 2 core/api/shell/os/functions
  11. +3 3 core/api/shell/package/extensions
  12. +13 13 core/api/shell/package/functions
  13. +8 8 core/api/shell/paths/functions
  14. +3 3 core/api/shell/service/extensions
  15. +1 1  core/api/shell/steps/functions
  16. +2 2 core/api/shell/string/functions
  17. +4 4 core/api/shell/templates/functions
  18. +2 2 core/api/shell/traps/functions
  19. +7 7 core/api/shell/user/functions
  20. +2 2 core/cli/shell/dev/functions
  21. +1 1  core/cli/shell/ext/functions
  22. +1 1  core/cli/shell/functions
  23. +2 2 core/cli/shell/sets/functions
  24. +1 1  core/install/shell/functions
  25. +6 6 core/internal/shell/array/functions
  26. +1 1  core/internal/shell/config/extensions
  27. +3 3 core/internal/shell/database/extensions
  28. +2 2 core/internal/shell/extensions/cache/functions
  29. +4 4 core/internal/shell/extensions/common/functions
  30. +3 3 core/internal/shell/extensions/completion/functions
  31. +4 4 core/internal/shell/extensions/detection/functions
  32. +7 7 core/internal/shell/extensions/manipulation/functions
  33. +3 3 core/internal/shell/files/functions
  34. +1 1  core/internal/shell/os/functions
  35. +3 3 core/internal/shell/package/extensions
  36. +4 4 core/internal/shell/package/functions
  37. +1 1  core/internal/shell/paths/functions
  38. +1 1  core/internal/shell/processes/functions
  39. +3 3 core/internal/shell/service/extensions
  40. +3 3 core/internal/shell/service/functions
  41. +1 1  core/internal/shell/services/functions
  42. +1 1  core/internal/shell/steps/functions
  43. +5 5 core/internal/shell/templates/functions
  44. +2 2 core/internal/shell/variables/functions
  45. +5 5 core/internal/shell/vcs/detection/functions
  46. +2 2 core/internal/shell/vcs/errors/functions
  47. +11 11 core/internal/shell/vcs/functions
  48. +2 2 core/internal/shell/vcs/handlers/archive/functions
  49. +2 2 core/internal/shell/vcs/handlers/git/functions
  50. +2 2 core/internal/shell/vcs/handlers/github/functions
  51. +2 2 core/internal/shell/vcs/handlers/hg/functions
  52. +2 2 core/internal/shell/vcs/handlers/path/functions
  53. +2 2 core/internal/shell/vcs/handlers/svn/functions
  54. +11 11 core/sm/shell/log/functions
  55. +5 5 core/sm/shell/modules/functions
  56. +9 9 core/sm/shell/versionedfs/functions
28 core/api/shell/array/functions
@@ -31,12 +31,12 @@ array()
31 31 trace_filter array || set -o xtrace
32 32 local _command _subcommand _name _variable
33 33 _command="$1"
34   - shift || __sm.log.fail "Array command must be given as the first parameter."
  34 + (( $# )) && shift || __sm.log.fail "Array command must be given as the first parameter."
35 35
36 36 case "${_command}" in
37 37 (is)
38 38 _subcommand="$1" _name="$2"
39   - shift 2 || __sm.log.fail "subcommand and array name missing;"\
  39 + (( $# >= 2 )) && shift 2 || __sm.log.fail "subcommand and array name missing;"\
40 40 " array is <empty,nonempty,even> {name}"
41 41 case "${_subcommand}" in
42 42 (empty)
@@ -55,65 +55,65 @@ array()
55 55 ;;
56 56 (length)
57 57 _name="$1"
58   - shift || __sm.log.fail "Array name missing: array length {name}"
  58 + (( $# )) && shift || __sm.log.fail "Array name missing: array length {name}"
59 59 __sm.array.length "${_name}"
60 60 ;;
61 61 (last)
62 62 _name="$1"
63   - shift || __sm.log.fail "Array name missing: array last {name}"
  63 + (( $# )) && shift || __sm.log.fail "Array name missing: array last {name}"
64 64 __sm.array.last "${_name}"
65 65 ;;
66 66 (first)
67 67 _name="$1"
68   - shift || __sm.log.fail "Array name missing: array first {name}"
  68 + (( $# )) && shift || __sm.log.fail "Array name missing: array first {name}"
69 69 __sm.array.first "${_name}"
70 70 ;;
71 71 (push)
72 72 _name="$1" _element="$2"
73   - shift 2 || __sm.log.fail "Array name or element missing:"\
  73 + (( $# >= 2 )) && shift 2 || __sm.log.fail "Array name or element missing:"\
74 74 " array push {name} {element}"
75 75 __sm.array.push "${_name}" "${_element}"
76 76 ;;
77 77 (pop)
78 78 _name="$1" _variable="${2:-}"
79   - shift || __sm.log.fail "Array name missing: array pop {name} [{variable}]"
  79 + (( $# )) && shift || __sm.log.fail "Array name missing: array pop {name} [{variable}]"
80 80 __sm.array.pop "${_name}" "${_variable}"
81 81 ;;
82 82 (append)
83 83 _name="$1" _element="$2"
84   - shift 2 || __sm.log.fail "Array name or element missing:"\
  84 + (( $# >= 2 )) && shift 2 || __sm.log.fail "Array name or element missing:"\
85 85 " array append {name} {element}"
86 86 __sm.array.append "${_name}" "${_element}"
87 87 ;;
88 88 (shift)
89 89 _name="$1" _variable="${2:-}"
90   - shift || __sm.log.fail "Array name missing: array shift {name} [{variable}]"
  90 + (( $# )) && shift || __sm.log.fail "Array name missing: array shift {name} [{variable}]"
91 91 __sm.array.shift "${_name}" "${_variable}"
92 92 ;;
93 93 (unshift)
94 94 _name="$1"
95   - shift || __sm.log.fail "Array name missing: array unshift {name} [{variable}]"
  95 + (( $# )) && shift || __sm.log.fail "Array name missing: array unshift {name} [{variable}]"
96 96 __sm.array.unshift "${_name}" "${_variable}"
97 97 ;;
98 98 (join)
99 99 _name="$1" _separator="${2:-' '}"
100   - shift || __sm.log.fail "Array name missing: array join {name} [separator]"
  100 + (( $# )) && shift || __sm.log.fail "Array name missing: array join {name} [separator]"
101 101 __sm.array.join "${_name}" "${_separator}"
102 102 ;;
103 103 (largest)
104 104 _name="$1"
105   - shift || __sm.log.fail "Array name missing: array largest {name}"
  105 + (( $# )) && shift || __sm.log.fail "Array name missing: array largest {name}"
106 106 __sm.array.largest "${_name}"
107 107 ;;
108 108 (sort)
109 109 _subcommand="$1" _name="$2"
110   - shift 2 || __sm.log.fail "sort direction and array name missing;"\
  110 + (( $# >= 2 )) && shift 2 || __sm.log.fail "sort direction and array name missing;"\
111 111 " array sort <desc,asc> {name}."
112 112 __sm.array.sort "${_name}" "${_subcommand}"
113 113 ;;
114 114 (unique)
115 115 _name="$1"
116   - shift || __sm.log.fail "Array name missing: array unique {name}."
  116 + (( $# )) && shift || __sm.log.fail "Array name missing: array unique {name}."
117 117 __sm.array.unique "${_name}"
118 118 ;;
119 119 (start)
8 core/api/shell/command/functions
@@ -16,7 +16,7 @@ command()
16 16 ;;
17 17 (is)
18 18 _subcommand="$1"
19   - shift || __sm.log.fail "A command must follow keyword 'is'; <function>"
  19 + (( $# )) && shift || __sm.log.fail "A command must follow keyword 'is'; <function>"
20 20 case "${_subcommand}" in
21 21 (function)
22 22 if __sm.command.is.function "$1" >/dev/null 2>&1
@@ -31,14 +31,14 @@ command()
31 31 ;;
32 32 (full)
33 33 _subcommand="$1"
34   - shift || __sm.log.fail "A 'command full' must follow keyword 'name'."
  34 + (( $# )) && shift || __sm.log.fail "A 'command full' must follow keyword 'name'."
35 35 case "${_subcommand}" in
36 36 (name)
37 37 if __sm.command.full.name "$1" >/dev/null 2>&1
38 38 then return 0 ; else return 1 ; fi
39 39 ;;
40 40 (*)
41   - shift || __sm.log.fail "A 'command full' must follow keyword 'name'."
  41 + (( $# )) && shift || __sm.log.fail "A 'command full' must follow keyword 'name'."
42 42 ;;
43 43 esac
44 44 ;;
@@ -47,7 +47,7 @@ command()
47 47 (as)
48 48 shift
49 49 _user="$1"
50   - shift || __sm.log.fail "A user name or id must be specified after keyword 'as'"
  50 + (( $# )) && shift || __sm.log.fail "A user name or id must be specified after keyword 'as'"
51 51 # TODO: Check to ensure user name/id exists on the system
52 52 if __sm.command.run.as "${_user}" "${_flags[*]}" "$@"
53 53 then return 0 ; else return 1 ; fi
10 core/api/shell/config/functions
@@ -15,23 +15,23 @@ config()
15 15 ;;
16 16 (key)
17 17 _key="$1"
18   - shift || __sm.log.fail "a key must be given after keywords 'key'"
  18 + (( $# )) && shift || __sm.log.fail "a key must be given after keywords 'key'"
19 19 ;;
20 20 (value)
21 21 _value="$1"
22   - shift || __sm.log.fail "a value must be given after keywords 'value'"
  22 + (( $# )) && shift || __sm.log.fail "a value must be given after keywords 'value'"
23 23 ;;
24 24 (into|as)
25 25 _variable="$1"
26   - shift || __sm.log.fail "a variable name must be given after keywords 'into|as'"
  26 + (( $# )) && shift || __sm.log.fail "a variable name must be given after keywords 'into|as'"
27 27 ;;
28 28 (prefix) # TODO: Nix prefix?
29 29 _prefix="$1"
30   - shift || __sm.log.fail "a prefix name must be given after keyword 'prefix'"
  30 + (( $# )) && shift || __sm.log.fail "a prefix name must be given after keyword 'prefix'"
31 31 ;;
32 32 (file)
33 33 _file="$1"
34   - shift || __sm.log.fail "a file name must be given after keyword 'file'"
  34 + (( $# )) && shift || __sm.log.fail "a file name must be given after keyword 'file'"
35 35 ;;
36 36 (from)
37 37 _extension="$1" || __sm.log.fail "An extension name must follow keyword 'for'"
6 core/api/shell/database/extensions
@@ -7,9 +7,9 @@ database_extension_setup()
7 7 extension="${1}"
8 8 module="${2}"
9 9 path="${3}"
10   - shift || __sm.log.fail "Extension must be given as the first parameter."
11   - shift || __sm.log.fail "Module must be given as the second parameter."
12   - shift || __sm.log.fail "Path must be given as the third parameter."
  10 + (( $# )) && shift || __sm.log.fail "Extension must be given as the first parameter."
  11 + (( $# )) && shift || __sm.log.fail "Module must be given as the second parameter."
  12 + (( $# )) && shift || __sm.log.fail "Path must be given as the third parameter."
13 13
14 14 paths enter "${path}"
15 15
10 core/api/shell/date/functions
@@ -15,23 +15,23 @@ date()
15 15 case "${_token}" in
16 16 (step)
17 17 _step="${1:-}"
18   - shift || __sm.log.fail "step must follow keyword 'step'"
  18 + (( $# )) && shift || __sm.log.fail "step must follow keyword 'step'"
19 19 ;;
20 20 (format_in)
21 21 _format_in="${1}"
22   - shift || __sm.log.fail "input format must follow keyword 'format_in'"
  22 + (( $# )) && shift || __sm.log.fail "input format must follow keyword 'format_in'"
23 23 ;;
24 24 (format|format_out)
25 25 _format_out="${1}"
26   - shift || __sm.log.fail "output format must follow keyword 'format[_out]'"
  26 + (( $# )) && shift || __sm.log.fail "output format must follow keyword 'format[_out]'"
27 27 ;;
28 28 (start)
29 29 _start="${1}"
30   - shift || __sm.log.fail "start must follow keyword 'start'"
  30 + (( $# )) && shift || __sm.log.fail "start must follow keyword 'start'"
31 31 ;;
32 32 (end)
33 33 _end="${1}"
34   - shift || __sm.log.fail "end must follow keyword 'end'"
  34 + (( $# )) && shift || __sm.log.fail "end must follow keyword 'end'"
35 35 ;;
36 36 (*)
37 37 if [[ -z "${_start}" ]]
4 core/api/shell/extensions/functions
@@ -30,11 +30,11 @@ extension()
30 30 case "$1" in
31 31 (name|for|as)
32 32 _name=$2
33   - shift 2 || __sm.log.fail "Extension name was not given after <$1> param."
  33 + (( $# >= 2 )) && shift 2 || __sm.log.fail "Extension name was not given after <$1> param."
34 34 ;;
35 35 (uri|from)
36 36 _uri=$2
37   - shift 2 || __sm.log.fail "Extension uri was not given after <$1> param."
  37 + (( $# >= 2 )) && shift 2 || __sm.log.fail "Extension uri was not given after <$1> param."
38 38 ;;
39 39 (*)
40 40 _params+=( "$1" )
24 core/api/shell/files/functions
@@ -45,11 +45,11 @@ files()
45 45 ;;
46 46 (chmod)
47 47 _mode="${1}"
48   - shift || __sm.log.fail "Mode must follow keywords 'chmod'"
  48 + (( $# )) && shift || __sm.log.fail "Mode must follow keywords 'chmod'"
49 49 ;;
50 50 (chown)
51 51 _owner="${1}"
52   - shift || __sm.log.fail "Owner must be provided after keyword 'owner'"
  52 + (( $# )) && shift || __sm.log.fail "Owner must be provided after keyword 'owner'"
53 53 ;;
54 54 esac
55 55
@@ -62,19 +62,19 @@ files()
62 62 ;;
63 63 (to)
64 64 _target="${1}"
65   - shift || __sm.log.fail "Target path must be provided after keyword '${_token}'"
  65 + (( $# )) && shift || __sm.log.fail "Target path must be provided after keyword '${_token}'"
66 66 ;;
67 67 (from)
68 68 _source="${1}"
69   - shift || __sm.log.fail "Source path must be provided after keyword 'from'"
  69 + (( $# )) && shift || __sm.log.fail "Source path must be provided after keyword 'from'"
70 70 ;;
71 71 (mode|permissions)
72 72 _mode="${1}"
73   - shift || __sm.log.fail "Mode must follow keywords 'mode|permissions'"
  73 + (( $# )) && shift || __sm.log.fail "Mode must follow keywords 'mode|permissions'"
74 74 ;;
75 75 (owner)
76 76 _owner="${1}"
77   - shift || __sm.log.fail "Owner must be provided after keyword 'owner'"
  77 + (( $# )) && shift || __sm.log.fail "Owner must be provided after keyword 'owner'"
78 78 ;;
79 79 (recursive|recursively)
80 80 _flags+=(-R)
@@ -88,27 +88,27 @@ files()
88 88 ;;
89 89 (string|content)
90 90 _string="$1"
91   - shift || __sm.log.fail "A string must be followed by keyword 'string'"
  91 + (( $# )) && shift || __sm.log.fail "A string must be followed by keyword 'string'"
92 92 ;;
93 93 (regex)
94 94 _regex="$1"
95   - shift || __sm.log.fail "A regex must be followed by keyword 'regex'"
  95 + (( $# )) && shift || __sm.log.fail "A regex must be followed by keyword 'regex'"
96 96 ;;
97 97 (in)
98 98 _files+=("$1")
99   - shift || __sm.log.fail "A file name must follow keyword 'in'"
  99 + (( $# )) && shift || __sm.log.fail "A file name must follow keyword 'in'"
100 100 ;;
101 101 (key)
102 102 _key="$1"
103   - shift || __sm.log.fail "A key name must follow keyword 'key'"
  103 + (( $# )) && shift || __sm.log.fail "A key name must follow keyword 'key'"
104 104 ;;
105 105 (value)
106 106 _value="$1"
107   - shift || __sm.log.fail "A value must follow keyword 'value'"
  107 + (( $# )) && shift || __sm.log.fail "A value must follow keyword 'value'"
108 108 ;;
109 109 (with)
110 110 _string="$1"
111   - shift || __sm.log.fail "A content string must follow keyword 'with'"
  111 + (( $# )) && shift || __sm.log.fail "A content string must follow keyword 'with'"
112 112 ;;
113 113 (*)
114 114 _files+=("${_token}")
4 core/api/shell/hash/functions
@@ -19,11 +19,11 @@ hash()
19 19 ;;
20 20 (key)
21 21 _key="$1"
22   - shift || __sm.log.fail "Key name must follow keyword 'key'"
  22 + (( $# )) && shift || __sm.log.fail "Key name must follow keyword 'key'"
23 23 ;;
24 24 (variable)
25 25 _variable="$1"
26   - shift || __sm.log.fail "Variable name must follow keyword 'variable'"
  26 + (( $# )) && shift || __sm.log.fail "Variable name must follow keyword 'variable'"
27 27 ;;
28 28 (*)
29 29 if [[ -z "${_command}" ]]
2  core/api/shell/interactive/functions
@@ -10,7 +10,7 @@ shell()
10 10 (is)
11 11 _command=is
12 12 _subcommand="${1}"
13   - shift || __sm.log.fail "A command must follow keyword 'is'"
  13 + (( $# )) && shift || __sm.log.fail "A command must follow keyword 'is'"
14 14 case "${_subcommand}" in
15 15 (interactive)
16 16 [[ -t 0 ]]
4 core/api/shell/os/functions
@@ -22,13 +22,13 @@ os()
22 22 (is)
23 23 _command="$token"
24 24 _os="${1}"
25   - shift || __sm.log.fail "lowercase operating system name must follow keyword 'os';"\
  25 + (( $# )) && shift || __sm.log.fail "lowercase operating system name must follow keyword 'os';"\
26 26 "os is <linux|darwin|bsd|solaris|aix>"
27 27 ;;
28 28 (cpu)
29 29 _command=cpu
30 30 _subcommand="$1"
31   - shift || __sm.log.fail "A command must follow keyword 'cpu'; one of {count}"
  31 + (( $# )) && shift || __sm.log.fail "A command must follow keyword 'cpu'; one of {count}"
32 32 case "${_subcommand}" in
33 33 (count)
34 34 true # all good.
6 core/api/shell/package/extensions
@@ -7,9 +7,9 @@ package_extension_setup()
7 7 module="${2:-}"
8 8 path="${3:-}"
9 9 true ${language:=shell}
10   - shift || __sm.log.fail "No extension name given."
11   - shift || __sm.log.fail "No module name given."
12   - shift || __sm.log.fail "No path given."
  10 + (( $# )) && shift || __sm.log.fail "No extension name given."
  11 + (( $# )) && shift || __sm.log.fail "No module name given."
  12 + (( $# )) && shift || __sm.log.fail "No path given."
13 13
14 14 for action in install uninstall update activate deactivate
15 15 do
26 core/api/shell/package/functions
@@ -65,15 +65,15 @@ package()
65 65 ;;
66 66 (log)
67 67 _log="$1"
68   - shift || __sm.log.fail "Log file path/name must be given following keyword 'log'"
  68 + (( $# )) && shift || __sm.log.fail "Log file path/name must be given following keyword 'log'"
69 69 ;;
70 70 (lines)
71 71 _lines="$1"
72   - shift || __sm.log.fail "Number of lines to show must be given following keyword 'lines'"
  72 + (( $# )) && shift || __sm.log.fail "Number of lines to show must be given following keyword 'lines'"
73 73 ;;
74 74 (message)
75 75 _message="$1"
76   - shift || __sm.log.fail "Message must be given following keyword 'message'"
  76 + (( $# )) && shift || __sm.log.fail "Message must be given following keyword 'message'"
77 77 ;;
78 78 (configure)
79 79 _command=configure
@@ -114,43 +114,43 @@ package()
114 114 ;;
115 115 (key)
116 116 _key="$1"
117   - shift || __sm.log.fail "Key name must follow keyword 'key'"
  117 + (( $# )) && shift || __sm.log.fail "Key name must follow keyword 'key'"
118 118 ;;
119 119 (name)
120 120 package_name="$1"
121   - shift || __sm.log.fail "a package name must follow keyword 'name'"
  121 + (( $# )) && shift || __sm.log.fail "a package name must follow keyword 'name'"
122 122 ;;
123 123 (version)
124 124 package_version="$1"
125   - shift || __sm.log.fail "a package version must follow keyword 'version'"
  125 + (( $# )) && shift || __sm.log.fail "a package version must follow keyword 'version'"
126 126 ;;
127 127 (base_url)
128 128 package_base_url="$1"
129   - shift || __sm.log.fail "a package base_url must follow keyword 'base_url'"
  129 + (( $# )) && shift || __sm.log.fail "a package base_url must follow keyword 'base_url'"
130 130 ;;
131 131 (file)
132 132 package_file="$1"
133   - shift || __sm.log.fail "a package file name must follow keyword 'file'"
  133 + (( $# )) && shift || __sm.log.fail "a package file name must follow keyword 'file'"
134 134 ;;
135 135 (user)
136 136 package_user="$1"
137   - shift || __sm.log.fail "a package user name must follow keyword 'user'"
  137 + (( $# )) && shift || __sm.log.fail "a package user name must follow keyword 'user'"
138 138 ;;
139 139 (archive_format)
140 140 archive_format="$1"
141   - shift || __sm.log.fail "a package archive_format must follow keyword 'archive_format'"
  141 + (( $# )) && shift || __sm.log.fail "a package archive_format must follow keyword 'archive_format'"
142 142 ;;
143 143 (md5)
144 144 package_md5="$1"
145   - shift || __sm.log.fail "a package md5 sum must follow keyword 'md5'"
  145 + (( $# )) && shift || __sm.log.fail "a package md5 sum must follow keyword 'md5'"
146 146 ;;
147 147 (sha256)
148 148 package_sha256="$1"
149   - shift || __sm.log.fail "a package sha256 key must follow keyword 'sha256'"
  149 + (( $# )) && shift || __sm.log.fail "a package sha256 key must follow keyword 'sha256'"
150 150 ;;
151 151 (sha512)
152 152 package_sha512="$1"
153   - shift || __sm.log.fail "a package sha512 key must follow keyword 'sha512'"
  153 + (( $# )) && shift || __sm.log.fail "a package sha512 key must follow keyword 'sha512'"
154 154 ;;
155 155 (*)
156 156 _params+=("${_token}")
16 core/api/shell/paths/functions
@@ -68,11 +68,11 @@ paths()
68 68 case "${_command}" in
69 69 (chmod)
70 70 _mode="${1}"
71   - shift || __sm.log.fail "Mode must follow keywords 'chmod'"
  71 + (( $# )) && shift || __sm.log.fail "Mode must follow keywords 'chmod'"
72 72 ;;
73 73 (chown)
74 74 _owner="${1}"
75   - shift || __sm.log.fail "Owner must be provided after keyword 'owner'"
  75 + (( $# )) && shift || __sm.log.fail "Owner must be provided after keyword 'owner'"
76 76 ;;
77 77 esac
78 78
@@ -82,31 +82,31 @@ paths()
82 82 case "${_token}" in
83 83 (to)
84 84 _target="${1}"
85   - shift || __sm.log.fail "Target path must be given after keyword 'to'"
  85 + (( $# )) && shift || __sm.log.fail "Target path must be given after keyword 'to'"
86 86 ;;
87 87 (from)
88 88 _source="${1}"
89   - shift || __sm.log.fail "Source path must be given after keyword 'from'"
  89 + (( $# )) && shift || __sm.log.fail "Source path must be given after keyword 'from'"
90 90 ;;
91 91 (mode|permissions)
92 92 _mode="${1}"
93   - shift || __sm.log.fail "Mode must follow keyword '${_token}'"
  93 + (( $# )) && shift || __sm.log.fail "Mode must follow keyword '${_token}'"
94 94 ;;
95 95 (owner)
96 96 _owner="${1}"
97   - shift || __sm.log.fail "Owner must be given after keyword 'owner'"
  97 + (( $# )) && shift || __sm.log.fail "Owner must be given after keyword 'owner'"
98 98 ;;
99 99 (recursive|recursively)
100 100 _flags+=(-R)
101 101 ;;
102 102 (matching|regex|glob)
103 103 _regex="$1"
104   - shift ||
  104 + (( $# )) && shift ||
105 105 __sm.log.fail "Shell glob pattern string must b given after keyword '${_token}'"
106 106 ;;
107 107 (in)
108 108 _paths+=("$1")
109   - shift || __sm.log.fail "A path is expected following keyword 'in'"
  109 + (( $# )) && shift || __sm.log.fail "A path is expected following keyword 'in'"
110 110 ;;
111 111 (*)
112 112 _paths+=("${_token}")
6 core/api/shell/service/extensions
@@ -7,9 +7,9 @@ service_extension_setup()
7 7 module="${2:-}"
8 8 path="${3:-}"
9 9 true ${language:=shell}
10   - shift || __sm.log.fail "Extension name not given as first parameter."
11   - shift || __sm.log.fail "Module name not given as second parameter."
12   - shift || __sm.log.fail "Path not given as third parameter."
  10 + (( $# )) && shift || __sm.log.fail "Extension name not given as first parameter."
  11 + (( $# )) && shift || __sm.log.fail "Module name not given as second parameter."
  12 + (( $# )) && shift || __sm.log.fail "Path not given as third parameter."
13 13
14 14 for action in start stop restart status list
15 15 do
2  core/api/shell/steps/functions
@@ -7,7 +7,7 @@ step()
7 7 local name
8 8 name="$1"
9 9
10   - shift || __sm.log.fail "Cannot take step as no step name given;"\
  10 + (( $# )) && shift || __sm.log.fail "Cannot take step as no step name given;"\
11 11 "step [name] <- missing name."
12 12
13 13 start_step "$name"
4 core/api/shell/string/functions
@@ -14,7 +14,7 @@ string()
14 14 case "${_token}" in
15 15 (from)
16 16 _search="$1"
17   - shift || __sm.log.fail "From source string must follow keyword 'from'"
  17 + (( $# )) && shift || __sm.log.fail "From source string must follow keyword 'from'"
18 18 ;;
19 19 (to)
20 20 _string="$1"
@@ -22,7 +22,7 @@ string()
22 22 (contains)
23 23 _command=contains
24 24 _search="$1"
25   - shift || __sm.log.fail "Search (glob) string must follow keyword 'contains'"
  25 + (( $# )) && shift || __sm.log.fail "Search (glob) string must follow keyword 'contains'"
26 26 ;;
27 27 (*)
28 28 if [[ -z "${_string}" ]]
8 core/api/shell/templates/functions
@@ -41,7 +41,7 @@ templates()
41 41 fi
42 42
43 43 _name="$1"
44   - shift || __sm.log.fail "Template name was not given"
  44 + (( $# )) && shift || __sm.log.fail "Template name was not given"
45 45
46 46 while (( $# > 0 ))
47 47 do
@@ -49,15 +49,15 @@ templates()
49 49 case "${_token}" in
50 50 (to)
51 51 _target="$1"
52   - shift || __sm.log.fail "target path must follow keyword 'to'"
  52 + (( $# )) && shift || __sm.log.fail "target path must follow keyword 'to'"
53 53 ;;
54 54 (mode)
55 55 _mode="$1"
56   - shift || __sm.log.fail "mode must follow keyword 'mode'"
  56 + (( $# )) && shift || __sm.log.fail "mode must follow keyword 'mode'"
57 57 ;;
58 58 (owner)
59 59 _owner="$1"
60   - shift || __sm.log.fail "owner must follow keyword 'owner'"
  60 + (( $# )) && shift || __sm.log.fail "owner must follow keyword 'owner'"
61 61 ;;
62 62 (from)
63 63 __sm.log.fail "'from' keyword is no longer supported"
4 core/api/shell/traps/functions
@@ -15,11 +15,11 @@ traps()
15 15 case "${_token}" in
16 16 (on)
17 17 _signal="$1"
18   - shift || __sm.log.fail "A signal must follow keyword 'on'"
  18 + (( $# )) && shift || __sm.log.fail "A signal must follow keyword 'on'"
19 19 case "${_signal}" in
20 20 (exit|EXIT)
21 21 _code="$*"
22   - shift || __sm.log.fail "The code to be run on EXIT must be given after keyword 'EXIT'."
  22 + (( $# )) && shift || __sm.log.fail "The code to be run on EXIT must be given after keyword 'EXIT'."
23 23 __traps_code="$(trap)"
24 24 __traps_code="$( echo "${__traps_code}" | awk '/ EXIT$/' |
25 25 sed -e "s#' EXIT##" -e "s#.*'##")"
14 core/api/shell/user/functions
@@ -29,17 +29,17 @@ user()
29 29 case "${_command}" in
30 30 (set.home)
31 31 _value="$1"
32   - shift || __sm.log.fail "A home path must follow keyword 'home';"\
  32 + (( $# )) && shift || __sm.log.fail "A home path must follow keyword 'home';"\
33 33 "user set home /home/{username} for {username}"
34 34 ;;
35 35 (set.shell)
36 36 _value="$1"
37   - shift || __sm.log.fail "A shell must follow keyword 'shell'"\
  37 + (( $# )) && shift || __sm.log.fail "A shell must follow keyword 'shell'"\
38 38 "user set shell /bin/zsh for {username}"
39 39 ;;
40 40 (exists)
41 41 _user="$1"
42   - shift || __sm.log.fail "A user name must follow keyword 'exists'"\
  42 + (( $# )) && shift || __sm.log.fail "A user name must follow keyword 'exists'"\
43 43 "user exists {username}"
44 44 ;;
45 45 esac
@@ -53,19 +53,19 @@ user()
53 53 ;;
54 54 (name|user|for)
55 55 _user="$1"
56   - shift || __sm.log.fail "User name must follow keyword 'user'"
  56 + (( $# )) && shift || __sm.log.fail "User name must follow keyword 'user'"
57 57 ;;
58 58 (group)
59 59 _group="${1:-}"
60   - shift || __sm.log.fail "Group name must follow keyword 'group'"
  60 + (( $# )) && shift || __sm.log.fail "Group name must follow keyword 'group'"
61 61 ;;
62 62 (from)
63 63 _source="${1:-}"
64   - shift || __sm.log.fail "from source name must follow keyword 'from'"
  64 + (( $# )) && shift || __sm.log.fail "from source name must follow keyword 'from'"
65 65 ;;
66 66 (shell)
67 67 _shell="${1:-}"
68   - shift || __sm.log.fail "A user shell (/bin/{zsh,bash}) must follow keyword 'shell'"
  68 + (( $# )) && shift || __sm.log.fail "A user shell (/bin/{zsh,bash}) must follow keyword 'shell'"
69 69 ;;
70 70 (force)
71 71 _flags+=(-f)
4 core/cli/shell/dev/functions
@@ -85,7 +85,7 @@ extension_package()
85 85 {
86 86 local _name _path _version file _archiver
87 87 _name="${1:-}"
88   - shift || __sm.log.fail "Cannot package an extension; no extension name was given."
  88 + (( $# )) && shift || __sm.log.fail "Cannot package an extension; no extension name was given."
89 89
90 90 _path="${extensions_development_path:-"$extensions_src_path"}"
91 91
@@ -126,7 +126,7 @@ extension_publish()
126 126 {
127 127 local _name _path _version _file
128 128 _name="${1:-}"
129   - shift || __sm.log.fail "Cannot publish an extension; no extension name was given."
  129 + (( $# )) && shift || __sm.log.fail "Cannot publish an extension; no extension name was given."
130 130
131 131 NIY "Extension publishing locally and to extensions.beginrescueend.com has not yet been implemented."
132 132
2  core/cli/shell/ext/functions
@@ -68,7 +68,7 @@ ext_install()
68 68 local _name _names _uri
69 69 _names="$1"
70 70 _uri="$2"
71   - shift || __sm.log.fail "No extension name was given."
  71 + (( $# )) && shift || __sm.log.fail "No extension name was given."
72 72
73 73 _names=(${_names//,/ })
74 74
2  core/cli/shell/functions
@@ -47,7 +47,7 @@ actions()
47 47 {
48 48 local _action _token
49 49 _action="$1"
50   - shift || __sm.log.fail "Actions command not given."
  50 + (( $# )) && shift || __sm.log.fail "Actions command not given."
51 51
52 52 while (( $# ))
53 53 do
4 core/cli/shell/sets/functions
@@ -74,7 +74,7 @@ sets_install()
74 74 {
75 75 local _name _names _extension_namespace
76 76 _names="${1:-}"
77   - shift || __sm.log.fail "No set name was given."
  77 + (( $# )) && shift || __sm.log.fail "No set name was given."
78 78
79 79 _names=( ${=_names//,/ } )
80 80 _extension_namespace="${sets_user_path#${sm_path}\/}"
@@ -90,7 +90,7 @@ set_install()
90 90 {
91 91 local _name _uri _identifier _version
92 92 _name="${1:-}"
93   - shift || __sm.log.fail "No set name was given."
  93 + (( $# )) && shift || __sm.log.fail "No set name was given."
94 94
95 95 _uri="${1:-}"
96 96 (( $# )) && shift || _uri=$( awk -F= "/^${_name}=/ {print \$2 }" < "${sm_path}/core/cli/config/known_sets" | tail -n 1 )
2  core/install/shell/functions
@@ -43,7 +43,7 @@ cleanse_targets()
43 43 {
44 44 local _path _entity
45 45 _path="$1"
46   - shift || __sm.log.fail "Usage:\n\n cleanse_targets {target} {paths/files under target}"
  46 + (( $# )) && shift || __sm.log.fail "Usage:\n\n cleanse_targets {target} {paths/files under target}"
47 47 for _entity in "$@"
48 48 do
49 49 rm -rf "${_path}/${_entity}"
12 core/internal/shell/array/functions
@@ -72,7 +72,7 @@ __sm.array.pop()
72 72 local _name _variable index
73 73 _name="${1}"
74 74 _variable="${2:-}"
75   - shift || __sm.log.fail "Array name was not given."
  75 + (( $# )) && shift || __sm.log.fail "Array name was not given."
76 76
77 77 eval "(( \${#${_name}[@]} ))" || __sm.log.fail "Array '${_name}' was empty."
78 78
@@ -89,7 +89,7 @@ __sm.array.shift()
89 89 local _name index _variable
90 90 _name="${1:-}"
91 91 _variable="${2:-}"
92   - shift || __sm.log.fail "Array name was not given."
  92 + (( $# )) && shift || __sm.log.fail "Array name was not given."
93 93
94 94 [[ -z "${_variable}" ]] || eval "${_variable}=\${${_name}[${__sm_array_start}]}"
95 95
@@ -100,7 +100,7 @@ __sm.array.unshift()
100 100 {
101 101 local _name
102 102 _name="${1:-}"
103   - shift || __sm.log.fail "Array name was given."
  103 + (( $# )) && shift || __sm.log.fail "Array name was given."
104 104
105 105 local _elements=("$@")
106 106
@@ -113,7 +113,7 @@ __sm.array.join()
113 113 {
114 114 local _name IFS
115 115 _name="${1:-}"
116   - shift || __sm.log.fail "Array name was not given."
  116 + (( $# )) && shift || __sm.log.fail "Array name was not given."
117 117 IFS=${1:-' '}
118 118 eval "printf \"\${${_name}[*]}\""
119 119 }
@@ -123,7 +123,7 @@ __sm.array.largest()
123 123 local _name _index _largest
124 124 _name="${1:-}"
125 125 _largest=""
126   - shift || __sm.log.fail "No array variable name was given."
  126 + (( $# )) && shift || __sm.log.fail "No array variable name was given."
127 127
128 128 eval "
129 129 for (( _index=1 ; _index <= \${#${_name}[@]} ; _index++ ))
@@ -156,7 +156,7 @@ __sm.array.unique()
156 156 {
157 157 local _name
158 158 _name="${1:-}"
159   - shift || __sm.log.fail "Array variable name was not given."
  159 + (( $# )) && shift || __sm.log.fail "Array variable name was not given."
160 160
161 161 eval "${_name}=( \${(u)${_name}[@]} )"
162 162 }
2  core/internal/shell/config/extensions
@@ -8,7 +8,7 @@ config_extension_setup()
8 8 path="${3:-}"
9 9 true ${language:=shell}
10 10
11   - shift 3 || __sm.log.fail "Extension name, module name and path must be given."
  11 + (( $# >=3 )) && shift 3 || __sm.log.fail "Extension name, module name and path must be given."
12 12
13 13 path create "${extension_path}/config"
14 14 file create "${extension_path}/defaults"
6 core/internal/shell/database/extensions
@@ -4,11 +4,11 @@ database_extension_setup()
4 4 {
5 5 local extension module path
6 6 extension="${1}"
7   - shift || __sm.log.fail "Extension must be given as the first parameter."
  7 + (( $# )) && shift || __sm.log.fail "Extension must be given as the first parameter."
8 8 module="${1}"
9   - shift || __sm.log.fail "Module must be given as the second parameter."
  9 + (( $# )) && shift || __sm.log.fail "Module must be given as the second parameter."
10 10 path="${1}"
11   - shift || __sm.log.fail "Path must be given as the third parameter."
  11 + (( $# )) && shift || __sm.log.fail "Path must be given as the third parameter."
12 12
13 13 paths enter "${path}"
14 14
4 core/internal/shell/extensions/cache/functions
@@ -96,9 +96,9 @@ __sm.cache.map.find.matching()
96 96 {
97 97 local _method _name _item
98 98 _method="$1"
99   - shift || __sm.log.fail "No method and action name was given for search"
  99 + (( $# )) && shift || __sm.log.fail "No method and action name was given for search"
100 100 _name="$1"
101   - shift || __sm.log.fail "No action name was given for search"
  101 + (( $# )) && shift || __sm.log.fail "No action name was given for search"
102 102 for _item in "${_actions_cache[@]}"
103 103 do
104 104 case "${_method}" in
8 core/internal/shell/extensions/common/functions
@@ -4,7 +4,7 @@ __sm.extension.path()
4 4 {
5 5 local _path extension
6 6 extension=$1
7   - shift || __sm.log.fail "Cannot process extension path;"\
  7 + (( $# )) && shift || __sm.log.fail "Cannot process extension path;"\
8 8 " No extension name was given."
9 9
10 10 for _path in ${extensions_search_paths[@]}
@@ -22,7 +22,7 @@ __sm.extension.is.valid()
22 22 {
23 23 local _path
24 24 _path="${1:-}"
25   - shift || __sm.log.fail "No extension path was given to check validity."
  25 + (( $# )) && shift || __sm.log.fail "No extension path was given to check validity."
26 26 [[ -n "${_path}" ]] || __sm.log.fail "Path to the extension was not given."
27 27 [[ -d "${_path}/bin" || -d "${_path}/shell" ]]
28 28 }
@@ -30,9 +30,9 @@ __sm.extension.is.valid()
30 30 __sm.extension.find()
31 31 {
32 32 extensions_path="${1:-}" extension="${2:-}"
33   - shift || __sm.log.fail "Cannot detect extension existence;"\
  33 + (( $# )) && shift || __sm.log.fail "Cannot detect extension existence;"\
34 34 " No extension path was given."
35   - shift || __sm.log.fail "Cannot detect extension existence;"\
  35 + (( $# )) && shift || __sm.log.fail "Cannot detect extension existence;"\
36 36 " No extension name was given."
37 37 __sm.extension.is.valid $extensions_path/$extension
38 38 }
6 core/internal/shell/extensions/completion/functions
@@ -4,9 +4,9 @@ find_starting_action()
4 4 {
5 5 trace_filter action_completion || set -o xtrace
6 6 extensions_path="$1" extension="$2"
7   - shift || __sm.log.fail "Cannot detect extension existence;"\
  7 + (( $# )) && shift || __sm.log.fail "Cannot detect extension existence;"\
8 8 " No extension path was given."
9   - shift || __sm.log.fail "Cannot detect extension existence;"\
  9 + (( $# )) && shift || __sm.log.fail "Cannot detect extension existence;"\
10 10 " No extension name was given."
11 11
12 12 local _action_params _action_path _new_action_path _rest_params \
@@ -44,7 +44,7 @@ find_starting_action()
44 44 show_extension_names()
45 45 {
46 46 extensions_path="$1"
47   - shift || __sm.log.fail "no path given"
  47 + (( $# )) && shift || __sm.log.fail "no path given"
48 48
49 49 #$1 is ignored == "unused"
50 50 local _patern extension
8 core/internal/shell/extensions/detection/functions
@@ -8,8 +8,8 @@ __sm.cache.map.check()
8 8 _found_actions=()
9 9 _method="$1"
10 10 _name="$2"
11   - shift || __sm.log.fail "No method and action name was given for search"
12   - shift || __sm.log.fail "No action name was given for search"
  11 + (( $# )) && shift || __sm.log.fail "No method and action name was given for search"
  12 + (( $# )) && shift || __sm.log.fail "No action name was given for search"
13 13
14 14 __sm.cache.map.find.matching "${_method}" "${_name}"
15 15
@@ -62,8 +62,8 @@ __sm.extension.actions.find()
62 62 extensions_path="$1"
63 63 extension="$2"
64 64
65   - shift || __sm.log.fail "Extension path must be given as the first parameter."
66   - shift || __sm.log.fail "Extension name must be given as the second parameter."
  65 + (( $# )) && shift || __sm.log.fail "Extension path must be given as the first parameter."
  66 + (( $# )) && shift || __sm.log.fail "Extension name must be given as the second parameter."
67 67
68 68 local _action_params _action_path _new_action_path _rest_params _param_temp \
69 69 _action_params_length _actions_root _map _modules_root _actions_cache
14 core/internal/shell/extensions/manipulation/functions
@@ -4,7 +4,7 @@ extension_version()
4 4 {
5 5 local _extension
6 6 _extension=$1
7   - shift || __sm.log.fail "Cannot retrieve extension version;"\
  7 + (( $# )) && shift || __sm.log.fail "Cannot retrieve extension version;"\
8 8 " No extension was given."
9 9 true ${extension_path:="${extensions_path}/${_extension}"}
10 10
@@ -69,7 +69,7 @@ __sm.extension.actions()
69 69 local _extension _files _file _actions
70 70 _extension="${1:-}"
71 71 _actions=()
72   - shift || __sm.log.fail "No extension was given."
  72 + (( $# )) && shift || __sm.log.fail "No extension was given."
73 73 [[ -d "${extension_bin_path}" ]] || return 0
74 74 #TODO: build actions cache and use it to display actions
75 75 echo "${_actions[@]}"
@@ -83,10 +83,10 @@ __sm.extension.install()
83 83 {
84 84 local _name _uri _version _identifier
85 85 _name="${1:-}"
86   - shift || __sm.log.fail "No extension name was given."
  86 + (( $# )) && shift || __sm.log.fail "No extension name was given."
87 87
88 88 _uri="${1:-}"
89   - shift || true
  89 + (( $# )) && shift || true
90 90 [[ -n "${_uri}" ]] || _uri=$( __sm.extension.get.uri "${_name}" )
91 91
92 92 [[ -n "${_uri}" ]] ||
@@ -137,15 +137,15 @@ __sm.extension.installed()
137 137 ;;
138 138 (module|type)
139 139 _type="$1"
140   - shift || __sm.log.fail "An module type must follow the '${_token}' keyword"
  140 + (( $# )) && shift || __sm.log.fail "An module type must follow the '${_token}' keyword"
141 141 ;;
142 142 (in)
143 143 _paths="${1}"
144   - shift || __sm.log.fail "A path must follow keyword 'in'"
  144 + (( $# )) && shift || __sm.log.fail "A path must follow keyword 'in'"
145 145 ;;
146 146 (exclude)
147 147 _exclude="${1}"
148   - shift || __sm.log.fail "A string must follow keyword 'exclude'"
  148 + (( $# )) && shift || __sm.log.fail "A string must follow keyword 'exclude'"
149 149 _excludes+=("${_exclude//,/ }")
150 150 ;;
151 151 (*)
6 core/internal/shell/files/functions
@@ -4,7 +4,7 @@ __sm.files.source()
4 4 {
5 5 local _file _files
6 6 _files=("$@")
7   - shift || __sm.log.fail "Cannot source files; No files were given."
  7 + (( $# )) && shift || __sm.log.fail "Cannot source files; No files were given."
8 8
9 9 for _file in "${_files[@]}"
10 10 do
@@ -54,7 +54,7 @@ __sm.files.remove()
54 54 # TODO: add 'from' parameter
55 55 local _file _files
56 56 _files=("$@")
57   - shift || __sm.log.fail "Cannot remove files, as no files were given to remove."
  57 + (( $# )) && shift || __sm.log.fail "Cannot remove files, as no files were given to remove."
58 58
59 59 for _file in "${_files[@]}"
60 60 do
@@ -82,7 +82,7 @@ __sm.files.create()
82 82 trace_filter filesystem || set -o xtrace
83 83 local _file _path _files
84 84 _files=("$@")
85   - shift || __sm.log.fail "Cannot ensure files exist; No files were given."
  85 + (( $# )) && shift || __sm.log.fail "Cannot ensure files exist; No files were given."
86 86
87 87 for _file in "${_files[@]}"
88 88 do
2  core/internal/shell/os/functions
@@ -4,7 +4,7 @@ __sm.os.open()
4 4 {
5 5 local _uri
6 6 _uri="${1:-}"
7   - shift || __sm.log.fail "Cannot open URI; No uri was given."
  7 + (( $# )) && shift || __sm.log.fail "Cannot open URI; No uri was given."
8 8
9 9 if __sm.command.exists open
10 10 then
6 core/internal/shell/package/extensions
@@ -7,9 +7,9 @@ package_extension_setup()
7 7 module="${2:-}"
8 8 path="${3:-}"
9 9 true ${language:=shell}
10   - shift || __sm.log.fail "Cannot setup package extension; no extension name given."
11   - shift || __sm.log.fail "Cannot setup package extension; no module name given."
12   - shift || __sm.log.fail "Cannot setup package extension; no path given."
  10 + (( $# )) && shift || __sm.log.fail "Cannot setup package extension; no extension name given."
  11 + (( $# )) && shift || __sm.log.fail "Cannot setup package extension; no module name given."
  12 + (( $# )) && shift || __sm.log.fail "Cannot setup package extension; no path given."
13 13
14 14 for action in install uninstall update activate deactivate
15 15 do
8 core/internal/shell/package/functions
@@ -729,8 +729,8 @@ __sm.package.activate.first()
729 729 local _package _version
730 730 _package="${1:-}"
731 731 _version="${2:-}"
732   - shift || __sm.log.fail "Package name must be given as first parameter."
733   - shift || __sm.log.fail "Package version must be given as second parameter."
  732 + (( $# )) && shift || __sm.log.fail "Package name must be given as first parameter."
  733 + (( $# )) && shift || __sm.log.fail "Package version must be given as second parameter."
734 734
735 735 if paths exist "${install_path}"
736 736 then
@@ -845,7 +845,7 @@ __sm.package.patches.apply()
845 845 {
846 846 local _patch _patches
847 847 _patches=("$@")
848   - shift || __sm.log.fail "No patches were given."
  848 + (( $# )) && shift || __sm.log.fail "No patches were given."
849 849
850 850 for _patch in "${_patches[@]}"
851 851 do
@@ -859,7 +859,7 @@ __sm.package.is.active()
859 859 local _name _version _path
860 860 _name="${1:-}"
861 861 _version="${2:-}"
862   - shift || __sm.log.fail "No package name was given, or name is empty."
  862 + (( $# )) && shift || __sm.log.fail "No package name was given, or name is empty."
863 863
864 864 _path="${packages_path}/versions/${_name}"
865 865
2  core/internal/shell/paths/functions
@@ -174,7 +174,7 @@ __sm.paths.in()
174 174 {
175 175 local _path
176 176 _path="${1:-}"
177   - shift || __sm.log.fail "Path was not given!"
  177 + (( $# )) && shift || __sm.log.fail "Path was not given!"
178 178 [[ -d "${_path}" ]] || __sm.log.fail "'${_path}' is not a path!"
179 179
180 180 for dir in "${_path}"/*
2  core/internal/shell/processes/functions
@@ -4,7 +4,7 @@ __sm.process.lockfile.lock()
4 4 {
5 5 local _lockfile
6 6 _lockfile="${1:-}"
7   - shift ||
  7 + (( $# )) && shift ||
8 8 __sm.log.fail "No lockfile was specified as the first parameter."
9 9
10 10 printf "$$" >> "${_lockfile}" # *Append* current process's pid to the lockfile
6 core/internal/shell/service/extensions
@@ -7,9 +7,9 @@ service_extension_setup()
7 7 module="${2}"
8 8 path="${3}"
9 9 true ${language:=shell}
10   - shift || __sm.log.fail "Extension name not given as first parameter."
11   - shift || __sm.log.fail "Module name not given as second parameter."
12   - shift || __sm.log.fail "Path not given as third parameter."
  10 + (( $# )) && shift || __sm.log.fail "Extension name not given as first parameter."
  11 + (( $# )) && shift || __sm.log.fail "Module name not given as second parameter."
  12 + (( $# )) && shift || __sm.log.fail "Path not given as third parameter."
13 13
14 14 for action in start stop restart status list
15 15 do
6 core/internal/shell/service/functions
@@ -398,7 +398,7 @@ __sm.service.initd.install()
398 398 {
399 399 local _service _version
400 400 _service="${1:-}"
401   - shift ||fail "Service name was not passed in as the first parameter"
  401 + (( $# )) && shift ||fail "Service name was not passed in as the first parameter"
402 402 _version="${2:-${package_version}}"
403 403 #TODO: WTF ^ why is this $2 after a shift ?
404 404
@@ -682,7 +682,7 @@ __sm.service.activate()
682 682 {
683 683 local _service _version
684 684 _service="${1:-"${service}"}"
685   - shift || __sm.log.fail "The service name must be set or given to activate a service."
  685 + (( $# )) && shift || __sm.log.fail "The service name must be set or given to activate a service."
686 686
687 687 _version="${2:-${package_version}}"
688 688 #TODO: WTF ^ why use $2 after shift ?
@@ -869,7 +869,7 @@ __sm.service.signal()
869 869 local _signal _pid
870 870 _signal="${1}"
871 871 _pid="${2:-0}"
872   - shift || __sm.log.fail "Cannot signal service;"\
  872 + (( $# )) && shift || __sm.log.fail "Cannot signal service;"\
873 873 " Signal must be given as the first parameter and be one of:"\
874 874 " {KILL,QUIT,TERM,USR1,USR2,TTIN,TTOU,a digit})."
875 875
2  core/internal/shell/services/functions
@@ -11,7 +11,7 @@ services_list()
11 11 {
12 12 local _action _args
13 13 _action="${1:-}"
14   - shift || true
  14 + (( $# )) && shift || true
15 15
16 16 case "${_action}" in
17 17 (active)
2  core/internal/shell/steps/functions
@@ -15,7 +15,7 @@ step()
15 15 local name
16 16 name="$1"
17