From 05e0caf2e16fcbbde85899883bbf4e9a32b303fa Mon Sep 17 00:00:00 2001 From: Jon C Date: Fri, 13 Sep 2024 14:44:33 +0200 Subject: [PATCH] Relax leading "v" --- sdk/cargo-build-sbf/src/main.rs | 4 ++-- sdk/cargo-test-sbf/src/main.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sdk/cargo-build-sbf/src/main.rs b/sdk/cargo-build-sbf/src/main.rs index 114149ea5f83cb..9ebee046986715 100644 --- a/sdk/cargo-build-sbf/src/main.rs +++ b/sdk/cargo-build-sbf/src/main.rs @@ -128,11 +128,11 @@ where } pub fn is_version_string(arg: &str) -> Result<(), String> { - let semver_re = Regex::new(r"^v[0-9]+\.[0-9]+(\.[0-9]+)?").unwrap(); + let semver_re = Regex::new(r"^v?[0-9]+\.[0-9]+(\.[0-9]+)?").unwrap(); if semver_re.is_match(arg) { return Ok(()); } - Err("a version string starts with 'v' and contains major and minor version numbers separated by a dot, e.g. v1.32".to_string()) + Err("a version string may start with 'v' and contains major and minor version numbers separated by a dot, e.g. v1.32 or 1.32".to_string()) } fn find_installed_platform_tools() -> Vec { diff --git a/sdk/cargo-test-sbf/src/main.rs b/sdk/cargo-test-sbf/src/main.rs index 829a94d918d8f8..57d1185b493caa 100644 --- a/sdk/cargo-test-sbf/src/main.rs +++ b/sdk/cargo-test-sbf/src/main.rs @@ -104,11 +104,11 @@ where } pub fn is_version_string(arg: &str) -> Result<(), String> { - let semver_re = Regex::new(r"^v[0-9]+\.[0-9]+(\.[0-9]+)?").unwrap(); + let semver_re = Regex::new(r"^v?[0-9]+\.[0-9]+(\.[0-9]+)?").unwrap(); if semver_re.is_match(arg) { return Ok(()); } - Err("a version string starts with 'v' and contains major and minor version numbers separated by a dot, e.g. v1.32".to_string()) + Err("a version string may start with 'v' and contains major and minor version numbers separated by a dot, e.g. v1.32 or 1.32".to_string()) } fn test_solana_package(