mirror of
https://github.com/ddworken/hishtory.git
synced 2025-06-12 08:06:53 +02:00
Trim spaces when comparing commands for duplicates to fix #26
This commit is contained in:
parent
afd336c248
commit
be0a61a7ea
@ -475,7 +475,7 @@ func DisplayResults(ctx *context.Context, results []*data.HistoryEntry, numResul
|
|||||||
lastCommand := ""
|
lastCommand := ""
|
||||||
numRows := 0
|
numRows := 0
|
||||||
for _, entry := range results {
|
for _, entry := range results {
|
||||||
if entry != nil && entry.Command == lastCommand && config.FilterDuplicateCommands {
|
if entry != nil && strings.TrimSpace(entry.Command) == strings.TrimSpace(lastCommand) && config.FilterDuplicateCommands {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
row, err := buildTableRow(ctx, config.DisplayedColumns, *entry)
|
row, err := buildTableRow(ctx, config.DisplayedColumns, *entry)
|
||||||
|
@ -222,7 +222,7 @@ func getRows(ctx *context.Context, columnNames []string, query string, numEntrie
|
|||||||
for i := 0; i < numEntries; i++ {
|
for i := 0; i < numEntries; i++ {
|
||||||
if i < len(data) {
|
if i < len(data) {
|
||||||
entry := data[i]
|
entry := data[i]
|
||||||
if entry.Command == lastCommand && config.FilterDuplicateCommands {
|
if strings.TrimSpace(entry.Command) == strings.TrimSpace(lastCommand) && config.FilterDuplicateCommands {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
entry.Command = strings.ReplaceAll(entry.Command, "\n", " ") // TODO: handle multi-line commands better here
|
entry.Command = strings.ReplaceAll(entry.Command, "\n", " ") // TODO: handle multi-line commands better here
|
||||||
|
Loading…
x
Reference in New Issue
Block a user