mirror of
https://github.com/cmderdev/cmder.git
synced 2025-02-11 16:00:21 +08:00
replace tabs to spaces
This commit is contained in:
parent
7d04ded1c2
commit
d6569192fc
@ -102,42 +102,42 @@ function Get-VersionStr() {
|
|||||||
|
|
||||||
function Parse-Changelog($file) {
|
function Parse-Changelog($file) {
|
||||||
|
|
||||||
# Define the regular expression to match the version string from changelog
|
# Define the regular expression to match the version string from changelog
|
||||||
[regex]$regex = '^## \[(?<version>[\w\-\.]+)\]\([^\n()]+\)\s+\([^\n()]+\)$';
|
[regex]$regex = '^## \[(?<version>[\w\-\.]+)\]\([^\n()]+\)\s+\([^\n()]+\)$';
|
||||||
|
|
||||||
# Find the first match of the version string which means the latest version
|
# Find the first match of the version string which means the latest version
|
||||||
$version = Select-String -Path $file -Pattern $regex | Select-Object -First 1 | % { $_.Matches.Groups[1].Value }
|
$version = Select-String -Path $file -Pattern $regex | Select-Object -First 1 | % { $_.Matches.Groups[1].Value }
|
||||||
|
|
||||||
return $version
|
return $version
|
||||||
}
|
}
|
||||||
|
|
||||||
function Create-RC($string, $path) {
|
function Create-RC($string, $path) {
|
||||||
|
|
||||||
$version = $string + '.0.0.0.0' # padding for version string
|
$version = $string + '.0.0.0.0' # padding for version string
|
||||||
|
|
||||||
if ( !(Test-Path "$path.sample") ) {
|
if ( !(Test-Path "$path.sample") ) {
|
||||||
throw "Invalid path provided for resources file."
|
throw "Invalid path provided for resources file."
|
||||||
}
|
}
|
||||||
|
|
||||||
$resource = Get-Content -Path "$path.sample"
|
$resource = Get-Content -Path "$path.sample"
|
||||||
$pattern = @( "Cmder-Major-Version", "Cmder-Minor-Version", "Cmder-Revision-Version", "Cmder-Build-Version" )
|
$pattern = @( "Cmder-Major-Version", "Cmder-Minor-Version", "Cmder-Revision-Version", "Cmder-Build-Version" )
|
||||||
$index = 0
|
$index = 0
|
||||||
|
|
||||||
# Replace all non-numeric characters to dots and split to array
|
# Replace all non-numeric characters to dots and split to array
|
||||||
$version = $version -replace '[^0-9]+','.' -split '\.'
|
$version = $version -replace '[^0-9]+','.' -split '\.'
|
||||||
|
|
||||||
foreach ($fragment in $version) {
|
foreach ($fragment in $version) {
|
||||||
if ( !$fragment ) { break }
|
if ( !$fragment ) { break }
|
||||||
elseif ($index -le $pattern.length) {
|
elseif ($index -le $pattern.length) {
|
||||||
$resource = $resource.Replace( "{" + $pattern[$index++] + "}", $fragment )
|
$resource = $resource.Replace( "{" + $pattern[$index++] + "}", $fragment )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Add the version string
|
# Add the version string
|
||||||
$resource = $resource.Replace( "{Cmder-Version-Str}", '"' + $string + '"' )
|
$resource = $resource.Replace( "{Cmder-Version-Str}", '"' + $string + '"' )
|
||||||
|
|
||||||
# Write the results
|
# Write the results
|
||||||
Set-Content -Path $path -Value $resource
|
Set-Content -Path $path -Value $resource
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user