feat(pwsh): Windows Migration and optimize powershell scripts

This commit is contained in:
js0ny 2024-12-01 07:02:12 +00:00
parent 567c8d1b3b
commit 8306264bdb
12 changed files with 141 additions and 133 deletions

9
scripts/Completions.ps1 Normal file
View file

@ -0,0 +1,9 @@
function Invoke-Completion {
param ([string]$command)
switch ($command) {
'docker' { docker completion powershell | Out-String | Invoke-Expression }
'git' { Import-Module Posh-Git }
'hugo' { hugo completion powershell | Out-String | Invoke-Expression }
'pip' { pip completion --powershell | Out-String | Invoke-Expression }
}
}

17
scripts/Scripts.ps1 Normal file
View file

@ -0,0 +1,17 @@
function CsvToMarkdown {
param( [string]$csv)
$counter = 0
$column = $csv.Split("`n")[0].Split(",").Length
$aHeader = " --- |"
$header = "|" + $aHeader * $column
$csv.replace(",", " | ").Split("`n") | ForEach-Object {
if ($counter -eq 0) {
Write-Output "| $_ |"
$counter++
Write-Output $header
}
else {
Write-Output "| $_ |"
}
}
}