(ctx context.Context, query string)
| 150 | } |
| 151 | |
| 152 | func query(ctx context.Context, query string) { |
| 153 | db := hctx.GetDb(ctx) |
| 154 | err := lib.RetrieveAdditionalEntriesFromRemote(ctx, "query") |
| 155 | if err != nil { |
| 156 | if lib.IsOfflineError(ctx, err) { |
| 157 | fmt.Println("Warning: hishtory is offline so this may be missing recent results from your other machines!") |
| 158 | } else { |
| 159 | lib.CheckFatalError(err) |
| 160 | } |
| 161 | } |
| 162 | lib.CheckFatalError(displayBannerIfSet(ctx)) |
| 163 | numResults := 25 |
| 164 | data, err := lib.Search(ctx, db, query, numResults*5) |
| 165 | lib.CheckFatalError(err) |
| 166 | lib.CheckFatalError(DisplayResults(ctx, data, numResults)) |
| 167 | } |
| 168 | |
| 169 | func DisplayResults(ctx context.Context, results []*data.HistoryEntry, numResults int) error { |
| 170 | config := hctx.GetConf(ctx) |
no test coverage detected