Skip to main content

version_labels

Function version_labels 

Source
pub fn version_labels(line: &str) -> Vec<String>
Expand description

Every version label on a line: v, a major and a minor, and no patch — v0.1, v1.2.

A release is always three numbers (v0.3.1), so a label of two names no release: it names the version a text was written about, and it stays where it was typed while the version moves on. A label joined to a word, a path or a URL is not one, and neither is a three-part version or a schema’s version: 1.

use majordomus_cli::release::version::version_labels;
assert_eq!(version_labels("What v0.1 does not do"), ["v0.1"]);
assert_eq!(version_labels("(v1.12), and v2.0."), ["v1.12", "v2.0"]);
assert!(version_labels("Release `v0.3.1` was published").is_empty());
assert!(version_labels("see /releases/v0.1.json and api-v0.1").is_empty());
assert!(version_labels("rule v2, schema version: 1, dev0.1").is_empty());
assert!(version_labels("v0.1.0 and v0.1x").is_empty());