mirror of
https://gitea.com/gitea/tea.git
synced 2026-10-26 19:11: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 {
|
||||
d := a.display()
|
||||
if !d.TTY {
|
||||
cells := make([][]terminal.Cell, len(rows))
|
||||
for i, row := range rows {
|
||||
verified, expires := "", ""
|
||||
return writeTable(a, cmd, rows, listSpec[authStatusRow]{Row: func(row authStatusRow) []terminal.Cell {
|
||||
verified, expires := "", terminal.Cell{}
|
||||
if row.Verified != nil {
|
||||
verified = fmt.Sprint(*row.Verified)
|
||||
}
|
||||
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 a.writeHuman(cmd, terminal.Table(nil, cells, d))
|
||||
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})
|
||||
}
|
||||
byHost := map[string][]authStatusRow{}
|
||||
for _, row := range rows {
|
||||
|
||||
Reference in new issue
Block a user