From 63e20bf53cb2276b77b70ebdb52ec6bfb343a789 Mon Sep 17 00:00:00 2001 From: LNK LEO Date: Wed, 5 Oct 2022 17:25:33 +0800 Subject: [PATCH] feat(rust): add beta/dev/nightly to version string --- src/segments/rust.go | 2 +- src/segments/rust_test.go | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/segments/rust.go b/src/segments/rust.go index 2ba9003a..98238fc4 100644 --- a/src/segments/rust.go +++ b/src/segments/rust.go @@ -22,7 +22,7 @@ func (r *Rust) Init(props properties.Properties, env environment.Environment) { { executable: "rustc", args: []string{"--version"}, - regex: `rustc (?P((?P[0-9]+).(?P[0-9]+).(?P[0-9]+)))`, + regex: `rustc (?P((?P[0-9]+).(?P[0-9]+).(?P[0-9]+))(-(?P[a-z]+))?) (\((?P[0-9a-f]+ [0-9]+-[0-9]+-[0-9]+)\))`, }, }, } diff --git a/src/segments/rust_test.go b/src/segments/rust_test.go index 75ef4313..6cf4492d 100644 --- a/src/segments/rust_test.go +++ b/src/segments/rust_test.go @@ -14,6 +14,7 @@ func TestRust(t *testing.T) { Version string }{ {Case: "Rust 1.53.0", ExpectedString: "1.53.0", Version: "rustc 1.53.0 (4369396ce 2021-04-27)"}, + {Case: "Rust 1.66.0", ExpectedString: "1.66.0-nightly", Version: "rustc 1.66.0-nightly (01af5040f 2022-10-04)"}, } for _, tc := range cases { params := &mockedLanguageParams{