2023-11-19 17:42:17
This commit is contained in:
parent
3f2be9fb9b
commit
c7ee15e9ae
8 changed files with 98 additions and 7 deletions
|
@ -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)
|
$CurrentManifest = (Test-ModuleManifest $ModuleManifest)
|
||||||
|
|
||||||
$Aliases = @()
|
$Aliases = @()
|
||||||
$PrivateFunctions = (Get-ChildItem -Path (Join-Path $PSScriptRoot 'Private') | 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'})
|
$PublicFunctions = (Get-ChildItem -Path (Join-Path $PSScriptRoot 'Public') | Where-Object { $_.Extension -eq '.ps1' })
|
||||||
|
|
||||||
(@($PrivateFunctions) + @($PublicFunctions)) | ForEach-Object {
|
(@($PrivateFunctions) + @($PublicFunctions)) | ForEach-Object {
|
||||||
try {
|
try {
|
||||||
|
@ -25,10 +25,10 @@ $PublicFunctions = (Get-ChildItem -Path (Join-Path $PSScriptRoot 'Public') | Whe
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$FunctionsAdded = ($PublicFunctions | Where-Object {$_.BaseName -notin $CurrentManifest.ExportedFunctions.Keys})
|
$FunctionsAdded = ($PublicFunctions | Where-Object { $_.BaseName -notin $CurrentManifest.ExportedFunctions.Keys })
|
||||||
$FunctionsRemoved = ($CurrentManifest.ExportedFunctions.Keys | Where-Object {$_ -notin $PublicFunctions.BaseName})
|
$FunctionsRemoved = ($CurrentManifest.ExportedFunctions.Keys | Where-Object { $_ -notin $PublicFunctions.BaseName })
|
||||||
$AliasesAdded = ($Aliases | Where-Object {$_ -notin $CurrentManifest.ExportedAliases.Keys})
|
$AliasesAdded = ($Aliases | Where-Object { $_ -notin $CurrentManifest.ExportedAliases.Keys })
|
||||||
$AliasesRemoved = ($CurrentManifest.ExportedAliases.Keys | Where-Object {$_ -notin $Aliases})
|
$AliasesRemoved = ($CurrentManifest.ExportedAliases.Keys | Where-Object { $_ -notin $Aliases })
|
||||||
|
|
||||||
if ($FunctionsAdded -or $FunctionsRemoved -or $AliasesAdded -or $AliasesRemoved) {
|
if ($FunctionsAdded -or $FunctionsRemoved -or $AliasesAdded -or $AliasesRemoved) {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -1,8 +1,19 @@
|
||||||
function Copy-Data() {
|
function Copy-Data() {
|
||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
|
Copying data.
|
||||||
|
|
||||||
.DESCRIPTION
|
.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(
|
param(
|
||||||
|
|
|
@ -1,8 +1,19 @@
|
||||||
function Move-Data() {
|
function Move-Data() {
|
||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
|
Moving data.
|
||||||
|
|
||||||
.DESCRIPTION
|
.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(
|
param(
|
||||||
|
|
|
@ -1,8 +1,27 @@
|
||||||
function New-Data() {
|
function New-Data() {
|
||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
|
Creating data.
|
||||||
|
|
||||||
.DESCRIPTION
|
.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(
|
param(
|
||||||
|
|
|
@ -1,8 +1,16 @@
|
||||||
function Remove-Data() {
|
function Remove-Data() {
|
||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
|
Deleting data.
|
||||||
|
|
||||||
.DESCRIPTION
|
.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(
|
param(
|
||||||
|
|
|
@ -1,8 +1,21 @@
|
||||||
function Test-Data() {
|
function Test-Data() {
|
||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
|
Checking data.
|
||||||
|
|
||||||
.DESCRIPTION
|
.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(
|
param(
|
||||||
|
|
|
@ -1,8 +1,16 @@
|
||||||
function Test-Module() {
|
function Test-Module() {
|
||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
|
Checking the module.
|
||||||
|
|
||||||
.DESCRIPTION
|
.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(
|
param(
|
||||||
|
|
|
@ -1,8 +1,29 @@
|
||||||
function Write-Msg() {
|
function Write-Msg() {
|
||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
|
Display messages.
|
||||||
|
|
||||||
.DESCRIPTION
|
.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(
|
param(
|
||||||
|
|
Loading…
Reference in a new issue