Skip to content

Commit

Permalink
2023-11-19 17:41:58
Browse files Browse the repository at this point in the history
  • Loading branch information
uidHUB committed Nov 19, 2023
1 parent 564f46a commit b1d7298
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 10 deletions.
14 changes: 7 additions & 7 deletions PkgStore.cURL.psm1
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
$ModuleManifest = (Get-ChildItem -Path $PSScriptRoot | Where-Object {$_.Extension -eq '.psd1'})
$ModuleManifest = (Get-ChildItem -Path $PSScriptRoot | Where-Object { $_.Extension -eq '.psd1' })
$CurrentManifest = (Test-ModuleManifest $ModuleManifest)

$Aliases = @()
$PrivateFunctions = (Get-ChildItem -Path (Join-Path $PSScriptRoot 'Private') | Where-Object {$_.Extension -eq '.ps1'})
$PublicFunctions = (Get-ChildItem -Path (Join-Path $PSScriptRoot 'Public') | Where-Object {$_.Extension -eq '.ps1'})
$PrivateFunctions = (Get-ChildItem -Path (Join-Path $PSScriptRoot 'Private') | Where-Object { $_.Extension -eq '.ps1' })
$PublicFunctions = (Get-ChildItem -Path (Join-Path $PSScriptRoot 'Public') | Where-Object { $_.Extension -eq '.ps1' })

(@($PrivateFunctions) + @($PublicFunctions)) | ForEach-Object {
try {
Expand All @@ -25,10 +25,10 @@ $PublicFunctions = (Get-ChildItem -Path (Join-Path $PSScriptRoot 'Public') | Whe
}
}

$FunctionsAdded = ($PublicFunctions | Where-Object {$_.BaseName -notin $CurrentManifest.ExportedFunctions.Keys})
$FunctionsRemoved = ($CurrentManifest.ExportedFunctions.Keys | Where-Object {$_ -notin $PublicFunctions.BaseName})
$AliasesAdded = ($Aliases | Where-Object {$_ -notin $CurrentManifest.ExportedAliases.Keys})
$AliasesRemoved = ($CurrentManifest.ExportedAliases.Keys | Where-Object {$_ -notin $Aliases})
$FunctionsAdded = ($PublicFunctions | Where-Object { $_.BaseName -notin $CurrentManifest.ExportedFunctions.Keys })
$FunctionsRemoved = ($CurrentManifest.ExportedFunctions.Keys | Where-Object { $_ -notin $PublicFunctions.BaseName })
$AliasesAdded = ($Aliases | Where-Object { $_ -notin $CurrentManifest.ExportedAliases.Keys })
$AliasesRemoved = ($CurrentManifest.ExportedAliases.Keys | Where-Object { $_ -notin $Aliases })

if ($FunctionsAdded -or $FunctionsRemoved -or $AliasesAdded -or $AliasesRemoved) {
try {
Expand Down
2 changes: 2 additions & 0 deletions Private/Start-cURL.ps1
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
function Start-cURL {
<#
.SYNOPSIS
Running cURL.
.DESCRIPTION
Checking the location of the program files and launching the program.
#>

param(
Expand Down
14 changes: 11 additions & 3 deletions Public/Start-cURLDownload.ps1
Original file line number Diff line number Diff line change
@@ -1,18 +1,26 @@
function Start-cURLDownload() {
<#
.SYNOPSIS
Downloading data.
.DESCRIPTION
Downloading data using cURL.
.PARAMETER URL
URL to the data to be downloaded.
.EXAMPLE
Start-cURLDownload -URL 'https://mirror.yandex.ru/debian-cd/current/amd64/iso-cd/debian-12.2.0-amd64-netinst.iso'
#>

param(
[Parameter(Mandatory)][Alias('URL')][string[]]$URL
)

$URL | ForEach-Object {
$Param = @('--location') # If the server reports that the requested page has moved to a different location.
$Param += @('--remote-name') # Write output to a local file named like the remote file we get.
$Param += @("${_}") # Input URL.
$Param = @('--location') # If the server reports that the requested page has moved to a different location.
$Param += @('--remote-name') # Write output to a local file named like the remote file we get.
$Param += @("${_}") # Input URL.

& $(Start-cURL) $Param
}
Expand Down

0 comments on commit b1d7298

Please sign in to comment.