use tablewriter to format the output

Signed-off-by: jason yang <jasonyangshadow@gmail.com>
This commit is contained in:
jason yang
2023-03-23 02:44:59 +00:00
parent ceb7859a85
commit 522c3478fb
14 changed files with 144 additions and 51 deletions

View File

@@ -1,8 +1,9 @@
package list
import (
"fmt"
"strings"
"github.com/hpcng/warewulf/internal/app/wwctl/helper"
apiprofile "github.com/hpcng/warewulf/internal/pkg/api/profile"
"github.com/hpcng/warewulf/internal/pkg/api/routes/wwapiv1"
@@ -18,8 +19,13 @@ func CobraRunE(cmd *cobra.Command, args []string) (err error) {
if err != nil {
return
}
for _, str := range profileInfo.Output {
fmt.Printf("%s\n", str)
if len(profileInfo.Output) > 0 {
ph := helper.NewPrintHelper(strings.Split(profileInfo.Output[0], "="))
for _, val := range profileInfo.Output[1:] {
ph.Append(strings.Split(val, "="))
}
ph.Render()
}
return
}