You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+17-10Lines changed: 17 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
> **CLI Monitor** is a *cross-platform* Python tool that repeatedly runs a command, captures its output, optionally logs it, and can even trigger a secondary command whenever a regex pattern is matched.
4
4
5
-
*Because repetitive tasks shouldn't be boring...*
5
+
*Because repetitive tasks should be automated...*
6
6
7
7
**Unittests status for Win/Lin/Mac environments:**[](https://github.com/Dimos082/cli-monitor/actions/workflows/test.yml)
8
8
@@ -18,11 +18,11 @@
18
18
-[License](#license)
19
19
</details>
20
20
21
-
## Overview
21
+
## Overview <aid="overview"></a>
22
22
23
23
CLI Monitor is designed to help automate command execution, log outputs, and monitor for specific patterns using **regex**. If a match is found, the tool can execute an additional command. It handles logging, error reporting, and summary generation with ease.
24
24
25
-
## Features
25
+
## Features <aid="features"></a>
26
26
27
27
-**Flexible Command Execution**: Run any CLI command at a chosen frequency.
28
28
-**Pattern Matching with Regex**: Detect specific output patterns and trigger follow-up actions.
@@ -31,7 +31,7 @@ CLI Monitor is designed to help automate command execution, log outputs, and mon
31
31
-**Cross-Platform Compatibility**: Works on Windows, Linux, and macOS with Python 3.
@@ -112,24 +112,31 @@ Runs for 10 seconds, searching for "error" or "fail" and executing an alert comm
112
112
113
113
[🔼 Back to top](#cli-monitor-️)
114
114
115
-
## 🛠️ Contributing
115
+
## 🛠️ Contributing <aid="contributing"></a>
116
116
117
-
We welcome contributions to make CLI Monitor even better! If you have an idea for an improvement or new [test cases](https://github.com/Dimos082/cli-monitor/tree/main/tests), feel free to:
117
+
I welcome contributions to make CLI Monitor even better! If you have an idea for an improvement or new [test cases](https://github.com/Dimos082/cli-monitor/tree/main/tests), feel free to:
118
118
119
119
-**Fork the repository**
120
120
-**Create a new feature branch**:
121
121
`git checkout -b feature/NewFeature`
122
122
-**Make your changes and commit**:
123
-
`git commit -m "Added NewFeature`
123
+
`git commit -m "Added NewFeature"`
124
124
-**Push your changes**: `git push origin feature/NewFeature`
125
125
-**Open a pull request** 🐈⬛
126
126
127
+
### Observer Design Pattern
128
+
Internally, cli_monitor.py uses an [Observer design pattern](https://refactoring.guru/design-patterns/observer/python/example) to keep modules loosely coupled:
129
+
130
+
The controller (subject) runs commands, logs output, and notifies other modules (observers) like the RegexMonitor, ErrorHandler, and LoggerModule about data or events.
131
+
This structure makes the code more maintainable and extensible.
132
+
To add a new “observer” (e.g., a custom notification module), simply attach it to the flow in the controller without modifying existing logic significantly.
133
+
127
134
If you find a bug or have a feature request, check out [open issues](https://github.com/Dimos082/cli-monitor/issues) or create a new one. Your feedback is valuable!
128
135
129
136
If you find [cli_monitor.py](https://raw.githubusercontent.com/Dimos082/cli-monitor/refs/heads/main/cli_monitor.py) useful, consider giving it a ⭐ on GitHub!
130
137
131
138
132
-
## 📜 License
139
+
## 📜 License <aid="license"></a>
133
140
134
141
This project is licensed under the Apache 2.0 - see the [LICENSE](https://github.com/Dimos082/cli-monitor?tab=Apache-2.0-1-ov-file) file for details.
0 commit comments