Should we address the repeated calls of New-Item in many pre_install/post_install scripts to keep them DRY? 😄
Most of them run Test-Path, display a message and create a directory or a file with no content.
These scripts could be cleanup up and be more readable in JSON format by using some simple functions like:
New-Directory -Path "$dir\conf.d" -Message "Creating 'conf.d' directory"
New-JsonFile -Path "$dir\bla.json" -Message "Creating 'bla.json' for ..." -Content "{ "bla": "blubb" }" -Encoding "utf-8"
New-EmptyFile -Path "$dir\empty.ini"
Should we address the repeated calls of
New-Itemin manypre_install/post_installscripts to keep them DRY? 😄Most of them run
Test-Path, display a message and create a directory or a file with no content.These scripts could be cleanup up and be more readable in JSON format by using some simple functions like: