Add more short column name alternatives similar to #228

This commit is contained in:
David Dworken 2024-08-11 11:26:52 -07:00
parent c45e5c0f55
commit ca0c72b920
No known key found for this signature in database

View File

@ -87,17 +87,17 @@ func BuildTableRow(ctx context.Context, columnNames []string, entry data.History
row := make([]string, 0) row := make([]string, 0)
for _, header := range columnNames { for _, header := range columnNames {
switch header { switch header {
case "Hostname", "hostname": case "Hostname", "hostname", "hn":
row = append(row, entry.Hostname) row = append(row, entry.Hostname)
case "CWD", "cwd": case "CWD", "cwd":
row = append(row, entry.CurrentWorkingDirectory) row = append(row, entry.CurrentWorkingDirectory)
case "Timestamp", "timestamp": case "Timestamp", "timestamp", "ts":
if entry.StartTime.UnixMilli() == 0 { if entry.StartTime.UnixMilli() == 0 {
row = append(row, "N/A") row = append(row, "N/A")
} else { } else {
row = append(row, entry.StartTime.Local().Format(hctx.GetConf(ctx).TimestampFormat)) row = append(row, entry.StartTime.Local().Format(hctx.GetConf(ctx).TimestampFormat))
} }
case "Runtime", "runtime": case "Runtime", "runtime", "rt":
if entry.EndTime.UnixMilli() == 0 { if entry.EndTime.UnixMilli() == 0 {
// An EndTime of zero means this is a pre-saved entry that never finished // An EndTime of zero means this is a pre-saved entry that never finished
row = append(row, "N/A") row = append(row, "N/A")
@ -106,7 +106,7 @@ func BuildTableRow(ctx context.Context, columnNames []string, entry data.History
} }
case "Exit Code", "Exit_Code", "ExitCode", "exitcode", "$?", "EC": case "Exit Code", "Exit_Code", "ExitCode", "exitcode", "$?", "EC":
row = append(row, fmt.Sprintf("%d", entry.ExitCode)) row = append(row, fmt.Sprintf("%d", entry.ExitCode))
case "Command", "command": case "Command", "command", "cmd":
row = append(row, commandRenderer(entry.Command)) row = append(row, commandRenderer(entry.Command))
case "User", "user": case "User", "user":
row = append(row, entry.LocalUsername) row = append(row, entry.LocalUsername)