rschmitt / heatseeker

A high-performance Selecta clone, written in Rust.
MIT License
214 stars 10 forks source link

Add a flag for specifying a regex to match lines #44

Open mardukbp opened 4 years ago

mardukbp commented 4 years ago

Motivation

Use heatseeker for:

Quickly navigating log files

Entries in a log file can be matched using

^\d{2}\.\d{2}\.\d{4}

Each entry may span multiple lines.

Filtering the list of flags of a command, obtained from the man page or using cmd --help.

The following yields the list of flags of the cal command:

regex="^ *-.*\n.*"
man cal | col -b | rg -Uo "$regex"

Excerpt:

-1      Display only the current month. This is the default.                                                                                                                                                       
-A      number                                                                                                                                                                                                                  
    Months to add after. The specified number of months is added to the end of the display. This is in addition to any date range selected by the -y, -3, or -1 options. For example, “cal -y -B2         

An entry may span multiple lines. Searching for months in heatseeker should show the whole entry:

-A      number                                                                                                                                                                                                                  
    Months to add after. The specified number of months is added to the end of the display. This is in addition to any date range selected by the -y, -3, or -1 options. For example, “cal -y -B2         

Additional context

This feature request is inspired by rofi, a GUI fuzzy selector for X11 and compile-mode in Emacs.