branch: elpa/age
commit 3725f0e5d6f218fed265e7b249dedfd08820aba9
Author: Bas Alberts <[email protected]>
Commit: Bas Alberts <[email protected]>

    more flexible versioning regex
    
    since there seems to be quite a bit of variance in age client
    versions, just match on the semver as opposed to any prefixes
    or postfixes.
---
 age.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/age.el b/age.el
index 832b5228948..048c3756602 100644
--- a/age.el
+++ b/age.el
@@ -204,7 +204,8 @@ version requirement is met."
   ;; e.g. macports has v1.0.0 and nixos has 1.0.0
   (let ((version
          (let ((v (shell-command-to-string (format "%s --version" program))))
-           (when (string-match "^\\(?:v\\|rage\\)* *\\(.*\\)?\n*" v)
+           ;; assuming https://semver.org/
+           (when (string-match "\\([0-9]+\\.[0-9]+\\.[0-9]+\\)" v)
              (match-string 1 v)))))
     (list (cons 'program program)
           (cons 'version version))))

Reply via email to