Watch loop engine and watcher state.
This module contains the watcher_t type, which:
- Builds and maintains the watch list,
- Tracks file fingerprints for change detection,
- Runs fpm commands when changes are detected,
- Coordinates optional feature plugins.
The engine is intentionally "poll-based" to remain portable across platforms.
Main watcher state and methods.
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| type(watch_config_t), | public | :: | cfg | ||||
| integer, | public, | allocatable | :: | changed_idx(:) | |||
| integer(kind=int64), | public, | allocatable | :: | file_mask(:) | |||
| type(string_t), | public, | allocatable | :: | files(:) | |||
| type(feature_manager_t), | public | :: | fm | ||||
| integer(kind=int64), | public, | allocatable | :: | fp_now(:) | |||
| integer(kind=int64), | public, | allocatable | :: | fp_prev(:) | |||
| integer(kind=int64), | public | :: | man_prev | = | 0_int64 | ||
| type(root_info_t), | public, | allocatable | :: | roots(:) |
| procedure, public :: init => watcher_init | |
| procedure, public :: run => watcher_run |
Return whether the changed set contains fpm.toml.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(string_t), | intent(in), | allocatable | :: | files(:) | ||
| integer, | intent(in) | :: | changed_idx(:) | |||
| integer, | intent(in) | :: | changed_count |
Handle a manifest change (fpm.toml) by rebuilding the watch list.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(watcher_t), | intent(inout) | :: | self |
Recompute the watch list, rebuild fingerprints, and print/log the result.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(watcher_t), | intent(inout) | :: | self | |||
| logical, | intent(in) | :: | print_header |
Run the configured command once without change detection.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(watcher_t), | intent(inout) | :: | self | |||
| character(len=*), | intent(in) | :: | cmd0 |
Initialize a watcher instance from configuration.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(watcher_t), | intent(inout) | :: | self | |||
| type(watch_config_t), | intent(in) | :: | cfg |
Run the main watch loop until termination.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(watcher_t), | intent(inout) | :: | self |