htop
htop copied to clipboard
Added regular expression functionality to filters with function key to toggle on/off, added function key to toggle include/exclude for filters. Updated man page for above and fixed a few typos and grammar issues.
Added regular expression functionality to filters with function key to toggle on/off, added function key to toggle include/exclude for filters. Updated man page for above and fixed a few typos and grammar issues.
- Could you please bring the typo fixes in man pages out and make a separate commit with them? That way it can be cherry-picked into an htop bug fix release. Also it makes the commit less confusing (when reading the code changes).
- For the UI, I'm personally confused about the behavior when the regex and the inversion are combined. Although it's a feature, are users going to use that frequently? And with that implemented, we need a reason why case insensitive matching is not there. I wish to avoid feature bloat (replicating too many things that
ps | grepcan do) and add features only if there are frequent use cases with them.
- I'll do that
2a. The inversion is very simple, normally matches are shown and others hidden, when inverted matches are hidden and others show. It applies the same way for regex and plain strings. My frequent usage is to hide a lot of nuisance processes with something like ^/App|^/Sys. For me, plain strings are of must less utility, the only RE metachar that comes up in process/commands very often is period and I can always escape it like \.app or com\.apple
2b. The old filters (and search were case insensitive), I don't think there's a lot of value in any case sensitive filtering so it is all case insensitive.
try googling htop regex , I'm confident there's many users who want regex and filter out
@mscalora
For the second point, I still cannot rule out the possibility of expanding the filter to something more advanced. For your info, top already has an advanced filter. It just doesn't support regex yet.
top's filter can work with any field, stack multiple filters together, match case-sensitively or insensitively, and allows both inclusion and exclusion.
It's filter syntax is this (see man page if you wish to know more): press 'o' or 'O' to add a filter (lowercase indicates case-insensitive filter), then type this
[!]<field name><op><value>
<op> could be '=', '<', or '>'. '=' allows partial matches.
'<' and '>' compare in lexicographical order and so can work with strings
! indicates 'exclusion'
Example: 'VIRT>10000' + '!USER=root'
Ctrl-O lists the current filters, '=' clears all filters. This is the filter system in top.
As someone who bounces between Mac and Linux, top is one of those painful commands that is very different. I find the gnu version powerful but I have to reread the man page every time I want to use it, the Mac version is much more simple and doesn't meet my needs.
@mscalora The patch looks much nicer now, with all the regex support self-contained into IncSet and the function keys controlling the behavior! Thank you!
As for case-sensitivity, using case-insensitive searches has worked pretty well for us and I think it can stay this way.
As for the specifics of the UI, I need to give it a spin to see how it feels (and maybe tweak a label or two) but from what I'm reading in the source I think everything's in the right place!
@Explorer09 I think top's filtering system is way over-engineered. If anything, I look at top for inspirations of what not to do in terms of design philosophy. ;-)
Really wishing this would get merged in!
Is this still a possibility?
It would be great to merge this in.
Is this just waiting on merge conflict resolution?