Closed air1bzz closed 1 month ago
-g
has been part of fish since 3.4.0 so it's not exactly "unknown" 😛
in this case, removing it isn't the same thing. -g
with string match
returns only the regex capturing groups. so the code in question selects just the version number and stores it as a variable.
go_version
will be something like...
go version go1.23.0 darwin/arm64
then go version | string match -r 'go version go(\\d+\\.\\d+(?:\\.\\d+)?)' -g
return the version:
1.23.0
… but leaving off the -g
returns the whole match, first, and the capturing groups second:
go version go1.23.0
1.23.0
… which is then passed to the sort
on the next line, and it silently compares a go version with the string go version ...
, which isn't going to work at all 🙂
I've pushed a change that uses string replace
rather than string match
, and confirmed the required options are available on string
all the way back to fish 2.0.0. Mind confirming that it works for you?
Hello, thanks you for explanations and having treated this case. Sincerely,
No problem. Thanks for reporting!
Fixes #372