@@ -18,6 +18,7 @@ function Publish-Script {
18
18
[Parameter (Mandatory = $true ,
19
19
ValueFromPipelineByPropertyName = $true ,
20
20
ParameterSetName = ' LiteralPathParameterSet' )]
21
+ [Alias (' PSPath' )]
21
22
[ValidateNotNullOrEmpty ()]
22
23
[string ]
23
24
$LiteralPath ,
@@ -49,7 +50,7 @@ function Publish-Script {
49
50
$scriptFilePath = $null
50
51
if ($Path ) {
51
52
$scriptFilePath = Resolve-PathHelper - Path $Path - CallerPSCmdlet $PSCmdlet |
52
- Microsoft.PowerShell.Utility\Select-Object - First 1 - ErrorAction Ignore
53
+ Microsoft.PowerShell.Utility\Select-Object - First 1 - ErrorAction Ignore
53
54
54
55
if (-not $scriptFilePath -or
55
56
-not (Microsoft.PowerShell.Management\Test-Path - Path $scriptFilePath - PathType Leaf)) {
@@ -64,7 +65,7 @@ function Publish-Script {
64
65
}
65
66
else {
66
67
$scriptFilePath = Resolve-PathHelper - Path $LiteralPath - IsLiteralPath - CallerPSCmdlet $PSCmdlet |
67
- Microsoft.PowerShell.Utility\Select-Object - First 1 - ErrorAction Ignore
68
+ Microsoft.PowerShell.Utility\Select-Object - First 1 - ErrorAction Ignore
68
69
69
70
if (-not $scriptFilePath -or
70
71
-not (Microsoft.PowerShell.Management\Test-Path - LiteralPath $scriptFilePath - PathType Leaf)) {
@@ -117,8 +118,7 @@ function Publish-Script {
117
118
118
119
if (-not $DestinationLocation -or
119
120
(-not (Microsoft.PowerShell.Management\Test-Path - Path $DestinationLocation ) -and
120
- -not (Test-WebUri - uri $DestinationLocation )))
121
- {
121
+ -not (Test-WebUri - uri $DestinationLocation ))) {
122
122
$message = $LocalizedData.PSRepositoryScriptPublishLocationIsMissing -f ($Repository , $Repository )
123
123
ThrowError - ExceptionName " System.ArgumentException" `
124
124
- ExceptionMessage $message `
@@ -182,7 +182,7 @@ function Publish-Script {
182
182
183
183
# Copy the source script file to temp location to publish
184
184
$tempScriptPath = Microsoft.PowerShell.Management\Join-Path - Path $script :TempPath - ChildPath " $ ( Get-Random ) " |
185
- Microsoft.PowerShell.Management\Join-Path - ChildPath $scriptName
185
+ Microsoft.PowerShell.Management\Join-Path - ChildPath $scriptName
186
186
187
187
$null = Microsoft.PowerShell.Management\New-Item - Path $tempScriptPath - ItemType Directory - Force - ErrorAction SilentlyContinue - WarningAction SilentlyContinue - Confirm:$false - WhatIf:$false
188
188
if ($Path ) {
@@ -211,8 +211,8 @@ function Publish-Script {
211
211
# Check if the specified script name is already used for a module on the specified repository
212
212
# Use Find-Module to check if that name is already used as module name
213
213
$modulePSGetItemInfo = Find-Module @FindParameters |
214
- Microsoft.PowerShell.Core\Where-Object {$_.Name -eq $scriptName } |
215
- Microsoft.PowerShell.Utility\Select-Object - Last 1 - ErrorAction Ignore
214
+ Microsoft.PowerShell.Core\Where-Object { $_.Name -eq $scriptName } |
215
+ Microsoft.PowerShell.Utility\Select-Object - Last 1 - ErrorAction Ignore
216
216
if ($modulePSGetItemInfo ) {
217
217
$message = $LocalizedData.SpecifiedNameIsAlearyUsed -f ($scriptName , $Repository , ' Find-Module' )
218
218
ThrowError - ExceptionName " System.InvalidOperationException" `
@@ -227,8 +227,8 @@ function Publish-Script {
227
227
228
228
$currentPSGetItemInfo = $null
229
229
$currentPSGetItemInfo = Find-Script @FindParameters |
230
- Microsoft.PowerShell.Core\Where-Object {$_.Name -eq $scriptName } |
231
- Microsoft.PowerShell.Utility\Select-Object - Last 1 - ErrorAction Ignore
230
+ Microsoft.PowerShell.Core\Where-Object { $_.Name -eq $scriptName } |
231
+ Microsoft.PowerShell.Utility\Select-Object - Last 1 - ErrorAction Ignore
232
232
233
233
if ($currentPSGetItemInfo ) {
234
234
$result = ValidateAndGet- VersionPrereleaseStrings - Version $currentPSGetItemInfo.Version - CallerPSCmdlet $PSCmdlet
0 commit comments