Skip to content

Commit 48c89b4

Browse files
committed
Table of Contents in readme fixed and design pattern info added
1 parent bda6337 commit 48c89b4

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

README.md

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
> **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.
44
5-
*Because repetitive tasks shouldn't be boring...*
5+
*Because repetitive tasks should be automated...*
66

77
**Unittests status for Win/Lin/Mac environments:** [![Python Multi-OS Tests](https://github.com/Dimos082/cli-monitor/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/Dimos082/cli-monitor/actions/workflows/test.yml)
88

@@ -18,11 +18,11 @@
1818
- [License](#license)
1919
</details>
2020

21-
## Overview
21+
## Overview <a id="overview"></a>
2222

2323
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.
2424

25-
## Features
25+
## Features <a id="features"></a>
2626

2727
- **Flexible Command Execution**: Run any CLI command at a chosen frequency.
2828
- **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
3131
- **Cross-Platform Compatibility**: Works on Windows, Linux, and macOS with Python 3.
3232

3333

34-
## ▶️ Quick Start
34+
## ▶️ Quick Start <a id="quick-start"></a>
3535

3636
1. **Download** [cli_monitor.py](https://raw.githubusercontent.com/Dimos082/cli-monitor/refs/heads/main/cli_monitor.py).
3737
2. **Run with an argument**:
@@ -55,7 +55,7 @@ Termination Reason: Manual termination by user
5555

5656
[🔼 Back to top](#cli-monitor-️)
5757

58-
## 🎛️ Example Commands
58+
## 🎛️ Example Commands <a id="example-commands"></a>
5959

6060
### Process Monitoring (babysit/watchdog mode)
6161

@@ -98,7 +98,7 @@ Runs for 10 seconds, searching for "error" or "fail" and executing an alert comm
9898

9999
[🔼 Back to top](#cli-monitor-️)
100100

101-
## 💬 Arguments Overview
101+
## 💬 Arguments Overview <a id="arguments-overview"></a>
102102

103103
| Argument | Required? | Default | Description |
104104
|-----------------|:---------:|--------:|-------------|
@@ -112,24 +112,31 @@ Runs for 10 seconds, searching for "error" or "fail" and executing an alert comm
112112

113113
[🔼 Back to top](#cli-monitor-️)
114114

115-
## 🛠️ Contributing
115+
## 🛠️ Contributing <a id="contributing"></a>
116116

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:
118118

119119
- **Fork the repository**
120120
- **Create a new feature branch**:
121121
`git checkout -b feature/NewFeature`
122122
- **Make your changes and commit**:
123-
`git commit -m "Added NewFeature`
123+
`git commit -m "Added NewFeature"`
124124
- **Push your changes**: `git push origin feature/NewFeature`
125125
- **Open a pull request** 🐈‍⬛
126126

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+
127134
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!
128135

129136
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!
130137

131138

132-
## 📜 License
139+
## 📜 License <a id="license"></a>
133140

134141
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.
135142

0 commit comments

Comments
 (0)