@renault-digital/bash-base 2.3.2 → 2.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/bash-base CHANGED
@@ -1649,15 +1649,15 @@ function confirm_to_continue() {
1649
1649
  # wait_for predicate [subject] [interval]
1650
1650
  # @DESCRIPTION
1651
1651
  # **predicate** a string of command, used to check is ok or not
1652
- # **[subject]** optional, the subject name
1652
+ # **[subject]** optional, the subject name, default to predicate
1653
1653
  # **[interval]** optional, the interval of number of seconds between the checks, default to 3
1654
1654
  # @EXAMPLES
1655
1655
  # wait_for 'test -f /tmp/output.txt' 'file existed' 3
1656
1656
  # @SEE_ALSO
1657
- # confirm_to_continue, stop_if_failed
1657
+ # confirm_to_continue, stop_if_failed, is_http_ok
1658
1658
  function wait_for() {
1659
1659
  local predicate="${1}"
1660
- local subject="${2-it}"
1660
+ local subject="${2-${predicate}}"
1661
1661
  local interval=${3-3}
1662
1662
 
1663
1663
  while ! eval "${predicate}"; do
@@ -1532,7 +1532,7 @@ wait_for predicate [subject] [interval]
1532
1532
 
1533
1533
  ##### DESCRIPTION
1534
1534
  - **predicate** a string of command, used to check is ok or not
1535
- - **[subject]** optional, the subject name
1535
+ - **[subject]** optional, the subject name, default to predicate
1536
1536
  - **[interval]** optional, the interval of number of seconds between the checks, default to 3
1537
1537
 
1538
1538
  ##### EXAMPLES
@@ -1541,7 +1541,7 @@ wait_for 'test -f /tmp/output.txt' 'file existed' 3
1541
1541
  ```
1542
1542
 
1543
1543
  ##### SEE_ALSO
1544
- confirm_to_continue, stop_if_failed
1544
+ confirm_to_continue, stop_if_failed, is_http_ok
1545
1545
 
1546
1546
  ---
1547
1547
 
package/man/bash-base.1 CHANGED
@@ -1901,7 +1901,7 @@ wait_for predicate [subject] [interval]
1901
1901
  .IP \[bu] 2
1902
1902
  \f[B]predicate\f[R] a string of command, used to check is ok or not
1903
1903
  .IP \[bu] 2
1904
- \f[B][subject]\f[R] optional, the subject name
1904
+ \f[B][subject]\f[R] optional, the subject name, default to predicate
1905
1905
  .IP \[bu] 2
1906
1906
  \f[B][interval]\f[R] optional, the interval of number of seconds between
1907
1907
  the checks, default to 3
@@ -1914,7 +1914,7 @@ wait_for \[aq]test -f /tmp/output.txt\[aq] \[aq]file existed\[aq] 3
1914
1914
  .fi
1915
1915
  .SS SEE_ALSO
1916
1916
  .PP
1917
- confirm_to_continue, stop_if_failed
1917
+ confirm_to_continue, stop_if_failed, is_http_ok
1918
1918
  .PP
1919
1919
  * * * * *
1920
1920
  .SS NAME
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@renault-digital/bash-base",
3
- "version": "2.3.2",
3
+ "version": "2.4.0",
4
4
  "description": "A common lib for creating bash script easily.",
5
5
  "private": false,
6
6
  "publishConfig": {
@@ -36,7 +36,8 @@
36
36
  "test": "./scripts/test.sh",
37
37
  "test:focus": "npm test -- -f t --focus #execute only fIt/fDescribe",
38
38
  "test:coverage": "npm test -- --kcov -f t",
39
- "build": "./scripts/build.sh"
39
+ "build": "./scripts/build.sh",
40
+ "prepare": "husky"
40
41
  },
41
42
  "repository": {
42
43
  "type": "git",
@@ -56,20 +57,16 @@
56
57
  },
57
58
  "homepage": "https://github.com/renault-digital/bash-base#readme",
58
59
  "devDependencies": {
59
- "@commitlint/cli": "^9.1.2",
60
- "@commitlint/config-conventional": "^9.1.2",
61
- "@semantic-release/changelog": "^5.0.1",
62
- "@semantic-release/exec": "^5.0.0",
63
- "@semantic-release/git": "^9.0.0",
64
- "commitizen": "^4.1.2",
65
- "cz-conventional-changelog": "^3.2.0",
66
- "husky": "^4.2.5",
67
- "semantic-release-docker": "^2.2.0",
68
- "merge": ">=2.1.1"
60
+ "@commitlint/cli": "^19.8.1",
61
+ "@commitlint/config-conventional": "^20.0.0",
62
+ "@semantic-release/changelog": "^6.0.3",
63
+ "@semantic-release/exec": "^7.1.0",
64
+ "@semantic-release/git": "^10.0.1",
65
+ "commitizen": "^4.3.1",
66
+ "cz-conventional-changelog": "^3.3.0",
67
+ "husky": "^9.1.7",
68
+ "merge": ">=2.1.1",
69
+ "semantic-release": "^25.0.1"
69
70
  },
70
- "dependencies": {},
71
- "resolutions": {
72
- "lodash": "4.17.19",
73
- "dot-prop": "5.2.0"
74
- }
71
+ "resolutions": {}
75
72
  }
package/spec/tool.spec.sh CHANGED
@@ -26,6 +26,12 @@ Describe 'wait_for'
26
26
  The output should include "OK: slowTask is ok now"
27
27
  End
28
28
 
29
+ It 'ok with default value'
30
+ When call wait_for 'test 1 -eq 1'
31
+ The status should be success
32
+ The output should include "OK: test 1 -eq 1 is ok now"
33
+ End
34
+
29
35
  It 'not ok'
30
36
  rm -fr a.txt
31
37
  func() { actual=$( wait_for 'test -f a.txt' slowTask 2 & touch a.txt); }
package/src/tool.sh CHANGED
@@ -59,15 +59,15 @@ function confirm_to_continue() {
59
59
  # wait_for predicate [subject] [interval]
60
60
  # @DESCRIPTION
61
61
  # **predicate** a string of command, used to check is ok or not
62
- # **[subject]** optional, the subject name
62
+ # **[subject]** optional, the subject name, default to predicate
63
63
  # **[interval]** optional, the interval of number of seconds between the checks, default to 3
64
64
  # @EXAMPLES
65
65
  # wait_for 'test -f /tmp/output.txt' 'file existed' 3
66
66
  # @SEE_ALSO
67
- # confirm_to_continue, stop_if_failed
67
+ # confirm_to_continue, stop_if_failed, is_http_ok
68
68
  function wait_for() {
69
69
  local predicate="${1}"
70
- local subject="${2-it}"
70
+ local subject="${2-${predicate}}"
71
71
  local interval=${3-3}
72
72
 
73
73
  while ! eval "${predicate}"; do
package/CHANGELOG.md DELETED
@@ -1,158 +0,0 @@
1
- ## [2.3.2](https://github.com/renault-digital/bash-base/compare/v2.3.1...v2.3.2) (2021-12-23)
2
-
3
-
4
- ### Bug Fixes
5
-
6
- * shellcheck lint ([d708b3b](https://github.com/renault-digital/bash-base/commit/d708b3b42be1fad5bc5296a74efac742007151d9))
7
-
8
- ## [2.3.1](https://github.com/renault-digital/bash-base/compare/v2.3.0...v2.3.1) (2021-06-14)
9
-
10
-
11
- ### Bug Fixes
12
-
13
- * get the inputted value for optional params ([62ba109](https://github.com/renault-digital/bash-base/commit/62ba1097aef765e1616f4489c97207c85007f172))
14
-
15
- # [2.3.0](https://github.com/renault-digital/bash-base/compare/v2.2.0...v2.3.0) (2021-06-14)
16
-
17
-
18
- ### Features
19
-
20
- * parse args_valid_or_default for the optional params ([c723203](https://github.com/renault-digital/bash-base/commit/c7232032ba96d918b48a76e94bf1477e4c810b35))
21
-
22
- # [2.2.0](https://github.com/renault-digital/bash-base/compare/v2.1.0...v2.2.0) (2021-06-13)
23
-
24
-
25
- ### Features
26
-
27
- * add args_valid_or_default for the optional params ([db5b8c2](https://github.com/renault-digital/bash-base/commit/db5b8c2099b501ce1eac04580c524d9cb1dc9bb2))
28
-
29
- # [2.1.0](https://github.com/renault-digital/bash-base/compare/v2.0.2...v2.1.0) (2021-06-13)
30
-
31
-
32
- ### Features
33
-
34
- * use default value INFO only if absent for LOG_LEVEL ([9eb6ae1](https://github.com/renault-digital/bash-base/commit/9eb6ae1a35c3bf37d109e9bf581da4d28d34c7d3))
35
-
36
- ## [2.0.2](https://github.com/renault-digital/bash-base/compare/v2.0.1...v2.0.2) (2021-06-13)
37
-
38
- ## [2.0.1](https://github.com/renault-digital/bash-base/compare/v2.0.0...v2.0.1) (2021-05-17)
39
-
40
- # [2.0.0](https://github.com/renault-digital/bash-base/compare/v1.7.0...v2.0.0) (2021-05-17)
41
-
42
-
43
- ### Documentation
44
-
45
- * add basher install ([f4772f3](https://github.com/renault-digital/bash-base/commit/f4772f3f476d93207550c4f6ff5cacbeffa202c8))
46
-
47
-
48
- ### BREAKING CHANGES
49
-
50
- * rename bin/bash-base.sh to bin/bash-base for basher
51
-
52
- # [1.7.0](https://github.com/renault-digital/bash-base/compare/v1.6.0...v1.7.0) (2021-05-15)
53
-
54
-
55
- ### Features
56
-
57
- * add param to specific the kill signal ([28c4fd4](https://github.com/renault-digital/bash-base/commit/28c4fd4d7516891682f323a97488ab3e63b5c712))
58
-
59
- # [1.6.0](https://github.com/renault-digital/bash-base/compare/v1.5.1...v1.6.0) (2021-05-09)
60
-
61
-
62
- ### Bug Fixes
63
-
64
- * fix the generated help usage for args_valid_or_read ([e32f621](https://github.com/renault-digital/bash-base/commit/e32f6216680b40dea46816943454a5b7b2dbb43f))
65
-
66
-
67
- ### Features
68
-
69
- * add wait_for and process functions ([f86f6a2](https://github.com/renault-digital/bash-base/commit/f86f6a24ac6ceef74f694d6932ba0adbb4a95d90)), closes [#42](https://github.com/renault-digital/bash-base/issues/42)
70
-
71
- ## [1.5.1](https://github.com/renault-digital/bash-base/compare/v1.5.0...v1.5.1) (2021-05-08)
72
-
73
- # [1.5.0](https://github.com/renault-digital/bash-base/compare/v1.4.7...v1.5.0) (2021-05-07)
74
-
75
-
76
- ### Features
77
-
78
- * add args_valid_or_select_args ([ce5cc4a](https://github.com/renault-digital/bash-base/commit/ce5cc4aca59dbe4d5edc53d18f29ceef88566bb6)), closes [#38](https://github.com/renault-digital/bash-base/issues/38)
79
- * add array_in ([8a98de2](https://github.com/renault-digital/bash-base/commit/8a98de2d770ed67c413826ec00110c6031f06e74))
80
-
81
- ## [1.4.7](https://github.com/renault-digital/bash-base/compare/v1.4.6...v1.4.7) (2021-05-07)
82
-
83
- ## [1.4.6](https://github.com/renault-digital/bash-base/compare/v1.4.5...v1.4.6) (2021-01-31)
84
-
85
- ## [1.4.5](https://github.com/renault-digital/bash-base/compare/v1.4.4...v1.4.5) (2020-10-06)
86
-
87
-
88
- ### Bug Fixes
89
-
90
- * can not extract argument valid rule if multiple rules existed ([a5fd06e](https://github.com/renault-digital/bash-base/commit/a5fd06e0058022ca592476bf01f8ecff6c9b7e02)), closes [#34](https://github.com/renault-digital/bash-base/issues/34)
91
-
92
- ## [1.4.4](https://github.com/renault-digital/bash-base/compare/v1.4.3...v1.4.4) (2020-10-04)
93
-
94
-
95
- ### Bug Fixes
96
-
97
- * print help usage if parameter not valid ([c98a654](https://github.com/renault-digital/bash-base/commit/c98a654d4fd6eef1a082cd8d3ed5580fe7d5ccad))
98
-
99
- ## [1.4.3](https://github.com/renault-digital/bash-base/compare/v1.4.2...v1.4.3) (2020-09-16)
100
-
101
-
102
- ### Bug Fixes
103
-
104
- * ignore the error of `shopt command not found` ([e790eb4](https://github.com/renault-digital/bash-base/commit/e790eb417b6de11b5358badd4178dce6a987dc18)), closes [#30](https://github.com/renault-digital/bash-base/issues/30)
105
-
106
- ## [1.4.2](https://github.com/renault-digital/bash-base/compare/v1.4.1...v1.4.2) (2020-09-15)
107
-
108
- ## [1.4.1](https://github.com/renault-digital/bash-base/compare/v1.4.0...v1.4.1) (2020-09-15)
109
-
110
- # [1.4.0](https://github.com/renault-digital/bash-base/compare/v1.3.0...v1.4.0) (2020-09-15)
111
-
112
- # [1.3.0](https://github.com/renault-digital/bash-base/compare/v1.2.3...v1.3.0) (2020-09-15)
113
-
114
-
115
- ### Features
116
-
117
- * add function print_info and alias print_args-> args_print ([656cfdd](https://github.com/renault-digital/bash-base/commit/656cfdd3c5b7692539ae1e4303f9775cb9f1b066)), closes [#25](https://github.com/renault-digital/bash-base/issues/25)
118
-
119
- ## [1.2.3](https://github.com/renault-digital/bash-base/compare/v1.2.2...v1.2.3) (2020-09-13)
120
-
121
- ## [1.2.2](https://github.com/renault-digital/bash-base/compare/v1.2.1...v1.2.2) (2020-09-13)
122
-
123
- ## [1.2.1](https://github.com/renault-digital/bash-base/compare/v1.2.0...v1.2.1) (2020-09-11)
124
-
125
- # [1.2.0](https://github.com/renault-digital/bash-base/compare/v1.1.1...v1.2.0) (2020-09-10)
126
-
127
-
128
- ### Features
129
-
130
- * add function print_warn and print_success ([b827d06](https://github.com/renault-digital/bash-base/commit/b827d061907005c5cbac1b66696976dd484a219e)), closes [#20](https://github.com/renault-digital/bash-base/issues/20)
131
-
132
- ## [1.1.1](https://github.com/renault-digital/bash-base/compare/v1.1.0...v1.1.1) (2020-09-10)
133
-
134
-
135
- ### Bug Fixes
136
-
137
- * correct the markdown generator ([31af0a7](https://github.com/renault-digital/bash-base/commit/31af0a777815406216757eae6e05f7865b26db81)), closes [#18](https://github.com/renault-digital/bash-base/issues/18)
138
-
139
- # [1.1.0](https://github.com/renault-digital/bash-base/compare/v1.0.4...v1.1.0) (2020-09-09)
140
-
141
- ### [1.0.4](https://github.com/renault-digital/bash-base/compare/v1.0.3...v1.0.4) (2020-09-09)
142
-
143
- ## [1.0.3](https://github.com/renault-digital/bash-base/compare/v1.0.2...v1.0.3) (2020-09-08)
144
-
145
- ## [1.0.2](https://github.com/renault-digital/bash-base/compare/v1.0.1...v1.0.2) (2020-09-06)
146
-
147
-
148
- ### Bug Fixes
149
-
150
- * the script install.sh ([a85deb8](https://github.com/renault-digital/bash-base/commit/a85deb80a107a61966597a42658703da304d3122)), closes [#4](https://github.com/renault-digital/bash-base/issues/4)
151
-
152
- # 1.0.0 (2020-09-05)
153
-
154
-
155
- ### Features
156
-
157
- * a scratch of bash-base and cicd config ([84c3bf8](https://github.com/renault-digital/bash-base/commit/84c3bf84e3ec73842efd06061349c62008e27fa5))
158
- * initial commit ([41a9e51](https://github.com/renault-digital/bash-base/commit/41a9e51c15d9a328f9ae301070f5003326c0cd3b))