Skip to content

Commit

Permalink
2023-11-19 17:42:17
Browse files Browse the repository at this point in the history
  • Loading branch information
uidHUB committed Nov 19, 2023
1 parent 3f2be9f commit c7ee15e
Show file tree
Hide file tree
Showing 8 changed files with 98 additions and 7 deletions.
14 changes: 7 additions & 7 deletions PkgStore.Kernel.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
11 changes: 11 additions & 0 deletions Public/Copy-Data.ps1
Original file line number Diff line number Diff line change
@@ -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(
Expand Down
11 changes: 11 additions & 0 deletions Public/Move-Data.ps1
Original file line number Diff line number Diff line change
@@ -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(
Expand Down
19 changes: 19 additions & 0 deletions Public/New-Data.ps1
Original file line number Diff line number Diff line change
@@ -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(
Expand Down
8 changes: 8 additions & 0 deletions Public/Remove-Data.ps1
Original file line number Diff line number Diff line change
@@ -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(
Expand Down
13 changes: 13 additions & 0 deletions Public/Test-Data.ps1
Original file line number Diff line number Diff line change
@@ -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(
Expand Down
8 changes: 8 additions & 0 deletions Public/Test-Module.ps1
Original file line number Diff line number Diff line change
@@ -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(
Expand Down
21 changes: 21 additions & 0 deletions Public/Write-Msg.ps1
Original file line number Diff line number Diff line change
@@ -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(
Expand Down

0 comments on commit c7ee15e

Please sign in to comment.