Skip to content

Commit

Permalink
chore: cleanup pgs cli
Browse files Browse the repository at this point in the history
  • Loading branch information
neurosnap committed Apr 10, 2024
1 parent 22637b8 commit f940e39
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 29 deletions.
2 changes: 1 addition & 1 deletion imgs/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func NewConfigSite() *shared.ConfigSite {
MinioUser: minioUser,
MinioPass: minioPass,
Space: "imgs",
AllowedExt: []string{".jpg", ".jpeg", ".png", ".gif", ".webp", ".svg", ".ico"},
AllowedExt: []string{".jpg", ".jpeg", ".png", ".gif", ".webp", ".svg", ".ico"},
Logger: shared.CreateLogger(debug == "1"),
}

Expand Down
35 changes: 7 additions & 28 deletions pgs/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,6 @@ import (
"github.com/picosh/pico/tui/common"
)

func styleRows(styles common.Styles) func(row, col int) lipgloss.Style {
return func(row, col int) lipgloss.Style {
if row == 0 {
return styles.CliHeader
}

even := row%2 == 0
if even {
return styles.CliPadding.Copy().Foreground(lipgloss.Color("245"))
}
return styles.CliPadding.Copy().Foreground(lipgloss.Color("252"))
}
}

func projectTable(styles common.Styles, projects []*db.Project) *table.Table {
headers := []string{
"Name",
Expand Down Expand Up @@ -58,17 +44,14 @@ func projectTable(styles common.Styles, projects []*db.Project) *table.Table {
}

t := table.New().
Border(lipgloss.NormalBorder()).
BorderStyle(styles.CliBorder).
Headers(headers...).
Rows(data...).
StyleFunc(styleRows(styles))
Rows(data...)
return t
}

func getHelpText(styles common.Styles, userName string) string {
helpStr := "Commands: [help, stats, ls, rm, link, unlink, prune, retain, depends, acl]\n\n"
helpStr += styles.Note.Render("NOTICE:") + " *must* append with `--write` for the changes to persist.\n\n"
helpStr := "Commands: [help, stats, ls, rm, link, unlink, prune, retain, depends, acl]\n"
helpStr += styles.Note.Render("NOTICE:") + " *must* append with `--write` for the changes to persist.\n"

projectName := "projA"
headers := []string{"Cmd", "Description"}
Expand Down Expand Up @@ -116,11 +99,9 @@ func getHelpText(styles common.Styles, userName string) string {
}

t := table.New().
Border(lipgloss.NormalBorder()).
BorderStyle(styles.CliBorder).
Border(lipgloss.HiddenBorder()).
Headers(headers...).
Rows(data...).
StyleFunc(styleRows(styles))
Rows(data...)

helpStr += t.String()
return helpStr
Expand Down Expand Up @@ -271,11 +252,9 @@ func (c *Cmd) stats(cfgMaxSize uint64) error {
}

t := table.New().
Border(lipgloss.NormalBorder()).
BorderStyle(c.Styles.CliBorder).
Border(lipgloss.HiddenBorder()).
Headers(headers...).
Rows(data).
StyleFunc(styleRows(c.Styles))
Rows(data)
c.output(t.String())

return nil
Expand Down
5 changes: 5 additions & 0 deletions projects.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
docs
test
tester
ui

0 comments on commit f940e39

Please sign in to comment.