-
Notifications
You must be signed in to change notification settings - Fork 54
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
[Feature] Configurable process status display #134
Comments
Thank you for kind feedback and a very detailed proposal. I think we can have two layers of configurability. Layer 1 would be your option 1. But I think an array would give us more flexibility. First element that matches would be used. And we can provide a few popular filters. foo:
shell: "run-job foo"
statuses: *default_statuses
- exit_code: 0
label: Processing...
fg_color: lightgreen
bold: false
- exit_code: 123
label: Clean
fg_color: blue
# default/fallback for not explicitly defined codes
- exit_code: [ [1, 255] ] # Array of ranges
label: 'Failed! (%s)' # I guess the templating here would be a stretch-goal
fg_color: lightred
# For processes not yet started
- never_started: true
label: ''
# ...
bar:
shell: "run-job bar"
statuses: &default_statuses
# ... Layer 2 would be Lua customization. My current plan is to deprecate mprocs.lua config and instead have yaml configs that allow using code to customize some parts. This way we can reload configs without losing state. Also ui for editing yaml configs will be possible. And in Lua controller we can define dynamic and complex markup for rendering status. And more advanced checks will be possible via Lua controller: health checks, analyzing process output, etc. |
Cheers! Agreed list looks nicer and I like the filter-based approach allowing for ranges etc. Another thought I had for process names would be to open up a third output pipe aside from stdout/stderr and use that as a feed for process title. Should be straightforward to implement. The lua approach is obviously a lot more powerful and sounds like it could be used to implement basically that if desired, anyway. |
Looking forward to this! I am using mprocs to run many python tests and would like to know which tests passed and which ones failed by just looking at the process statuses rather than having to look at their logs |
looking forward to this as well. would be awesome for statues for unit test runners like |
Description
mprocs
is very promising as a lightweight "framework" for certain CLI apps. Thank you for working on it and sharing, pvolok!Current behavior
As I understand it:
UP
(green)DOWN ($EXIT_CODE)
(red)Desired behavior
Allow recognizing multiple process states, and allow users to introduce their own semantics and represent them in an intuitive and pleasing way in UI (similar to #127)
So instead of:
We might want something like
Solution
There is more than one approach to this.
The following aspects would be nice:
mprocs
and its processes (no unix sockets, temporary files, or other fanciness)Option 1
If going this approach, seems sensible to just pass through existing options and names for
ratatui::style::Style
.Option 2
Some form of more dynamic templating language in process labels (and names?). If this were a golang project the obvious choice would be
go-template
- not sure if there's something similar that would be suitable for this project. Other things to imagine would be some subset of markdown/html or printf formatting. If going down this route could be worth looking at if there's some similar enough application (like a statusline implementation) with community mind-share to borrow from.Arbitrary example:
Could even imagine splitting the separation of "name" and "status" (would require #135 , I guess, and take some consideration to allow reuse of templates):
Option 3
Keep current main approach of hardcoded states but introduce more granularity.
#127 (comment)
Option 1 would be my proposed approach, as it's simpler and doesn't open pandora's box of introducing a DSL (maybe it does make sense to do something like this at a later point but seems overkill here), while being generic enough to remove the urge for certain follow-up PRs with associate reconsiderations of whether certain conventions should be considered in display or not (as option 3).
Related
Down
status #127The text was updated successfully, but these errors were encountered: