semver.c icon indicating copy to clipboard operation
semver.c copied to clipboard

add '.x' partial version support

Open chtimi59 opened this issue 6 years ago • 0 comments

From my own needs...

Maybe an idea form improvement ?

I actually realize that semver_satisfies didn't support those kind of situation (with no "operation"):

  • "1.2.3" should statisfy "1.2.x"
  • "1.2.3" should statisfy "1.2"

To achieved that, I also add a little helper "semver_parse_op" to retrieve "operation" from a string

Example

semver_t semver = {};
char op[3];
semver_parse_op(">=1.2.x", &semver, &op)

/*
returns

 op: ">="

 semver: {
   major = 1
   minor = 2
   patch = 0
   is_major_set = 1
   is_minor_set = 1
   is_patch_set = 0
}
*/

chtimi59 avatar Oct 31 '18 04:10 chtimi59