Skip to content

Commit f53005f

Browse files
committed
git subrepo pull ext/bashplus
subrepo: subdir: "ext/bashplus" merged: "030d196" upstream: origin: "[email protected]:ingydotnet/bashplus.git" branch: "master" commit: "030d196" git-subrepo: version: "0.4.1" origin: "[email protected]:ingydotnet/git-subrepo" commit: "2c14be6"
1 parent 2c14be6 commit f53005f

13 files changed

+49
-24
lines changed

ext/bashplus/.gitrepo

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
[subrepo]
77
remote = [email protected]: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

ext/bashplus/Changes

+8
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
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+
---
210
version: 0.0.9
311
date: Wed 11 Nov 2020 02:19:32 PM EST
412
changes:

ext/bashplus/Meta

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
=meta: 0.0.2
22

33
name: bashplus
4-
version: 0.0.9
4+
version: 0.1.0
55
abstract: Modern Bash Programming
6-
homepage: http://bpan.org/package/bashplus/
6+
homepage: https://github.com/ingydotnet/bashplus
77

88
license: MIT
99
copyright: 2013-2020
@@ -16,7 +16,7 @@ author:
1616
homepage: http://ingy.net
1717

1818
requires:
19-
bash: 4.4.0
19+
bash: 3.2
2020
test:
2121
cmd: make test
2222
install:

ext/bashplus/lib/bash+.bash

+8-8
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@ set -e
66

77
[[ ${BASHPLUS_VERSION-} ]] && return 0
88

9-
BASHPLUS_VERSION=0.0.9
9+
BASHPLUS_VERSION=0.1.0
1010

1111
bash+: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

4141
bash+:version-check bash 3.2 ||

ext/bashplus/test/base.t

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@
22

33
source test/setup
44

5-
PATH=$PWD/bin:$PATH
65
source bash+ :std
76

87
ok $? "'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

1211
done_testing 2

ext/bashplus/test/die.t

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@
22

33
source test/setup
44

5-
PATH=$PWD/bin:$PATH
65
source bash+ :std
76

87
got=$(die "Nope" 2>&1) || true
98
want="Nope
10-
at line 8 in main of test/die.t"
9+
at line 7 in main of test/die.t"
1110
is "$got" "$want" "die() msg ok"
1211

1312
got=$(die "Nope\n" 2>&1) || true

ext/bashplus/test/fcopy.t

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
source test/setup
44

5-
PATH=$PWD/bin:$PATH
65
source bash+
76

87
foo() {

ext/bashplus/test/setup

+3-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@
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

1314
run=0
1415

ext/bashplus/test/shellcheck.t

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
source test/setup
44

5-
PATH=$PWD/bin:$PATH
65
source bash+
76

87
if ! command -v shellcheck >/dev/null; then

ext/bashplus/test/source-bash+-std.t

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
source test/setup
44

5-
PATH=$PWD/bin:$PATH
65
source bash+ :std
76

87
ok "$(bash+:can use)" 'use is imported'

ext/bashplus/test/source-bash+.t

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
source test/setup
44

5-
PATH=$PWD/bin:$PATH
65
source bash+
76

87
functions=(

ext/bashplus/test/use.t

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
source test/setup
44

5-
PATH=$PWD/bin:$PATH
65
source bash+ :std can
76

87
# shellcheck disable=2034

ext/bashplus/test/version-check.t

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env bash
2+
3+
source test/setup
4+
5+
PATH=$PWD/bin:$PATH
6+
source bash+ version-check
7+
8+
t1() (echo 0.1.2)
9+
t2() (echo 0.1)
10+
11+
ok "$(version-check t1 0)" "0.1.2 >= 0"
12+
ok "$(version-check t1 0.1)" "0.1.2 >= 0.1"
13+
ok "$(version-check t1 0.1.1)" "0.1.2 >= 0.1.1"
14+
ok "$(version-check t1 0.1.2)" "0.1.2 >= 0.1.2"
15+
ok "$(! version-check t1 0.2)" "0.1.2 >= 0.2 fails"
16+
ok "$(! version-check t1 0.1.3)" "0.1.2 >= 0.1.3 fails"
17+
18+
ok "$(version-check t2 0)" "0.1 >= 0"
19+
ok "$(version-check t2 0.1)" "0.1 >= 0.1"
20+
ok "$(! version-check t2 0.2)" "0.1 >= 0.2 fails"
21+
ok "$(! version-check t2 0.1.1)" "0.1 >= 0.1.1"
22+
23+
done_testing 10

0 commit comments

Comments
 (0)