jborean93 / PSToml

PowerShell TOML Parser and Writer
MIT License
44 stars 6 forks source link

Import/Export-TOML #3

Open StartAutomating opened 1 year ago

StartAutomating commented 1 year ago

@jborean93 Cool module!

I'd love to see an Import/Export-TOML

The primary reason for this is pure user annoyance (how many times have you wished for an Export-JSON?).

The secondary reason is being able to use this in commands that support auto-detected export

e.g.

$extension = @($outputPath -split '\.')[-1]
$exporter = $executionContext.SessionState.InvokeCommand.GetCommand("Export-$Extension", 'Function, Alias, Cmdlet')
if ($exporter) {
    $inputObject | & $exporter $OutputPath
}

I'm happy to help out with implementation if you'd like, just let me know.

jborean93 commented 1 year ago

I see no issue with adding such cmdlets, I probably won't do the work myself but I can certain review a PR that does have them. In saying that I would expect to see

Tonic8 commented 8 months ago

Hello StartAutomating

you can use create a function : get-content ImportFile.toml | ConvertFrom-Toml | ConvertTo-Toml -Depth 10 | add-content ExportFile.toml