Skip to content

Add option to limit view to certain units#21

Merged
rgwood merged 3 commits intorgwood:masterfrom
mkuehlke:add-limit-option
May 25, 2024
Merged

Add option to limit view to certain units#21
rgwood merged 3 commits intorgwood:masterfrom
mkuehlke:add-limit-option

Conversation

@mkuehlke
Copy link
Copy Markdown
Contributor

Hi, I've had an itch to have an overview for some application consisting of over a dozen unit files, so I've searched for something like this. I'm just submitting this as a draft so you or others can have look to see if it's interesting.

This allows a user to limit the view to certain units, which makes it usable as a simple service front end for complex services:

systemctl-tui --limit-units abc\*.{service,timer} bce.service

This also allows one to show other unit types besides just .service. The UI doesn't support those, of course, but it seems to work fine with timers for now. And didn't even crash for .mount.

Caveats:
Other unit types besides service aren't fully supported by the rest of the app.
Maybe using a short option for such a niche use case isn't really necessary.
Also I'm a complete newbie in Rust, so this may leak memory or other fluids.

This allows a user to limit the view to certain units, which makes it
usable as a simple frontend for complex services:
```
systemctl-tui --limit-units abc\*.{service,timer}
```
@rgwood
Copy link
Copy Markdown
Owner

rgwood commented May 24, 2024

Thanks for the PR! I think this is a good idea. I'll try to review it this week.

Copy link
Copy Markdown
Owner

@rgwood rgwood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good, thank you for the contribution!

I made a tiny change to require at least 1 argument for limit_units. Otherwise, LGTM and I'll release a new version with this functionality soon.

@rgwood rgwood marked this pull request as ready for review May 25, 2024 16:43
@rgwood rgwood merged commit 56742c4 into rgwood:master May 25, 2024
@mkuehlke mkuehlke deleted the add-limit-option branch May 27, 2024 09:34
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

Successfully merging this pull request may close these issues.

2 participants