Skip to content

Commit

Permalink
implement converter function
Browse files Browse the repository at this point in the history
include converted date in return data
  • Loading branch information
doneill committed Dec 26, 2023
1 parent 2b4c936 commit 5362295
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions cmd/open.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"os"

"github.com/doneill/er-cli/data"
"github.com/doneill/er-cli/utils"
"github.com/olekukonko/tablewriter"
"github.com/spf13/cobra"
)
Expand Down Expand Up @@ -60,7 +61,7 @@ func open(file string) {
events := data.SelectPendingSyncEvents()

table := tablewriter.NewWriter(os.Stdout)
table.SetHeader([]string{"ID", "User", "Title"})
table.SetHeader([]string{"ID", "User", "Title", "Created At"})

for _, event := range events {
if event.ProfileID != 0 {
Expand All @@ -70,7 +71,8 @@ func open(file string) {
user := data.SelectUser()
users = append(users, user.Username)
}
table.Append([]string{fmt.Sprintf("%d", event.ID), users[len(users)-1], event.Title})
isoTime := utils.ConvertUnixToIso(event.CreatedAt)
table.Append([]string{fmt.Sprintf("%d", event.ID), users[len(users)-1], event.Title, isoTime})
}
table.Render()
default:
Expand Down

0 comments on commit 5362295

Please sign in to comment.