@@ -782,16 +782,8 @@ begin {
782
782
do {
783
783
$Name = Show-Menu - Options $allNerdFonts
784
784
if ($Name -eq ' quit' ) {
785
- $Name = $null
786
785
Write-Host " Selection process canceled."
787
- if ($null -eq $MyInvocation.InvocationName -or $MyInvocation.InvocationName -eq ' &' ) {
788
- # Running as a script block
789
- return
790
- }
791
- else {
792
- # Running as a standalone script
793
- exit
794
- }
786
+ return
795
787
}
796
788
} while (-not $Name )
797
789
@@ -806,14 +798,7 @@ begin {
806
798
}
807
799
}
808
800
else {
809
- if ($null -eq $MyInvocation.InvocationName -or $MyInvocation.InvocationName -eq ' &' ) {
810
- # Running as a script block
811
- return
812
- }
813
- else {
814
- # Running as a standalone script
815
- exit
816
- }
801
+ return
817
802
}
818
803
}
819
804
elseif ($PSBoundParameters.Name ) {
@@ -829,14 +814,7 @@ begin {
829
814
830
815
if ($nerdFontsToInstall.Count -eq 0 ) {
831
816
Write-Error " No matching fonts found."
832
- if ($null -eq $MyInvocation.InvocationName -or $MyInvocation.InvocationName -eq ' &' ) {
833
- # Running as a script block
834
- return
835
- }
836
- else {
837
- # Running as a standalone script
838
- exit
839
- }
817
+ return
840
818
}
841
819
842
820
# Fetch releases for each unique URL
@@ -906,6 +884,8 @@ begin {
906
884
}
907
885
908
886
process {
887
+ if ($nerdFontsToInstall.Count -eq 0 ) { return }
888
+
909
889
try {
910
890
Write-Verbose " Installing $ ( $nerdFontsToInstall.Count ) Nerd Fonts to $Scope scope."
911
891
@@ -1154,6 +1134,8 @@ process {
1154
1134
}
1155
1135
1156
1136
end {
1137
+ if ($nerdFontsToInstall.Count -eq 0 ) { return }
1138
+
1157
1139
if ([System.IO.Directory ]::Exists($tempPath )) {
1158
1140
Write-Verbose " Removing temporary directory: $tempPath "
1159
1141
[System.IO.Directory ]::Delete($tempPath , $true )
0 commit comments