print list commands as tables

This commit is contained in:
2025-05-25 15:07:13 +01:00
parent 7a2765f72c
commit 12dfab5642
12 changed files with 180 additions and 22 deletions

View File

@@ -5,6 +5,7 @@ import (
"slices"
"github.com/andreykaipov/goobs/api/requests/config"
"github.com/aquasecurity/table"
)
// ProfileCmd provides commands to manage profiles in OBS Studio.
@@ -26,10 +27,20 @@ func (cmd *ProfileListCmd) Run(ctx *context) error {
return err
}
for _, profile := range profiles.Profiles {
fmt.Fprintln(ctx.Out, profile)
}
t := table.New(ctx.Out)
t.SetPadding(3)
t.SetAlignment(table.AlignLeft, table.AlignCenter)
t.SetHeaders("Profile Name", "Current")
for _, profile := range profiles.Profiles {
var enabledMark string
if profile == profiles.CurrentProfileName {
enabledMark = getEnabledMark(true)
}
t.AddRow(profile, enabledMark)
}
t.Render()
return nil
}