refactor: change limit to unlimited by default

This commit is contained in:
Viktor Varland 2026-02-16 20:45:17 +01:00
parent 2f8ba08d4f
commit 010104b2dd
No known key found for this signature in database
GPG key ID: 991E991EBEC46432
2 changed files with 11 additions and 6 deletions

View file

@ -57,10 +57,12 @@ hs() {
esac
local entry="$(
verbatim search --compact --reverse "$@" | \
verbatim search --compact --reverse --limit 10000 "$@" | \
fzf --ansi --disabled --query "${*:-}" \
--bind "start:reload:verbatim search --compact --reverse {q}" \
--bind "change:reload:sleep 0.1; verbatim search --compact --reverse {q} || true"
--bind "start:reload:verbatim search --compact --reverse --limit 10000 {q}" \
--bind "change:reload:sleep 0.1; verbatim search --compact --reverse --limit 10000 {q} || true" \
--bind "ctrl-a:reload:verbatim search --compact --reverse {q}" \
--header "ctrl-a: search all"
)"
local entry_cmd="$(<<<$entry sed 's/\x1b\[[0-9;]*m//g' | awk '{ print substr($0, index($0, $5)) }')"

View file

@ -19,7 +19,7 @@ func Run(d *sql.DB, args []string) error {
dir := fs.String("dir", "", "filter by working directory")
after := fs.String("after", "", "filter entries after timestamp")
before := fs.String("before", "", "filter entries before timestamp")
limit := fs.Int("limit", 10000, "max results")
limit := fs.Int("limit", 0, "max results (0 = unlimited)")
reverse := fs.Bool("reverse", false, "newest first")
compact := fs.Bool("compact", false, "compact output with color")
fs.Parse(args)
@ -54,8 +54,11 @@ func Run(d *sql.DB, args []string) error {
if len(where) > 0 {
inner += " WHERE " + strings.Join(where, " AND ")
}
inner += " ORDER BY timestamp DESC LIMIT ?"
params = append(params, *limit)
inner += " ORDER BY timestamp DESC"
if *limit > 0 {
inner += " LIMIT ?"
params = append(params, *limit)
}
outerOrder := "ASC"
if *reverse {