mirror of
https://gitea.com/gitea/tea.git
synced 2026-10-26 11:01:25 +01:00
refactor(auth): write piped auth status through writeTable
The tab-separated status rows no longer use the terminal.Row shim; the expiry is a time cell, so piped output keeps RFC3339 timestamps. Signed-off-by: bircni <bircni@icloud.com>
This commit is contained in:
1 file changed
+5
-7
@@ -561,18 +561,16 @@ func (a *application) environmentStatus(ctx context.Context, s settings.Snapshot
|
|||||||
func (a *application) writeAuthStatus(cmd *cobra.Command, rows []authStatusRow) error {
|
func (a *application) writeAuthStatus(cmd *cobra.Command, rows []authStatusRow) error {
|
||||||
d := a.display()
|
d := a.display()
|
||||||
if !d.TTY {
|
if !d.TTY {
|
||||||
cells := make([][]terminal.Cell, len(rows))
|
return writeTable(a, cmd, rows, listSpec[authStatusRow]{Row: func(row authStatusRow) []terminal.Cell {
|
||||||
for i, row := range rows {
|
verified, expires := "", terminal.Cell{}
|
||||||
verified, expires := "", ""
|
|
||||||
if row.Verified != nil {
|
if row.Verified != nil {
|
||||||
verified = fmt.Sprint(*row.Verified)
|
verified = fmt.Sprint(*row.Verified)
|
||||||
}
|
}
|
||||||
if row.ExpiresAt != nil {
|
if row.ExpiresAt != nil {
|
||||||
expires = terminal.Timestamp(*row.ExpiresAt)
|
expires.Time = *row.ExpiresAt
|
||||||
}
|
}
|
||||||
cells[i] = terminal.Row(row.Host, row.User, fmt.Sprint(row.Active), row.Method, row.Store, fmt.Sprint(row.Available), verified, expires, row.Error)
|
return []terminal.Cell{{Text: row.Host}, {Text: row.User}, {Text: fmt.Sprint(row.Active)}, {Text: row.Method}, {Text: row.Store}, {Text: fmt.Sprint(row.Available)}, {Text: verified}, expires, {Text: row.Error}}
|
||||||
}
|
}}, listPage{Number: 1})
|
||||||
return a.writeHuman(cmd, terminal.Table(nil, cells, d))
|
|
||||||
}
|
}
|
||||||
byHost := map[string][]authStatusRow{}
|
byHost := map[string][]authStatusRow{}
|
||||||
for _, row := range rows {
|
for _, row := range rows {
|
||||||
|
|||||||
Reference in new issue
Block a user