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

Multiple improvements and fixes #16

Merged
merged 13 commits into from
Jul 18, 2023
Merged

Multiple improvements and fixes #16

merged 13 commits into from
Jul 18, 2023

Conversation

alexkunde
Copy link
Contributor

@alexkunde alexkunde commented Jul 18, 2023

Hi, Im not sure if this repo is still being actively maintained, but if so, please see the following changes.

Changes

Breaking

  • (maybe) breaking: updated exists() to check systemctl list-unit-files. Units can exists here, but not have a status

Features

  • added unit_list_full() function which returns all three info columns from systemctl list-unit-files as a vector of structs. unit_list_full() now has the actually logic, with unit_list() reducing the result to a vector of strings with names.
  • added glob filter to unit_list() and unit_list_full() so you can filter for unit names. e.g. systemctl list-unit-files cron* would only return units starting with cron
  • added transient as a field for Unit struct, as it can appear
  • add Cntrl PID option for PID

Fixes / Improvements

  • updated dependencies
  • updated edition to 2021
  • removed default-env dependency, it's not needed and updated systemctl() and systemctl_capture() function with native env variables
  • add test for unit_list_full()
  • fix clippy warnings and deactive them for not-implemented parts
  • re-do the whole default() thing, most of it can be derived and will save on code
  • switch the Unit if...else to .strip_prefix(). It will return false if it doesnt work, or return back the value without prefix

@alexkunde
Copy link
Contributor Author

alexkunde commented Jul 18, 2023

@gwbres the pipeline is failing as per main branch. To fix it, we can revert e20fdfb (I did a fix to be able to test locally), but that is an architectural decision I would leave up to you
Alternatively we could add the missing variant to the Type enum and leave the code panicking whenever a type error appears.

@gwbres gwbres merged commit 3f579b2 into gwbres:main Jul 18, 2023
@gwbres
Copy link
Owner

gwbres commented Jul 18, 2023

@alexkunde

Thank for the many improvements ! let's merge them we'll fix the pipeline later

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