Fix excessive line spacing issue when listing nodes

Signed-off-by: xu yang <xyang@ciq.com>
This commit is contained in:
xu yang
2024-09-24 04:08:30 +00:00
committed by Jonathon Anderson
parent d24a92965f
commit aa8282ad10
9 changed files with 78 additions and 72 deletions

View File

@@ -32,11 +32,12 @@ func CobraRunE(vars *variables) func(cmd *cobra.Command, args []string) (err err
if vars.showYaml || vars.showJson {
wwlog.Info(profileInfo.Output[0])
} else {
ph := helper.NewPrintHelper(strings.Split(profileInfo.Output[0], ":=:"))
ph := helper.New(strings.Split(profileInfo.Output[0], ":=:"))
for _, val := range profileInfo.Output[1:] {
ph.Append(strings.Split(val, ":=:"))
}
ph.Render()
wwlog.Info(ph.String())
}
}
return

View File

@@ -222,11 +222,12 @@ nodes:
}
func verifyOutput(t *testing.T, baseCmd *cobra.Command, content string) {
baseCmd.SetOut(nil)
baseCmd.SetErr(nil)
stdoutR, stdoutW, _ := os.Pipe()
oriout := os.Stdout
os.Stdout = stdoutW
wwlog.SetLogWriter(os.Stdout)
baseCmd.SetOut(os.Stdout)
baseCmd.SetErr(os.Stdout)
err := baseCmd.Execute()
assert.NoError(t, err)