@renault-digital/bash-base 2.4.0 → 2.5.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.
@@ -2,74 +2,128 @@
2
2
 
3
3
  ### Functions:
4
4
 
5
- - args_parse
6
- - args_valid_or_select
7
- - args_valid_or_select_pipe
8
- - args_valid_or_select_args
9
- - args_valid_or_read
10
- - args_valid_or_default
11
- - array_join
12
- - array_describe
13
- - array_from_describe
14
- - array_contains
15
- - array_in
16
- - array_sort
17
- - array_sort_distinct
18
- - array_length
19
- - array_reset_index
20
- - array_equals
21
- - array_intersection
22
- - array_subtract
23
- - array_union
24
- - array_append
25
- - array_remove
26
- - array_clone
27
- - array_map
28
- - array_filter
29
- - doc_lint_script_comment
30
- - doc_comment_to_markdown
31
- - print_debug
32
- - print_info
33
- - print_warn
34
- - print_error
35
- - print_success
36
- - print_args
37
- - print_header
38
- - prc_filter_by_port
39
- - prc_kill_by_port
40
- - prc_filter_by_cmd
41
- - prc_kill_by_cmd
42
- - reflect_nth_arg
43
- - reflect_get_function_definition
44
- - reflect_function_names_of_file
45
- - reflect_function_definitions_of_file
46
- - reflect_search_function
47
- - reflect_search_variable
48
- - string_trim
49
- - string_repeat
50
- - string_length
51
- - string_is_empty
52
- - string_revert
53
- - string_upper
54
- - string_lower
55
- - string_upper_first
56
- - string_sub
57
- - string_match
58
- - escape_sed
59
- - string_replace
60
- - string_replace_regex
61
- - string_index_first
62
- - string_before_first
63
- - string_after_first
64
- - string_split_to_array
65
- - string_pick_to_array
66
- - stop_if_failed
67
- - confirm_to_continue
68
- - wait_for
69
- - declare_heredoc
5
+ -args_confirm
6
+ -args_print
7
+ -args_parse
8
+ -args_valid_or_select
9
+ -args_valid_or_select_pipe
10
+ -args_valid_or_select_args
11
+ -args_valid_or_read
12
+ -args_valid_or_default
13
+ -array_join
14
+ -array_describe
15
+ -array_from_describe
16
+ -array_contains
17
+ -array_in
18
+ -array_sort
19
+ -array_sort_distinct
20
+ -array_length
21
+ -array_reset_index
22
+ -array_equals
23
+ -array_intersection
24
+ -array_subtract
25
+ -array_union
26
+ -array_append
27
+ -array_remove
28
+ -array_clone
29
+ -array_map
30
+ -array_filter
31
+ -doc_lint_script_comment
32
+ -doc_comment_to_markdown
33
+ -print_debug
34
+ -print_info
35
+ -print_warn
36
+ -print_error
37
+ -print_success
38
+ -print_args
39
+ -print_header
40
+ -prc_filter_by_port
41
+ -prc_kill_by_port
42
+ -prc_filter_by_cmd
43
+ -prc_kill_by_cmd
44
+ -reflect_nth_arg
45
+ -reflect_get__definition
46
+ -reflect__names_of_file
47
+ -reflect__definitions_of_file
48
+ -reflect_search_
49
+ -reflect_search_variable
50
+ -string_trim
51
+ -string_repeat
52
+ -string_length
53
+ -string_is_empty
54
+ -string_revert
55
+ -string_upper
56
+ -string_lower
57
+ -string_upper_first
58
+ -string_sub
59
+ -string_match
60
+ -escape_sed
61
+ -string_replace
62
+ -string_replace_regex
63
+ -string_index_first
64
+ -string_before_first
65
+ -string_after_first
66
+ -string_split_to_array
67
+ -string_pick_to_array
68
+ -stop_if_failed
69
+ -confirm_to_continue
70
+ -wait_for
71
+ -declare_heredoc
70
72
 
71
73
  ### Usage:
72
74
 
