into semver

For conversions.

Convert a value (string, record, or semver) to a semantic version.

Command Type

built-in

Signature

> into semver {flags} ...rest

Flags

  • --loose, -l: Allow common non-strict prefixes such as v1.2.3, v.1.2.3, v:1.2.3, v-1.2.3, or v_1.2.3

Parameters

  • ...rest: For a data structure input, convert data at the given cell paths.

Input/output types:

input output
string semver
semver semver
record semver
record record
table table
list<string> list<semver>
list<semver> list<semver>
table list<semver>
any semver

Examples

Convert a string to a semver value

> '1.2.3' | into semver

Convert a string with prerelease

> '1.2.3-alpha.1+build.2' | into semver

Convert a record to a semver value

> {major: 1, minor: 2, patch: 3} | into semver

Parse a version with a common leading v prefix

> 'v1.2.3' | into semver --loose

Parse versions like v.1.2.3, v:1.2.3, v-1.2.3, or v_1.2.3

> ['v.1.2.3' 'v:2.0.0' 'v-3.0.0' 'v_4.0.0'] | into semver --loose

Notes

From a record: major/minor/patch are required; pre, build, and prefix are optional. prefix is display-only metadata (e.g. “v”); re-parsing from text with —loose only accepts recognized loose prefixes (v/V with optional . : - _).

Ported from nushell/nushell.github.io. Copyright (c) 2021 Nushell Project. MIT License.