Skip to content
This repository was archived by the owner on May 7, 2024. It is now read-only.

Commit d08a339

Browse files
committed
lib/pm: allow '<< ver' and '>> ver' in relations
1 parent 356c91f commit d08a339

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lib/pm.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,22 @@
66
# Magic book: ab2:PAKMGR.md
77
_ab_pm='' # package manager spec variables
88
# genver <pkgspec> -> pkgname[<ver_s><op>verstr<ver_e>]
9-
_ab_pm+="OP_{EQ,LE,GE} VER_{S,E} "
9+
_ab_pm+="OP_{EQ,LE,GE,LT,GT} VER_{S,E} "
1010
pm_genver(){
1111
local store IFS ver name # IFS is also used for holding OP.
12-
: "${OP_EQ== } ${OP_LE=<= } ${OP_GE=>= } ${VER_S= (} ${VER_E=)}"
12+
: "${OP_EQ== } ${OP_LE=<= } ${OP_GE=>= } ${OP_LT=<< } ${OP_GT=>> } ${VER_S= (} ${VER_E=)}"
1313
if ((VER_NONE_ALL)); then # name-only
1414
name="${1/%_}"
1515
echo "${name/[<>=]=*}"; return
16-
elif [[ "$1" =~ [\<\>=]= ]]; then # nameOP[ver] -> name OP_ ver
16+
elif [[ "$1" =~ [\<\>=]=|\<\<|\>\> ]]; then # nameOP[ver] -> name OP_ ver
1717
IFS="$BASH_REMATCH" # split string using each char in OP
1818
read -ra store <<< "$1"
1919
name=${store[0]} ver=${store[2]} # constexpr store[${#IFS}]
2020
IFS=${IFS/==/$OP_EQ} # translate to package manager notation
2121
IFS=${IFS/<=/$OP_LE}
2222
IFS=${IFS/>=/$OP_GE}
23+
IFS=${IFS/<</$OP_LT}
24+
IFS=${IFS/>>/$OP_GT}
2325
elif ((VER_NONE)) || [[ "$1" =~ _$ ]]; then # name{,_} -> name (e.g. conflicts, ..)
2426
echo -n "${1%_}"; return;
2527
else

0 commit comments

Comments
 (0)