2023-11-19 17:42:17
This commit is contained in:
parent
3f2be9fb9b
commit
c7ee15e9ae
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
|
|
@ -1,8 +1,19 @@
|
|||
function Copy-Data() {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Copying data.
|
||||
|
||||
.DESCRIPTION
|
||||
Copying data using the 'Copy-Item' cmdlet with '-LiteralPath'.
|
||||
|
||||
.PARAMETER SRC
|
||||
Source data.
|
||||
|
||||
.PARAMETER DST
|
||||
Destination.
|
||||
|
||||
.EXAMPLE
|
||||
Copy-Data -SRC 'C:\File.TXT' -DST 'D:\File.TXT'
|
||||
#>
|
||||
|
||||
param(
|
||||
|
|
|
@ -1,8 +1,19 @@
|
|||
function Move-Data() {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Moving data.
|
||||
|
||||
.DESCRIPTION
|
||||
Moving data using the 'Move-Item' cmdlet with '-LiteralPath'.
|
||||
|
||||
.PARAMETER SRC
|
||||
Source data.
|
||||
|
||||
.PARAMETER DST
|
||||
Destination.
|
||||
|
||||
.EXAMPLE
|
||||
Copy-Data -SRC 'C:\File.TXT' -DST 'D:\File.TXT'
|
||||
#>
|
||||
|
||||
param(
|
||||
|
|
|
@ -1,8 +1,27 @@
|
|||
function New-Data() {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Creating data.
|
||||
|
||||
.DESCRIPTION
|
||||
Creating data using the 'New-Item' cmdlet.
|
||||
|
||||
.PARAMETER Type
|
||||
The type of data to be created:
|
||||
'D' | Directory.
|
||||
'F' | File.
|
||||
|
||||
.PARAMETER Path
|
||||
The path of the data being created.
|
||||
|
||||
.PARAMETER Name
|
||||
The name of the data to be created.
|
||||
|
||||
.PARAMETER Action
|
||||
Action when creating data.
|
||||
|
||||
.EXAMPLE
|
||||
New-Data -Type 'F' -Path 'C:\DATA' -Name 'File.TXT'
|
||||
#>
|
||||
|
||||
param(
|
||||
|
|
|
@ -1,8 +1,16 @@
|
|||
function Remove-Data() {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Deleting data.
|
||||
|
||||
.DESCRIPTION
|
||||
Removing data using the 'Remove-Item' cmdlet with '-LiteralPath'.
|
||||
|
||||
.PARAMETER Path
|
||||
Path to the data to be deleted.
|
||||
|
||||
.EXAMPLE
|
||||
Remove-Data -Path 'C:\File.TXT'
|
||||
#>
|
||||
|
||||
param(
|
||||
|
|
|
@ -1,8 +1,21 @@
|
|||
function Test-Data() {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Checking data.
|
||||
|
||||
.DESCRIPTION
|
||||
Checking data using the 'Test-Path' cmdlet with '-LiteralPath'.
|
||||
|
||||
.PARAMETER Type
|
||||
Type of data being checked:
|
||||
'D' | Container.
|
||||
'F' | Leaf.
|
||||
|
||||
.PARAMETER Path
|
||||
Path to the data being checked.
|
||||
|
||||
.EXAMPLE
|
||||
Test-Data -Type 'F' -Path 'C:\File.TXT'
|
||||
#>
|
||||
|
||||
param(
|
||||
|
|
|
@ -1,8 +1,16 @@
|
|||
function Test-Module() {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Checking the module.
|
||||
|
||||
.DESCRIPTION
|
||||
Checking that the module is loaded correctly.
|
||||
|
||||
.PARAMETER Names
|
||||
Names of the modules being checked.
|
||||
|
||||
.EXAMPLE
|
||||
Test-Module -Names 'Module.Name01', 'Module.Name02', 'Module.Name03'
|
||||
#>
|
||||
|
||||
param(
|
||||
|
|
|
@ -1,8 +1,29 @@
|
|||
function Write-Msg() {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Display messages.
|
||||
|
||||
.DESCRIPTION
|
||||
Display messages depending on their type.
|
||||
|
||||
.PARAMETER Type
|
||||
The type of message to be displayed:
|
||||
'HL' | Write-Host (Title).
|
||||
'I' | Write-Information.
|
||||
'W' | Write-Warning.
|
||||
'E' | Write-Error.
|
||||
|
||||
.PARAMETER Message
|
||||
Contents of the message to be displayed.
|
||||
|
||||
.PARAMETER Action
|
||||
Action when a message is displayed.
|
||||
|
||||
.EXAMPLE
|
||||
Write-Msg -Type 'HL' -Message 'Title message'
|
||||
|
||||
.EXAMPLE
|
||||
Write-Msg -Type 'E' -Message 'File not found!' -Action 'Stop'
|
||||
#>
|
||||
|
||||
param(
|
||||
|
|
Loading…
Reference in New Issue