Skip to content

Commit 5421c8c

Browse files
authored
Notes about github actions and posix-compliant examples
1 parent 8f3c173 commit 5421c8c

File tree

1 file changed

+49
-17
lines changed

1 file changed

+49
-17
lines changed

README.md

Lines changed: 49 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
# CLI Monitor 🖥️
23

34
> **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.
@@ -7,13 +8,14 @@
78
**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)
89

910
<details>
10-
<summary>📖 Table of Contents</summary>
11+
<summary>📖 Table of Contents (expandable)</summary>
1112

1213
- [Overview](#overview)
1314
- [Features](#features)
1415
- [Quick Start](#quick-start)
1516
- [Example Commands](#example-commands)
1617
- [Arguments Overview](#arguments-overview)
18+
- [Automated Version Bumping, Testing and Release](#bumping)
1719
- [Contributing](#contributing)
1820
- [License](#license)
1921
</details>
@@ -33,13 +35,17 @@ CLI Monitor is designed to help automate command execution, log outputs, and mon
3335

3436
## ▶️ Quick Start <a id="quick-start"></a>
3537

36-
1. **Download** [cli_monitor.py](https://raw.githubusercontent.com/Dimos082/cli-monitor/refs/heads/main/cli_monitor.py).
37-
2. **Run with an argument**:
38+
1. **Download** [cli_monitor.py](https://raw.githubusercontent.com/Dimos082/cli-monitor/refs/heads/main/cli_monitor.py). **Or clone:**
39+
```bash
40+
git clone https://github.com/Dimos082/cli-monitor.git
41+
cd cli-monitor
42+
```
43+
3. **Run with an argument**:
3844
```bash
3945
python cli_monitor.py --command "echo Hello"
4046
```
41-
3. **Stop** it at any time (e.g., Ctrl + C) or specify a timer with `--timer`.
42-
4. **Check** the summary in terminal (or in log file if `--output-file` specified) after. Example:
47+
4. **Stop** it at any time (e.g., Ctrl + C) or specify a timer with `--timer`.
48+
5. **Check** the summary in terminal (or in log file if `--output-file` specified) after. Example:
4349
```bash
4450
----- Execution Summary -----
4551
Start Time: 2025-01-04 22:43:24.021834
@@ -72,18 +78,18 @@ This command checks every 10 seconds if `my_app` is running. If not, it triggers
7278
### Repeating Echo
7379

7480
```bash
75-
python cli_monitor.py --command "echo Hello" --frequency 3
81+
python cli_monitor.py --frequency 3 --command echo 'Checking System'
7682
```
7783

78-
Prints "Hello" every 3 seconds.
84+
Prints "Checking System" every 3 seconds.
7985

8086
### Log File Management
8187

8288
```bash
83-
python cli_monitor.py --command "ls -la" --output-file "/tmp/mylog.txt" --max-log-size 50
89+
python cli_monitor.py --output-file memory_log.txt --max-log-size 5 --command echo 'Memory Status: OK'
8490
```
8591

86-
Keeps logs within 50 KB by trimming older entries.
92+
Keeps logs within 5 KB by trimming older entries.
8793

8894
### Detecting Errors in Logs
8995

@@ -112,15 +118,44 @@ Runs for 10 seconds, searching for "error" or "fail" and executing an alert comm
112118

113119
[🔼 Back to top](#cli-monitor-️)
114120

121+
## 🔄 Automated Version Bumping, Testing and Release <a id="bumping"></a>
122+
123+
**GitHub Actions will:**
124+
- [Run tests in several environments](https://github.com/Dimos082/cli-monitor/blob/main/.github/workflows/test.yml)
125+
- Bump version in cli_monitor.py
126+
- Create a [GitHub Release](https://github.com/Dimos082/cli-monitor/releases)
127+
- Attach cli_monitor.py for download
128+
129+
[GitHub Actions](https://github.com/Dimos082/cli-monitor/tree/main/.github/workflows) automatically bumps versions when commit messages include specific keywords:
130+
- Patch (X.Y.Z+1********) → PATCH: Fixed issue
131+
- Minor (X.Y+1.0********) → MINOR: Added logging
132+
- Major (X+1.0.0********) → MAJOR: Breaking change
133+
134+
**Triggering a Release:**
135+
To increment a patch number `1.0.1+`:
136+
```bash
137+
git commit -m "PATCH: Fixed issue in regex matching"
138+
git push origin main
139+
```
140+
To increment major number `1+.0.0`, commit a major change:
141+
```bash
142+
git commit -m "MAJOR: Refactored CLI to use POSIX structure"
143+
git push origin main
144+
```
145+
146+
[🔼 Back to top](#cli-monitor-️)
147+
115148
## 🛠️ Contributing <a id="contributing"></a>
116149

150+
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!
151+
117152
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:
118153

119154
- **Fork the repository**
120155
- **Create a new feature branch**:
121156
`git checkout -b feature/NewFeature`
122-
- **Make your changes and commit**:
123-
`git commit -m "Added NewFeature"`
157+
- **Make your changes and commit with the version number incrementation**:
158+
`git commit -m "MINOR: Added feature XYZ"`
124159
- **Push your changes**: `git push origin feature/NewFeature`
125160
- **Open a pull request** 🐈‍⬛
126161

@@ -131,13 +166,10 @@ The controller (subject) runs commands, logs output, and notifies other modules
131166
This structure makes the code more maintainable and extensible.
132167
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.
133168

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!
135-
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!
137-
138-
139169
## 📜 License <a id="license"></a>
140170

141171
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.
142172

143-
[🔼 Back to top](#cli-monitor-️)
173+
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!
174+
175+
[🔼 Back to top](#cli-monitor-️)

0 commit comments

Comments
 (0)