75
+ ##### NAME
76
+ aliases need different non-interactive expansion rules in Bash and zsh, while
77
+ functions work identically when this library is sourced by either shell.
78
+
79
+ ---
80
+
81
+ ##### NAME
82
+ args_confirm -- show the name and value of variables, and continue execute if args_confirm by user, or exit if not
83
+
84
+ ##### SYNOPSIS
85
+ ```
86
+ args_confirm variableName...
87
+ ```
88
+
89
+ ##### DESCRIPTION
90
+ - **variableName...** some existed variable names to show its value
91
+
92
+ ##### EXAMPLES
93
+ ```
94
+ a="correct value"
95
+ b="wrong value"
96
+ args_confirm a b
97
+ ```
98
+
99
+ ##### SEE_ALSO
100
+ args_print, stop_if_failed
101
+
102
+ ---
103
+
104
+ ##### NAME
105
+ args_print -- if LOG_LEVEL<=$LOG_LEVEL_WARN, show the name and value of variables
106
+
107
+ ##### SYNOPSIS
108
+ ```
109
+ args_print variableName...
110
+ ```
111
+
112
+ ##### DESCRIPTION
113
+ - **variableName...** some existed variable names to show its value
114
+
115
+ ##### EXAMPLES
116
+ ```
117
+ var1="value 1"
118
+ var2="value 2"
119
+ args_print var1 var2
120
+ ```
121
+
122
+ ##### SEE_ALSO
123
+ print_header, print_error, print_success, print_warn, print_info, print_debug
124
+
125
+ ---
126
+
73
127
  ##### NAME
74
128
  args_parse -- parse the script argument values to positional variable names, process firstly the optional param help(-h) / quiet(-q) if existed
75
129
 
@@ -244,7 +298,7 @@ string_split_to_array, array_describe, array_from_describe
244
298
  ---
245
299
 
246
300
  ##### NAME
247
- array_describe -- convert the array to its string representation
301
+ array_describe -- convert the array to its shell-native string representation
248
302
 
249
303
  ##### SYNOPSIS
250
304
  ```
@@ -401,7 +455,7 @@ array_length myArray ==> 3
401
455
  ---
402
456
 
403
457
  ##### NAME
404
- array_reset_index -- reset the indexes of array to the sequence 0,1,2..., save the result to original variable name
458
+ array_reset_index -- reset indexes to the shell-native contiguous sequence, save the result to original variable name
405
459
 
406
460
  ##### SYNOPSIS
407
461
  ```
@@ -413,7 +467,7 @@ array_reset_index arrayVarName
413
467
 
414
468
  ##### EXAMPLES
415
469
  ```
416
- myArray=([2]='a' [5]='c' [11]='dd')
470
+ Bash example: myArray=([2]='a' [5]='c' [11]='dd')
417
471
  array_reset_index myArray ==> ([0]='a' [1]='c' [2]='dd')
418
472
  ```
419
473
 
