address comments 2

This commit is contained in:
Shreyas Goenka 2023-06-05 15:07:08 +02:00
parent b048c8675d
commit 265e517126
No known key found for this signature in database
GPG Key ID: 92A07DF49CCB0622
2 changed files with 5 additions and 8 deletions

View File

@ -39,12 +39,6 @@ var lsCmd = &cobra.Command{
Long: `Lists files`,
Args: cobra.ExactArgs(1),
PreRunE: root.MustWorkspaceClient,
Annotations: map[string]string{
"template": cmdio.Heredoc(`
{{range .}}{{.Name}}
{{end}}
`),
},
RunE: func(cmd *cobra.Command, args []string) error {
ctx := cmd.Context()
@ -84,7 +78,10 @@ var lsCmd = &cobra.Command{
{{end}}
`))
}
return cmdio.Render(ctx, jsonDirEntries)
return cmdio.RenderWithTemplate(ctx, jsonDirEntries, cmdio.Heredoc(`
{{range .}}{{.Name}}
{{end}}
`))
},
}

View File

@ -88,7 +88,7 @@ func renderTemplate(w io.Writer, tmpl string, v any) error {
return string(b), nil
},
"pretty_date": func(t time.Time) string {
return t.UTC().Format("2006-01-02T15:04:05Z")
return t.Format("2006-01-02T15:04:05Z")
},
}).Parse(tmpl)
if err != nil {