Skip to content

Commit 69973f7

Browse files
committed
refactor: major codebase restructure and safety improvements
- Split monolithic main.rs into organized modules (app, network, ui, utils) - Extract all magic numbers into named constants - Add comprehensive bounds checking to prevent panics - Implement network overflow detection for counter resets - Fix division by zero in memory percentage calculations - Add proper error handling with structured logging - Cache expensive operations between refresh intervals - Remove redundant Panel struct and simplify state management - Add rate limiting for manual refresh operations - Improve navigation with backspace key support - Standardize error messages and clean up dead code - Update README to align with changes
1 parent 1a81194 commit 69973f7

File tree

10 files changed

+1033
-797
lines changed

10 files changed

+1033
-797
lines changed

Cargo.lock

Lines changed: 76 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,5 @@ serde = { version = "1.0.228", features = ["derive"] }
1313
serde_json = "1.0.145"
1414
sysinfo = "0.37.1"
1515
tokio = { version = "1.47.1", features = ["full"] }
16+
tracing = "0.1"
17+
tracing-subscriber = { version = "0.3", features = ["env-filter"] }

README.md

Lines changed: 20 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
# Gribble System Monitor
22

3-
A real-time terminal-based system monitor built with Rust and ratatui. Gribble provides live system metrics, process management, file browsing, and network traffic visualization in a keyboard-driven interface.
3+
A terminal-based system monitor built with Rust and ratatui. Provides real-time system metrics, process management, file browsing, and network traffic visualization.
44

55
![Gribble System Monitor](gribble-screenshot.png)
66

77
## Features
88

9-
- **System Monitoring**: Real-time CPU usage with progress bars, memory statistics, system uptime, and architecture details
10-
- **Process Management**: Interactive process viewer with CPU and memory usage, sortable by resource consumption
11-
- **File Explorer**: Navigate filesystem with keyboard controls, directory traversal with visual indicators
12-
- **Network Traffic**: Live network monitoring with sparkline graphs, cycle through multiple network interfaces
13-
- **Keyboard Navigation**: Vim-style navigation (hjkl) plus arrow keys, page navigation (PgUp/PgDn), and jump keys (Home/End)
9+
- Real-time CPU and memory monitoring with visual progress bars
10+
- Interactive process viewer sorted by resource usage
11+
- File system navigation with keyboard controls
12+
- Network traffic visualization with sparkline graphs
13+
- Multi-interface network monitoring
14+
- Vim-style keyboard navigation
1415

1516
## Installation
1617

@@ -37,45 +38,41 @@ cargo run
3738

3839
### Navigation
3940

40-
- `←→` or `h l` - Switch between panels
41+
- `←→` or `h l` - Switch between panels
4142
- `↑↓` or `j k` - Navigate within lists, cycle network interfaces
4243
- `PgUp/PgDn` - Jump by page in lists
4344
- `Home/End` - Jump to first/last item in lists
4445
- `Enter` - Open directories in File Explorer
46+
- `Backspace` - Go up one directory
4547
- `r` - Refresh all data
4648
- `?` - Show/hide help
4749
- `q` or `Esc` - Quit
4850

4951
### Panels
5052

51-
1. **System Monitor** - CPU usage with visual bars, memory statistics, process count, system information
53+
1. **System Monitor** - CPU usage, memory statistics, process count, system information
5254
2. **System Status** - Current time/date, disk usage, network interface statistics, system load
53-
3. **Process Manager** - Live process list sorted by CPU usage, full navigation support
54-
4. **File Explorer** - Directory browser with folder/file icons, full navigation support
55-
5. **Network Graph** - Real-time network traffic with interface cycling, separate RX/TX sparkline graphs
55+
3. **Process Manager** - Live process list sorted by CPU usage
56+
4. **File Explorer** - Directory browser with folder/file icons
57+
5. **Network Graph** - Real-time network traffic with interface cycling
5658

5759
## Technical Details
5860

5961
- Built with ratatui for terminal UI rendering
6062
- Uses sysinfo for cross-platform system metrics
61-
- Implements proper scrolling for long lists
6263
- Updates system data every 2 seconds
63-
- Maintains 60-point history for network graphs (2 minutes of data)
64+
- Maintains 60-point history for network graphs
6465
- Cross-platform support (Windows, macOS, Linux)
65-
- Smart memory and network formatting (KB/MB/GB units)
66-
- Robust bounds checking and overflow protection
67-
- String truncation for long process/file names
66+
- Memory and network formatting with appropriate units
67+
- Bounds checking and overflow protection
68+
- String truncation for long names
6869

6970
## Requirements
7071

7172
- Modern terminal emulator with Unicode support
72-
- Sufficient terminal size (minimum 80x24 recommended)
73-
- Read permissions for system information and process data
73+
- Minimum terminal size 80x24
74+
- Read permissions for system information
7475

7576
## License
7677

77-
MIT License - see LICENSE file for details
78-
79-
## Contributing
80-
81-
Pull requests welcome. Please ensure code follows Rust formatting standards and includes appropriate error handling.
78+
MIT License

0 commit comments

Comments
 (0)