mirror of
https://github.com/ddworken/hishtory.git
synced 2025-02-18 03:20: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
|
hishtory config-set displayed-columns CWD Command
|
||||||
```
|
```
|
||||||
|
|
||||||
|
The list of supported columns are: `Hostname`, `CWD`, `Timestamp`, `Runtime`, `ExitCode`, `Command`, and `User`.
|
||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
|
@ -88,24 +88,24 @@ 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":
|
case "Hostname", "hostname":
|
||||||
row = append(row, entry.Hostname)
|
row = append(row, entry.Hostname)
|
||||||
case "CWD":
|
case "CWD", "cwd":
|
||||||
row = append(row, entry.CurrentWorkingDirectory)
|
row = append(row, entry.CurrentWorkingDirectory)
|
||||||
case "Timestamp":
|
case "Timestamp", "timestamp":
|
||||||
row = append(row, entry.StartTime.Local().Format(hctx.GetConf(ctx).TimestampFormat))
|
row = append(row, entry.StartTime.Local().Format(hctx.GetConf(ctx).TimestampFormat))
|
||||||
case "Runtime":
|
case "Runtime", "runtime":
|
||||||
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")
|
||||||
} else {
|
} else {
|
||||||
row = append(row, entry.EndTime.Local().Sub(entry.StartTime.Local()).Round(time.Millisecond).String())
|
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))
|
row = append(row, fmt.Sprintf("%d", entry.ExitCode))
|
||||||
case "Command":
|
case "Command", "command":
|
||||||
row = append(row, entry.Command)
|
row = append(row, entry.Command)
|
||||||
case "User":
|
case "User", "user":
|
||||||
row = append(row, entry.LocalUsername)
|
row = append(row, entry.LocalUsername)
|
||||||
default:
|
default:
|
||||||
customColumnValue, err := getCustomColumnValue(ctx, header, entry)
|
customColumnValue, err := getCustomColumnValue(ctx, header, entry)
|
||||||
|
Loading…
Reference in New Issue
Block a user