add more docs for track_anything.sh

This commit is contained in:
James Andariese 2024-03-30 15:50:59 -05:00
parent 124acaa789
commit c0ef2034ed

View File

@ -9,15 +9,20 @@ Install by linking or cloning to ~/.config/eww
This config includes a helper bash source which may be used
to setup trackers of values. It requires an on_event emitter
to already exist and should have one of the three output
formats: integer, boolean, and string.
formats: integer, boolean, and string. Additionally, you will
need to provide a `poll` function which exposes the information
you care about.
When specifying a string output, you may include a custom regex
which will not be searched (it will be wrapped in `^`...`$`).
Finally, you will need to source the main library file. When
the library is in the same folder (or nearby) as the library,
this may be done as:
```bash
. "$(dirname "$0")/track_anything.sh"
```
### `poll`
In addition to the configuration, you must provide a poll function.
Your provided poll function must return a valid output as its first
line and may provide log data on subsequent lines which will be
emitted at the info level (stderr, single -v).