Closed omiossec closed 5 years ago
What terminal app/host do you use? Also what powershell version?
I use PowerShell core 6.2.1 on Windows
Here's the script I use to reproduce
$ErrorActionPreference = "Stop"
Import-Module Requirements
$AppPath = "c:\work\dotnetbot1\"
$WebConfigRequirements = @(
@{
name = "AppFolder"
describe = "Create a folder for the app"
test = {
test-path -Path $AppPath
}
set = {
new-item -path $AppPath -ItemType Directory
}
},
@{
name = "configfile"
describe = "Create the json config File"
test = {
test-path -Path "$($AppPath)config.json"
}
set = {
new-item -Path "$($AppPath)config.json"
}
}
)
$WebConfigRequirements | Invoke-Requirement | Format-Checklist
As you can see the first time it works but for the second time no newline
it's the same with Windows PowerShell 5.1 on Windows 10
If you had a requirement
@{
name = "configfile-yaml"
describe = "Create the yaml config File"
test = {
test-path -Path "$($AppPath)config.yaml"
}
set = {
new-item -Path "$($AppPath)config.yaml"
}
}
it's worst
I use the version 2.2.2 of the module
My top guess right now is that Format-Checklist
has a bug where it only writes the green checkmark line if it Set
s, so the Test
text is never overwritten with a terminating newline.
I can look into this tonight.
So I confirmed my hypothesis, but I also identified more scenarios that are unaccounted for in the current implementation. I will have to determine all the problematic scenarios and probably rewrite much of Format-Checklist
.
Had a breakthrough and ended up only needing to add one more event handler. This should be resolved now.
While working on some examples with Requirements I have noticed that output for the test state in on the same line
I will make some investigation on it