Skip to content
This repository was archived by the owner on Mar 5, 2025. It is now read-only.

Commit ca2b0b1

Browse files
authored
Add ConvertFrom-TextTable cmdlet (#33)
* Initial commit of text table converter with tests. * Address feedback in PR #29 (now closed). Change name to ConvertFrom-TextTable. Remove Preview tag (since we're still a 0.x version). Change Convert parameter To ConvertPropertyValue, Typename to TypeName.
1 parent 5f8cf47 commit ca2b0b1

27 files changed

+1886
-45
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ out/
55
*.nupkg
66
project.lock.json
77
.DS_Store
8-
8+
Microsoft.PowerShell.TextUtility.xml
99
# VSCode directories that are not at the repository root
1010
/**/.vscode/

build.ps1

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ param (
1919
[switch]
2020
$signed,
2121

22+
[Parameter(ParameterSetName="package")]
2223
[Parameter(ParameterSetName="test")]
2324
[switch]
2425
$test,
@@ -43,6 +44,7 @@ $moduleFileManifest = @(
4344

4445
$moduleName = "Microsoft.PowerShell.TextUtility"
4546
$repoRoot = git rev-parse --show-toplevel
47+
$testRoot = "${repoRoot}/test"
4648

4749
#
4850
function Get-ModuleInfo {
@@ -90,6 +92,25 @@ function Export-Module
9092
}
9193
}
9294

95+
function Test-Module {
96+
try {
97+
$PSVersionTable | Out-String -Stream | Write-Verbose -Verbose
98+
$pesterInstallations = Get-Module -ListAvailable -Name Pester
99+
if ($pesterInstallations.Version -notcontains "4.10.1") {
100+
Install-Module -Name Pester -RequiredVersion 4.10.1 -Force -Scope CurrentUser
101+
}
102+
$importTarget = "Import-Module ${PSScriptRoot}/out/${ModuleName}"
103+
$importPester = "Import-Module Pester -Max 4.10.1"
104+
$invokePester = "Invoke-Pester -OutputFormat NUnitXml -EnableExit -OutputFile ../Microsoft.PowerShell.TextUtility.xml"
105+
$command = "${importTarget}; ${importPester}; ${invokePester}"
106+
Push-Location $testRoot
107+
pwsh -noprofile -command $command
108+
}
109+
finally {
110+
Pop-Location
111+
}
112+
}
113+
93114
try {
94115
Push-Location "$PSScriptRoot/src/code"
95116
$script:moduleInfo = Get-ModuleInfo
@@ -112,6 +133,9 @@ try {
112133
}
113134

114135
if ($Test) {
136+
Test-Module
137+
138+
<#
115139
$script = [ScriptBlock]::Create("try {
116140
Import-Module '${repoRoot}/out/${moduleName}/'
117141
Import-Module -Name Pester -Max 4.99
@@ -122,6 +146,8 @@ try {
122146
Pop-Location
123147
}")
124148
pwsh -c $script
149+
#>
150+
return
125151
}
126152

127153
if ($Package) {

src/Microsoft.PowerShell.TextUtility.psd1

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
@{
55
RootModule = '.\Microsoft.PowerShell.TextUtility.dll'
6-
ModuleVersion = '0.1.0'
6+
ModuleVersion = '0.5.0'
77
CompatiblePSEditions = @('Desktop', 'Core')
88
GUID = '5cb64356-cd04-4a18-90a4-fa4072126155'
99
Author = 'Microsoft Corporation'
@@ -13,14 +13,13 @@
1313
PowerShellVersion = '5.1'
1414
FormatsToProcess = @('Microsoft.PowerShell.TextUtility.format.ps1xml')
1515
CmdletsToExport = @(
16-
'Compare-Text','ConvertFrom-Base64','ConvertTo-Base64'
16+
'Compare-Text','ConvertFrom-Base64','ConvertTo-Base64',"ConvertFrom-TextTable"
1717
)
1818
PrivateData = @{
1919
PSData = @{
2020
LicenseUri = 'https://github.com/PowerShell/TextUtility/blob/main/LICENSE'
2121
ProjectUri = 'https://github.com/PowerShell/TextUtility'
22-
ReleaseNotes = 'Initial release'
23-
Prerelease = 'Preview1'
22+
ReleaseNotes = 'Second pre-release'
2423
}
2524
}
2625

src/code/Microsoft.PowerShell.TextUtility.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
<PackageReference Include="PowerShellStandard.Library" Version="5.1.0-*">
1818
<PrivateAssets>all</PrivateAssets>
1919
</PackageReference>
20+
<PackageReference Include="System.Text.Json" Version="6.0.6" >
21+
<PrivateAssets>all</PrivateAssets>
22+
</PackageReference>
2023
</ItemGroup>
2124

2225
<ItemGroup>

0 commit comments

Comments
 (0)