powershell formatting

This commit is contained in:
David Refoua 2022-11-04 18:47:16 +03:30
parent 3859f6ffc0
commit efb3338f5c
3 changed files with 13 additions and 11 deletions

View File

@ -35,7 +35,7 @@
.LINK .LINK
http://cmder.app/ - Project Home http://cmder.app/ - Project Home
#> #>
[CmdletBinding(SupportsShouldProcess=$true)] [CmdletBinding(SupportsShouldProcess = $true)]
Param( Param(
# CmdletBinding will give us; # CmdletBinding will give us;
# -verbose switch to turn on logging and # -verbose switch to turn on logging and
@ -108,12 +108,14 @@ if (-Not $noVendor) {
$ConEmuXmlSave = Join-Path $config "ConEmu.xml" $ConEmuXmlSave = Join-Path $config "ConEmu.xml"
Write-Verbose "Backup '$ConEmuXml' to '$ConEmuXmlSave'" Write-Verbose "Backup '$ConEmuXml' to '$ConEmuXmlSave'"
Copy-Item $ConEmuXml $ConEmuXmlSave Copy-Item $ConEmuXml $ConEmuXmlSave
} else { $ConEmuXml = "" } }
} else { $ConEmuXml = "" } else { $ConEmuXml = "" }
}
else { $ConEmuXml = "" }
# Kill ssh-agent.exe if it is running from the $env:cmder_root we are building # Kill ssh-agent.exe if it is running from the $env:cmder_root we are building
foreach ($ssh_agent in $(Get-Process ssh-agent -ErrorAction SilentlyContinue)) { foreach ($ssh_agent in $(Get-Process ssh-agent -ErrorAction SilentlyContinue)) {
if ([string]$($ssh_agent.path) -Match [string]$cmder_root.replace('\','\\')) { if ([string]$($ssh_agent.path) -Match [string]$cmder_root.replace('\', '\\')) {
Write-Verbose $("Stopping " + $ssh_agent.path + "!") Write-Verbose $("Stopping " + $ssh_agent.path + "!")
Stop-Process $ssh_agent.id Stop-Process $ssh_agent.id
} }

View File

@ -22,7 +22,7 @@
https://github.com/cmderdev/cmder - Project Home https://github.com/cmderdev/cmder - Project Home
#> #>
[CmdletBinding(SupportsShouldProcess=$true)] [CmdletBinding(SupportsShouldProcess = $true)]
Param( Param(
# CmdletBinding will give us; # CmdletBinding will give us;
# -verbose switch to turn on logging and # -verbose switch to turn on logging and
@ -42,8 +42,8 @@ $ErrorActionPreference = "Stop"
Ensure-Executable "7z" Ensure-Executable "7z"
$targets = @{ $targets = @{
"cmder.7z" = "-t7z -m0=lzma2 -mx=9 -mfb=64 -md=32m -ms=on -myx=7 -mqs=on"; "cmder.7z" = "-t7z -m0=lzma2 -mx=9 -mfb=64 -md=32m -ms=on -myx=7 -mqs=on";
"cmder.zip" = "-mm=Deflate -mfb=128 -mpass=3"; "cmder.zip" = "-mm=Deflate -mfb=128 -mpass=3";
"cmder_mini.zip" = "-xr!`"vendor\git-for-windows`""; "cmder_mini.zip" = "-xr!`"vendor\git-for-windows`"";
} }
@ -63,7 +63,7 @@ $version = Get-VersionStr
if ($PSCmdlet.MyInvocation.BoundParameters["Verbose"].IsPresent) { if ($PSCmdlet.MyInvocation.BoundParameters["Verbose"].IsPresent) {
Write-Verbose "Packing Cmder $version in $saveTo..." Write-Verbose "Packing Cmder $version in $saveTo..."
$excluded = (Get-Content -Path "$cmderRoot\packignore") -Split [System.Environment]::NewLine | Where-Object {$_} $excluded = (Get-Content -Path "$cmderRoot\packignore") -Split [System.Environment]::NewLine | Where-Object { $_ }
Get-ChildItem $cmderRoot -Force -Exclude $excluded Get-ChildItem $cmderRoot -Force -Exclude $excluded
} }

View File

@ -25,7 +25,7 @@
.LINK .LINK
http://cmder.app/ - Project Home http://cmder.app/ - Project Home
#> #>
[CmdletBinding(SupportsShouldProcess=$true)] [CmdletBinding(SupportsShouldProcess = $true)]
Param( Param(
# CmdletBinding will give us; # CmdletBinding will give us;
# -verbose switch to turn on logging and # -verbose switch to turn on logging and
@ -158,10 +158,10 @@ function Fetch-DownloadUrl {
# Special case for archive downloads of repository # Special case for archive downloads of repository
if (($null -eq $downloadLinks) -Or (-Not $downloadLinks)) { if (($null -eq $downloadLinks) -Or (-Not $downloadLinks)) {
if ((($p | % {$_.Trim('/')}) -Contains "archive") -And $info[0].tag_name) { if ((($p | % { $_.Trim('/') }) -Contains "archive") -And $info[0].tag_name) {
for ($i = 0; $i -lt $p.Length; $i++) { for ($i = 0; $i -lt $p.Length; $i++) {
if ($p[$i].Trim('/') -eq "archive") { if ($p[$i].Trim('/') -eq "archive") {
$p[$i+1] = $info[0].tag_name + ".zip" $p[$i + 1] = $info[0].tag_name + ".zip"
$downloadLinks = $url.Scheme + "://" + $url.Host + ($p -Join '') $downloadLinks = $url.Scheme + "://" + $url.Host + ($p -Join '')
return $downloadLinks return $downloadLinks
} }