diff options
Diffstat (limited to 'gbpm.sh')
| -rwxr-xr-x | gbpm.sh | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -124,6 +124,20 @@ cmd_set() { [[ "${bn}" == *"${1}"* ]] || continue + # lower depth (i.e. fewer hyphens before match) is preferred, + # e.g. `2' matches `python-2.0' over `python-3.0-2'. + # + # priority at the same depth, using `2.1' as an example: + # - from start/hyphen to end (python-2.1) + # - from start/hyphen to hyphen (python-2.1-2) + # - from start/hyphen to dot (python-2.1.3) + # - from start/hyphen (python-2.11) + # - other (python-3.2.1) + # + # at the same priority, the last match (i.e. greatest + # version-sorted string) is used, e.g. `3' matches + # `python-3.14' over `python-3.2'. + prefix="${bn%%${1}*}" pri="${prefix//[^-]}" pri="$((${#pri} * 5))" |
