Skip to content

Conversation

@kevinholtkamp
Copy link
Contributor

Added a new switch parameter for ignoring empty sections in Get-IniContent, similar to the IgnoreComments switch

$ToRemove = [System.Collections.ArrayList]@()
foreach($Section in $ini.Keys){
if(($ini[$Section]).Count -eq 0){
$ToRemove.Add($Section)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this line produces console output with the index of the array where the item was added to (see screenshot).
prefix this line with $null = to capture (and hide) this write to stdout

image

Copy link
Owner

@lipkau lipkau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a test for this

@lipkau
Copy link
Owner

lipkau commented Mar 7, 2025

Hello @kevinholtkamp

Sorry for taking this long to get back to you.

There is a branch for release/4.0.
The branch includes incompatible changes to your PR, like renaming files.

If you are still active in this repo, I invite you to rebase/redo your implementation.
If not, I will merge your PR and adapt it manually to the new branch - this would not give you credit for your changes.

Add -IgnoreEmptySections parameter to Import-Ini.ps1
@lipkau lipkau changed the base branch from master to release/4.0 March 7, 2025 14:39
@lipkau lipkau merged commit 338d9a0 into lipkau:release/4.0 Mar 7, 2025
1 check failed
lipkau pushed a commit that referenced this pull request Mar 13, 2025
Add -IgnoreEmptySections parameter to Import-Ini.ps1
lipkau pushed a commit that referenced this pull request Mar 13, 2025
Add -IgnoreEmptySections parameter to Import-Ini.ps1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants