mirror of
https://github.com/ddworken/hishtory.git
synced 2025-01-22 22:28:51 +01: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 := ""
|
||||
numRows := 0
|
||||
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
|
||||
}
|
||||
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++ {
|
||||
if i < len(data) {
|
||||
entry := data[i]
|
||||
if entry.Command == lastCommand && config.FilterDuplicateCommands {
|
||||
if strings.TrimSpace(entry.Command) == strings.TrimSpace(lastCommand) && config.FilterDuplicateCommands {
|
||||
continue
|
||||
}
|
||||
entry.Command = strings.ReplaceAll(entry.Command, "\n", " ") // TODO: handle multi-line commands better here
|
||||
|
Loading…
Reference in New Issue
Block a user