Skip to content

Commit

Permalink
Add ConvertFrom-TextTable cmdlet (#33)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
JamesWTruher authored Jun 28, 2023
1 parent 5f8cf47 commit ca2b0b1
Show file tree
Hide file tree
Showing 27 changed files with 1,886 additions and 45 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ out/
*.nupkg
project.lock.json
.DS_Store

Microsoft.PowerShell.TextUtility.xml
# VSCode directories that are not at the repository root
/**/.vscode/
26 changes: 26 additions & 0 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ param (
[switch]
$signed,

[Parameter(ParameterSetName="package")]
[Parameter(ParameterSetName="test")]
[switch]
$test,
Expand All @@ -43,6 +44,7 @@ $moduleFileManifest = @(

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

#
function Get-ModuleInfo {
Expand Down Expand Up @@ -90,6 +92,25 @@ function Export-Module
}
}

function Test-Module {
try {
$PSVersionTable | Out-String -Stream | Write-Verbose -Verbose
$pesterInstallations = Get-Module -ListAvailable -Name Pester
if ($pesterInstallations.Version -notcontains "4.10.1") {
Install-Module -Name Pester -RequiredVersion 4.10.1 -Force -Scope CurrentUser
}
$importTarget = "Import-Module ${PSScriptRoot}/out/${ModuleName}"
$importPester = "Import-Module Pester -Max 4.10.1"
$invokePester = "Invoke-Pester -OutputFormat NUnitXml -EnableExit -OutputFile ../Microsoft.PowerShell.TextUtility.xml"
$command = "${importTarget}; ${importPester}; ${invokePester}"
Push-Location $testRoot
pwsh -noprofile -command $command
}
finally {
Pop-Location
}
}

try {
Push-Location "$PSScriptRoot/src/code"
$script:moduleInfo = Get-ModuleInfo
Expand All @@ -112,6 +133,9 @@ try {
}

if ($Test) {
Test-Module

<#
$script = [ScriptBlock]::Create("try {
Import-Module '${repoRoot}/out/${moduleName}/'
Import-Module -Name Pester -Max 4.99
Expand All @@ -122,6 +146,8 @@ try {
Pop-Location
}")
pwsh -c $script
#>
return
}

if ($Package) {
Expand Down
7 changes: 3 additions & 4 deletions src/Microsoft.PowerShell.TextUtility.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

@{
RootModule = '.\Microsoft.PowerShell.TextUtility.dll'
ModuleVersion = '0.1.0'
ModuleVersion = '0.5.0'
CompatiblePSEditions = @('Desktop', 'Core')
GUID = '5cb64356-cd04-4a18-90a4-fa4072126155'
Author = 'Microsoft Corporation'
Expand All @@ -13,14 +13,13 @@
PowerShellVersion = '5.1'
FormatsToProcess = @('Microsoft.PowerShell.TextUtility.format.ps1xml')
CmdletsToExport = @(
'Compare-Text','ConvertFrom-Base64','ConvertTo-Base64'
'Compare-Text','ConvertFrom-Base64','ConvertTo-Base64',"ConvertFrom-TextTable"
)
PrivateData = @{
PSData = @{
LicenseUri = 'https://github.com/PowerShell/TextUtility/blob/main/LICENSE'
ProjectUri = 'https://github.com/PowerShell/TextUtility'
ReleaseNotes = 'Initial release'
Prerelease = 'Preview1'
ReleaseNotes = 'Second pre-release'
}
}

Expand Down
3 changes: 3 additions & 0 deletions src/code/Microsoft.PowerShell.TextUtility.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
<PackageReference Include="PowerShellStandard.Library" Version="5.1.0-*">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="System.Text.Json" Version="6.0.6" >
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
Expand Down
Loading

0 comments on commit ca2b0b1

Please sign in to comment.