Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FR] regular expressions support #554

Open
beelze opened this issue Nov 2, 2023 · 3 comments
Open

[FR] regular expressions support #554

beelze opened this issue Nov 2, 2023 · 3 comments
Assignees

Comments

@beelze
Copy link

beelze commented Nov 2, 2023

procs has a well-developed and consistent search logic that covers many use cases. Though, it is not rare when "grepping" may be more familiar and convenient. But because of watching mode and headers, grep is not suitable.

The idea is to add new regex filtering mode, leave current numeric/textual search as is. The reasons are:

  1. Regexes may be easier to write. As I said, for those who often "greps" logs (for instance) regexes are familiar, powerful and flexible way of filtering. And procs output is very similar to logs. I've come to this when I tried to watch for spawning and killing instances of two binaries while messing with processed like man or emacs which has same strings in command lines. A lot of --and and --or options plus adding spaces did the trick but it took some time. And here I thought "It would be nice to did the same with a simple regex"
  2. Regexes are flexible. For instance, watching for some processes by state and name could be tricky but (assuming the string we're testing with regex is columns joined with space) I can easily write something like ( S .*Rambox| D .*firefox). Currently I need to check my config for Exact or Partial and think about --and and --or priorities.
  3. Of course, it is opinion-based, but for most complex cases regexes are shorter and more predictable comparing to combination of logical conditions.

Desired implementation:

  1. Switching modes options: --text (current search mode), --regex (regex mode) and --smart (regex autodetection by specific patterns, like | (…), * ? etc)
  2. In regex mode, instead if [KEYWORD]…, arguments there is a single ` argument
  3. Interactive regex-based filtering in watch mode (as for me, this feature can save a lot of time for a complex filtering cases)
@sabbellasri
Copy link

Hi Beelze, I am interested in this issue. Could you please assign it to me?

@beelze
Copy link
Author

beelze commented Nov 23, 2023

Hi Beelze, I am interested in this issue. Could you please assign it to me?

Sorry, but I have no permissions for that. Please ask @dalance instead.

@dalance
Copy link
Owner

dalance commented Nov 24, 2023

@sabbellasri Thank you for your interesting in this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants