-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
111 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
|
||
- Feedback, wishes and suggestions can be sent by email. | ||
- Constructive criticism, bug descriptions and other reports are welcome. | ||
- Email: [[email protected]](mailto:[email protected]) / [[email protected]](mailto:[email protected]). | ||
- Email: [[email protected]](mailto:[email protected]). | ||
|
||
## Sources | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,96 +1,136 @@ | ||
<#PSScriptInfo | ||
.VERSION 0.1.0 | ||
.GUID 58655ac6-8750-4397-a15f-29f9e18e257d | ||
.AUTHOR Kitsune Solar | ||
.AUTHOREMAIL [email protected] | ||
.COMPANYNAME iHub.TO | ||
.COPYRIGHT 2023 Kitsune Solar. All rights reserved. | ||
.LICENSEURI https://choosealicense.com/licenses/mit/ | ||
.PROJECTURI | ||
#> | ||
|
||
function Write-Msg() { | ||
<# | ||
.SYNOPSIS | ||
Message function. | ||
.DESCRIPTION | ||
#> | ||
|
||
.PARAMETER Type | ||
Message type. | ||
Alias: '-T'. | ||
param ( | ||
[Alias('T')][string]$Type, | ||
[Alias('M')][string]$Message, | ||
[Alias('A')][string]$Action = 'Continue' | ||
) | ||
|
||
.PARAMETER Message | ||
Message body. | ||
Alias: '-M'. | ||
switch ($Type) { | ||
'HL' { Write-Host "${NL}--- ${Message}".ToUpper() -ForegroundColor Blue } | ||
'I' { Write-Information -MessageData "${Message}" -InformationAction "${Action}" } | ||
'W' { Write-Warning -Message "${Message}" -WarningAction "${Action}" } | ||
'E' { Write-Error -Message "${Message}" -ErrorAction "${Action}" } | ||
default { Write-Host "${Message}" } | ||
} | ||
} | ||
|
||
.PARAMETER Action | ||
Action type. | ||
Alias: '-A'. | ||
function Test-Module() { | ||
<# | ||
.SYNOPSIS | ||
.EXAMPLE | ||
Write-Msg -T 'E' -M "'curl.exe' not found!" -A 'Stop' | ||
.DESCRIPTION | ||
#> | ||
|
||
.LINK | ||
Package Store: https://github.com/pkgstore | ||
Param( | ||
[Parameter(Mandatory)][Alias('N')][string[]]$Names | ||
) | ||
|
||
.NOTES | ||
Author: Kitsune Solar <[email protected]> | ||
#> | ||
$Names | ForEach-Object { | ||
if (-not (Get-Module -ListAvailable -Name "${_}")) { | ||
Write-Error -Message "Module '${_}' not installed!" -ErrorAction 'Stop' | ||
} | ||
} | ||
} | ||
|
||
function Test-Data() { | ||
<# | ||
.SYNOPSIS | ||
[CmdletBinding()] | ||
.DESCRIPTION | ||
#> | ||
|
||
param ( | ||
[Alias('T')] | ||
[string]${Type}, | ||
[Alias('T')][string]$Type, | ||
[Alias('P')][string]$Path | ||
) | ||
|
||
[Alias('M')] | ||
[string]${Message}, | ||
switch ($Type) { | ||
'D' { $Type = 'Container' } | ||
'F' { $Type = 'Leaf' } | ||
} | ||
|
||
[Alias('A')] | ||
[string]${Action} = 'Continue' | ||
Test-Path -LiteralPath "${Path}" -PathType "${Type}" | ||
} | ||
|
||
function New-Data() { | ||
<# | ||
.SYNOPSIS | ||
.DESCRIPTION | ||
#> | ||
|
||
param ( | ||
[Alias('T')][string]$Type, | ||
[Alias('P')][string]$Path, | ||
[Alias('N')][string]$Name, | ||
[Alias('A')][string]$Action = 'SilentlyContinue' | ||
) | ||
|
||
switch ( ${Type} ) { | ||
'HL' { | ||
Write-Host $( "${NL}--- ${Message}" ).ToUpper() -ForegroundColor Blue | ||
} | ||
'I' { | ||
Write-Information -MessageData "${Message}" -InformationAction "${Action}" | ||
} | ||
'W' { | ||
Write-Warning -Message "${Message}" -WarningAction "${Action}" | ||
} | ||
'E' { | ||
Write-Error -Message "${Message}" -ErrorAction "${Action}" | ||
} | ||
default { | ||
Write-Host "${Message}" | ||
} | ||
switch ($Type) { | ||
'D' { $Type = 'Directory' } | ||
'F' { $Type = 'File' } | ||
} | ||
|
||
New-Item -Path "${Path}" -Name "${Name}" -ItemType "${Type}" -ErrorAction "${Action}" | ||
} | ||
|
||
function Test-Module() { | ||
function Copy-Data() { | ||
<# | ||
.SYNOPSIS | ||
Checking if a PowerShell module is installed. | ||
.DESCRIPTION | ||
#> | ||
|
||
.PARAMETER Names | ||
Module names. | ||
Alias: '-N'. | ||
param ( | ||
[Alias('S')][string]$Src, | ||
[Alias('D')][string]$Dst | ||
) | ||
|
||
.EXAMPLE | ||
Test-Module -N 'PkgStore.Kernel' | ||
Copy-Item -LiteralPath "${Src}" -Destination "${Dst}" -Force | ||
} | ||
|
||
.LINK | ||
Package Store: https://github.com/pkgstore | ||
function Move-Data() { | ||
<# | ||
.SYNOPSIS | ||
.NOTES | ||
Author: Kitsune Solar <[email protected]> | ||
.DESCRIPTION | ||
#> | ||
|
||
[CmdletBinding()] | ||
param ( | ||
[Alias('S')][string]$Src, | ||
[Alias('D')][string]$Dst | ||
) | ||
|
||
Param( | ||
[Parameter(Mandatory)] | ||
[Alias('N')] | ||
[string[]]${Names} | ||
Move-Item -LiteralPath "${Src}" -Destination "${Dst}" -Force | ||
} | ||
|
||
function Remove-Data() { | ||
<# | ||
.SYNOPSIS | ||
.DESCRIPTION | ||
#> | ||
|
||
param ( | ||
[Alias('P')][string]$Path | ||
) | ||
|
||
ForEach ( ${N} in ${Names} ) { | ||
if ( -not ( Get-Module -ListAvailable -Name "${N}" ) ) { | ||
Write-Error -Message "Module '${N}' not installed!" -ErrorAction 'Stop' | ||
} | ||
} | ||
Remove-Item -LiteralPath "${Path}" -Force | ||
} |