File tree Expand file tree Collapse file tree 13 files changed +49
-24
lines changed Expand file tree Collapse file tree 13 files changed +49
-24
lines changed Original file line number Diff line number Diff line change 66[subrepo]
77 remote = git@github.com:ingydotnet/bashplus.git
88 branch = master
9- commit = e49f45a1457fed3cceb15bd4a82b0f7515efd8e5
10- parent = 2e28e8a32166abdda154c4508c90176f356c1706
9+ commit = 030d196bf621e971e223e95e73c235e6992b85e0
10+ parent = 2c14be68fc5196ed1210d759421b33ef91c3e3db
1111 cmdver = 0.4.1
1212 method = merge
Original file line number Diff line number Diff line change 11---
2+ version: 0.1.0
3+ date: Sat 14 Nov 2020 10:14:14 AM EST
4+ changes:
5+ - Add tests for version-check
6+ - Improve version-check
7+ - Move PATH assignment into test/setup
8+ - Meta bashplus supports Bash 3.2
9+ ---
210version: 0.0.9
311date: Wed 11 Nov 2020 02:19:32 PM EST
412changes:
Original file line number Diff line number Diff line change 11=meta: 0.0.2
22
33name: bashplus
4- version: 0.0.9
4+ version: 0.1.0
55abstract: Modern Bash Programming
6- homepage: http ://bpan.org/package /bashplus/
6+ homepage: https ://github.com/ingydotnet /bashplus
77
88license: MIT
99copyright: 2013-2020
@@ -16,7 +16,7 @@ author:
1616 homepage: http://ingy.net
1717
1818requires:
19- bash: 4.4.0
19+ bash: 3.2
2020test:
2121 cmd: make test
2222install:
Original file line number Diff line number Diff line change 66
77[[ ${BASHPLUS_VERSION-} ]] && return 0
88
9- BASHPLUS_VERSION=0.0.9
9+ BASHPLUS_VERSION=0.1.0
1010
1111bash+:version-check () {
1212 local cmd want got out
1313
1414 IFS=' ' read -r -a cmd <<< " ${1:?}"
1515 IFS=. read -r -a want <<< " ${2:?}"
16+ : " ${want[0]:= 0} "
17+ : " ${want[1]:= 0} "
1618 : " ${want[2]:= 0} "
1719
1820 if [[ ${cmd[*]} == bash ]]; then
@@ -29,13 +31,11 @@ bash+:version-check() {
2931 fi
3032 : " ${got[2]:= 0} "
3133
32- ((
33- got[0 ] > want[0 ] ||
34- got[0 ] == want[0 ] && got[1 ] > want[1 ] ||
35- got[0 ] == want[0 ] && got[1 ] == want[1 ] && got[2 ] >= want[2 ]
36- )) || return 1
37-
38- return 0
34+ (( got[0 ] > want[0 ] || ((
35+ got[0 ] == want[0 ] && ((
36+ got[1 ] > want[1 ] || ((
37+ got[1 ] == want[1 ] && got[2 ] >= want[2 ]
38+ )) )) )) ))
3939}
4040
4141bash+:version-check bash 3.2 ||
Original file line number Diff line number Diff line change 22
33source test/setup
44
5- PATH=$PWD /bin:$PATH
65source bash+ :std
76
87ok $? " 'source bash+' works"
98
10- is " $BASHPLUS_VERSION " ' 0.0.9 ' ' BASHPLUS_VERSION is 0.0.9 '
9+ is " $BASHPLUS_VERSION " ' 0.1.0 ' ' BASHPLUS_VERSION is 0.1.0 '
1110
1211done_testing 2
Original file line number Diff line number Diff line change 22
33source test/setup
44
5- PATH=$PWD /bin:$PATH
65source bash+ :std
76
87got=$( die " Nope" 2>&1 ) || true
98want=" Nope
10- at line 8 in main of test/die.t"
9+ at line 7 in main of test/die.t"
1110is " $got " " $want " " die() msg ok"
1211
1312got=$( die " Nope\n" 2>&1 ) || true
Original file line number Diff line number Diff line change 22
33source test/setup
44
5- PATH=$PWD /bin:$PATH
65source bash+
76
87foo () {
Original file line number Diff line number Diff line change 77# how nice Bash can be.
88# ------------------------------------------------------------------------------
99
10- set -e -u -o pipefail
11- [[ $BASH_VERSION == 4.0* ]] && set +u
10+ set -e -o pipefail
11+
12+ PATH=$PWD /bin:$PATH
1213
1314run=0
1415
Original file line number Diff line number Diff line change 22
33source test/setup
44
5- PATH=$PWD /bin:$PATH
65source bash+
76
87if ! command -v shellcheck > /dev/null; then
Original file line number Diff line number Diff line change 22
33source test/setup
44
5- PATH=$PWD /bin:$PATH
65source bash+ :std
76
87ok " $( bash+:can use) " ' use is imported'
You can’t perform that action at this time.
0 commit comments