mirror of
https://github.com/ddworken/hishtory.git
synced 2024-12-25 16:28:53 +01:00
Update README and make column name matching more relaxed
This commit is contained in:
parent
8274534be1
commit
9efef65e3a
@ -85,6 +85,8 @@ You can customize the columns that are displayed via `hishtory config-set displa
|
||||
hishtory config-set displayed-columns CWD Command
|
||||
```
|
||||
|
||||
The list of supported columns are: `Hostname`, `CWD`, `Timestamp`, `Runtime`, `ExitCode`, `Command`, and `User`.
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
|
@ -88,24 +88,24 @@ func BuildTableRow(ctx context.Context, columnNames []string, entry data.History
|
||||
row := make([]string, 0)
|
||||
for _, header := range columnNames {
|
||||
switch header {
|
||||
case "Hostname":
|
||||
case "Hostname", "hostname":
|
||||
row = append(row, entry.Hostname)
|
||||
case "CWD":
|
||||
case "CWD", "cwd":
|
||||
row = append(row, entry.CurrentWorkingDirectory)
|
||||
case "Timestamp":
|
||||
case "Timestamp", "timestamp":
|
||||
row = append(row, entry.StartTime.Local().Format(hctx.GetConf(ctx).TimestampFormat))
|
||||
case "Runtime":
|
||||
case "Runtime", "runtime":
|
||||
if entry.EndTime.UnixMilli() == 0 {
|
||||
// An EndTime of zero means this is a pre-saved entry that never finished
|
||||
row = append(row, "N/A")
|
||||
} else {
|
||||
row = append(row, entry.EndTime.Local().Sub(entry.StartTime.Local()).Round(time.Millisecond).String())
|
||||
}
|
||||
case "Exit Code":
|
||||
case "Exit Code", "Exit_Code", "ExitCode", "exitcode":
|
||||
row = append(row, fmt.Sprintf("%d", entry.ExitCode))
|
||||
case "Command":
|
||||
case "Command", "command":
|
||||
row = append(row, entry.Command)
|
||||
case "User":
|
||||
case "User", "user":
|
||||
row = append(row, entry.LocalUsername)
|
||||
default:
|
||||
customColumnValue, err := getCustomColumnValue(ctx, header, entry)
|
||||
|
Loading…
Reference in New Issue
Block a user