@@ -1541,7 +1595,7 @@ wait_for 'test -f /tmp/output.txt' 'file existed' 3
1541
1595
  ```
1542
1596
 
1543
1597
  ##### SEE_ALSO
1544
- confirm_to_continue, stop_if_failed, is_http_ok
1598
+ confirm_to_continue, stop_if_failed
1545
1599
 
1546
1600
  ---
1547
1601
 
package/man/bash-base.1 CHANGED
@@ -4,6 +4,72 @@
4
4
  .hy
5
5
  .SS NAME
6
6
  .PP
7
+ aliases need different non-interactive expansion rules in Bash and zsh,
8
+ while functions work identically when this library is sourced by either
9
+ shell.
10
+ .PP
11
+ * * * * *
12
+ .SS NAME
13
+ .PP
14
+ args_confirm \[en] show the name and value of variables, and continue
15
+ execute if args_confirm by user, or exit if not
16
+ .SS SYNOPSIS
17
+ .IP
18
+ .nf
19
+ \f[C]
20
+ args_confirm variableName...
21
+ \f[R]
22
+ .fi
23
+ .SS DESCRIPTION
24
+ .IP \[bu] 2
25
+ \f[B]variableName\&...\f[R] some existed variable names to show its
26
+ value
27
+ .SS EXAMPLES
28
+ .IP
29
+ .nf
30
+ \f[C]
31
+ a=\[dq]correct value\[dq]
32
+ b=\[dq]wrong value\[dq]
33
+ args_confirm a b
34
+ \f[R]
35
+ .fi
36
+ .SS SEE_ALSO
37
+ .PP
38
+ args_print, stop_if_failed
39
+ .PP
40
+ * * * * *
41
+ .SS NAME
42
+ .PP
43
+ args_print \[en] if LOG_LEVEL<=$LOG_LEVEL_WARN, show the name and value
44
+ of variables
45
+ .SS SYNOPSIS
46
+ .IP
47
+ .nf
48
+ \f[C]
49
+ args_print variableName...
50
+ \f[R]
51
+ .fi
52
+ .SS DESCRIPTION
53
+ .IP \[bu] 2
54
+ \f[B]variableName\&...\f[R] some existed variable names to show its
55
+ value
56
+ .SS EXAMPLES
57
+ .IP
58
+ .nf
59
+ \f[C]
60
+ var1=\[dq]value 1\[dq]
61
+ var2=\[dq]value 2\[dq]
62
+ args_print var1 var2
63
+ \f[R]
64
+ .fi
65
+ .SS SEE_ALSO
66
+ .PP
67
+ print_header, print_error, print_success, print_warn, print_info,
68
+ print_debug
69
+ .PP
70
+ * * * * *
71
+ .SS NAME
72
+ .PP
7
73
  args_parse \[en] parse the script argument values to positional variable
8
74
  names, process firstly the optional param help(-h) / quiet(-q) if
9
75
  existed
@@ -247,7 +313,8 @@ string_split_to_array, array_describe, array_from_describe
247
313
  * * * * *
248
314
  .SS NAME
249
315
  .PP
250
- array_describe \[en] convert the array to its string representation
316
+ array_describe \[en] convert the array to its shell-native string
317
+ representation
251
318
  .SS SYNOPSIS
252
319
  .IP
253
320
  .nf
@@ -443,8 +510,8 @@ array_length myArray ==> 3
443
510
  * * * * *
444
511
  .SS NAME
445
512
  .PP
446
- array_reset_index \[en] reset the indexes of array to the sequence
447
- 0,1,2\&..., save the result to original variable name
513
+ array_reset_index \[en] reset indexes to the shell-native contiguous
514
+ sequence, save the result to original variable name
448
515
  .SS SYNOPSIS
449
516
  .IP
450
517
  .nf
@@ -459,7 +526,7 @@ array_reset_index arrayVarName
459
526
  .IP
460
527
  .nf
461
528
  \f[C]
462
- myArray=([2]=\[aq]a\[aq] [5]=\[aq]c\[aq] [11]=\[aq]dd\[aq])
529
+ Bash example: myArray=([2]=\[aq]a\[aq] [5]=\[aq]c\[aq] [11]=\[aq]dd\[aq])
463
530
  array_reset_index myArray ==> ([0]=\[aq]a\[aq] [1]=\[aq]c\[aq] [2]=\[aq]dd\[aq])
464
531
  \f[R]
465
532
  .fi
@@ -1914,7 +1981,7 @@ wait_for \[aq]test -f /tmp/output.txt\[aq] \[aq]file existed\[aq] 3
1914
1981
  .fi
1915
1982
  .SS SEE_ALSO
1916
1983
  .PP
1917
- confirm_to_continue, stop_if_failed, is_http_ok
1984
+ confirm_to_continue, stop_if_failed
1918
1985
  .PP
1919
1986
  * * * * *
1920
1987
  .SS NAME
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@renault-digital/bash-base",
3
- "version": "2.4.0",
4
- "description": "A common lib for creating bash script easily.",
3
+ "version": "2.5.0",
4
+ "description": "Reusable Bash/zsh utilities for reliable command composition and automation.",
5
5
  "private": false,
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -12,6 +12,7 @@
12
12
  "CONTRIBUTING.md",
13
13
  "package-lock.json",
14
14
  "scripts/test.sh",
15
+ "scripts/test-shell-compat.sh",
15
16
  "src/",
16
17
  "bin/",
17
18
  "docs/",
@@ -27,7 +28,6 @@
27
28
  "test": "spec"
28
29
  },
29
30
  "scripts": {
30
- "preinstall": "npx npm-force-resolutions || true",
31
31
  "shellcheck": "docker run --rm -v \"$(pwd)\":/bash-base -w /bash-base koalaman/shellcheck:latest src/*.sh scripts/*.sh example/*.sh",
32
32
  "shfmt": "docker run --rm -v \"$(pwd)\":/bash-base -w /bash-base mvdan/shfmt -l -w src/*.sh scripts/*.sh example/*.sh",
33
33
  "lint:commit": " commitlint --from=$(git rev-list --max-parents=0 HEAD)",
@@ -66,7 +66,6 @@
66
66
  "cz-conventional-changelog": "^3.3.0",
67
67
  "husky": "^9.1.7",
68
68
  "merge": ">=2.1.1",
69
- "semantic-release": "^25.0.1"
70
- },
71
- "resolutions": {}
69
+ "semantic-release": "25.0.9"
70
+ }
72
71
  }