Skip to content

Commit 4aefd50

Browse files
Add demo script and unit tests for collector package
- Created a demo.tape file to showcase the usage of the application with visual output. - Implemented unit tests for the collector package, including tests for loopback interface detection, best interface selection, and interface details retrieval. - Added tests to ensure correct behavior for both valid and invalid interface names.
1 parent f27ec3f commit 4aefd50

19 files changed

Lines changed: 689 additions & 639 deletions

CHANGELOG.md

Lines changed: 33 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,29 @@
1+
## [0.1.6] - 2026-07-10
2+
3+
### Added
4+
5+
- Interface Details Overlay — Press `I` (capital i) to view IP addresses, MAC address, link status, and MTU for the current network interface. Uses both gopsutil and the Go standard library for cross-platform compatibility.
6+
- Reset Confirmation — Pressing `r` now requires a second press within 2 seconds to confirm, preventing accidental data loss. Press `esc` to cancel.
7+
- Interface Info Keybinding (`I`) — Documented in the help overlay alongside all other bindings.
8+
- Expanded test coverage — New test suites for layout utilities (centerInline, formatBytes, formatInterval, truncate), overlay rendering (help, processes, themes), collector edge cases (loopback detection, pickBest), and additional FormatBpsExt unit/edge-case tests.
9+
- ROADMAP.md — Published a public roadmap covering v0.2.x through v0.5.x.
10+
11+
### Improved
12+
13+
- Codebase modularity — views.go (729 lines) split into four focused files: views.go (dashboard layout), panels.go (download/upload panel rendering), overlays.go (help, processes, themes, interface details overlays), and layout.go (shared layout/formatting utilities). Each file has a single responsibility.
14+
- Help overlay — Now documents the new `I` interface info keybinding and the reset confirmation (press twice) behavior.
15+
- Collector testability — Added `collector_test.go` with tests for `isLoopback`, `pickBest`, constructor, and `InterfaceDetails`.
16+
- centerInline now handles empty strings gracefully (returns the input unchanged instead of adding whitespace padding).
17+
18+
### Changed
19+
20+
- Major internal restructuring — views.go decomposed into panels.go, overlays.go, and layout.go with zero behavioural changes.
21+
- VERSION bumped to 0.1.6 (significant architecture improvements and new features).
22+
23+
### Fixed
24+
25+
- `runTiny` in main.go had identical branches in the `noColor` if/else block (dead code). Removed the conditional — both branches did the same thing.
26+
127
## [0.1.5] - 2026-07-08
228

329
### Added
@@ -32,9 +58,6 @@
3258
- Processes Panel - Redesigned with a rounded indigo border matching the help menu aesthetic, consistent padding, muted separators, and centered layout. Displays "no active network processes detected" when empty.
3359
- Today Stats - Deduplicated "today" label (was showing "today" twice), cleaner formatting.
3460
- Makefile - Cross-platform support for Linux, macOS, and Windows (automatic binary extension, platform-agnostic directory creation and cleanup).
35-
- Processes Panel - Redesigned with a rounded indigo border matching the help menu aesthetic, consistent padding, muted separators, and centered layout. Displays "no active network processes detected" when empty.
36-
- Today Stats - Deduplicated "today" label (was showing "today" twice), cleaner formatting.
37-
- Makefile - Cross-platform support for Linux, macOS, and Windows (automatic binary extension, platform-agnostic directory creation and cleanup).
3861

3962
## [0.1.2] - 2026-07-05
4063

@@ -103,17 +126,12 @@
103126

104127
### Changed
105128

106-
- Simplified the hero branding to a plain FLOW title for a calmer,
107-
more iconic terminal identity.
108-
- Reworked the terminal UI into a calmer, premium dashboard with a
109-
larger title hierarchy and more whitespace.
110-
- Replaced abrupt value easing with spring-driven interpolation for
111-
smoother motion in the render loop.
129+
- Simplified the hero branding to a plain FLOW title for a calmer, more iconic terminal identity.
130+
- Reworked the terminal UI into a calmer, premium dashboard with a larger title hierarchy and more whitespace.
131+
- Replaced abrupt value easing with spring-driven interpolation for smoother motion in the render loop.
112132
- Added brief pulse and shimmer feedback for peaks and live traffic.
113-
- Refreshed the theme system with a restrained blue, cyan, emerald, and
114-
near-white palette that degrades cleanly in low-color terminals.
115-
- Updated history and graph presentation to better emphasize flowing
116-
movement over static dashboard chrome.
133+
- Refreshed the theme system with a restrained blue, cyan, emerald, and near-white palette that degrades cleanly in low-color terminals.
134+
- Updated history and graph presentation to better emphasize flowing movement over static dashboard chrome.
117135
- Theme system supports light and dark palettes simultaneously
118136
- Sparkline engine rewritten for block-element output
119137
- Default sampling interval decreased from 250ms to 100ms
@@ -125,11 +143,9 @@
125143

126144
### Fixed
127145

128-
- Reset key fully clears peak tracking, daily totals, rolling maxima,
129-
display values, and history ring buffers
146+
- Reset key fully clears peak tracking, daily totals, rolling maxima, display values, and history ring buffers
130147
- Interface cycling no longer stalls updates
131148
- Interface cycling resets all display state and ring buffers
132149
- Config unit field is case-insensitive
133150
- Various lint and typecheck violations resolved
134-
- Sampler uses a sliding-window average to eliminate zero reads from
135-
coarse OS counter granularity
151+
- Sampler uses a sliding-window average to eliminate zero reads from coarse OS counter granularity

README.md

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,10 @@ flow adjusts its display according to terminal width and height.
143143
## Features
144144

145145
- Live latency (ping) indicator with color-coded ↔ display
146-
- Network processes panel - press `n` to view active processes sorted by connection count
147-
- Theme selector with 8 built-in themes - press `t` to browse and select
146+
- Network processes panel — press `n` to view active processes sorted by connection count
147+
- Interface details overlay — press `I` (capital i) to view IP addresses, MAC, link status, MTU
148+
- Theme selector with 8 built-in themes — press `t` to browse and select
149+
- Reset confirmation — press `r` twice to confirm, preventing accidental data loss
148150
- Real-time download and upload throughput
149151
- Interpolated display values using spring-based animation
150152
- Braille-grid waveform rendering at 30 frames per second
@@ -163,8 +165,6 @@ flow adjusts its display according to terminal width and height.
163165

164166
## Usage
165167

166-
![help](assets/cli_help.png)
167-
168168
```sh
169169
flow # hero view, auto interface
170170
flow --tiny # single-line mode for status bars
@@ -184,14 +184,17 @@ flow --help
184184

185185
![keybinds](assets/keybinds.png)
186186

187+
| Key | Action |
188+
|-------------|-----------------------------|
187189
| Key | Action |
188190
|-------------|-----------------------------|
189191
| `q` / `^C` | Quit |
190192
| `m` | Cycle display/view modes |
191193
| `n` | Open network processes |
192194
| `t` | Choose theme |
193-
| `r` | Reset session peaks |
195+
| `r` | Reset session peaks (twice) |
194196
| `i` | Cycle network interfaces |
197+
| `I` | Show interface info |
195198
| `c` | Cycle display units |
196199
| `b` | Toggle bits/bytes mode |
197200
| `+` / `-` | Adjust refresh interval |
@@ -280,11 +283,37 @@ flowchart LR
280283
Channel --> Spring["Spring interpolation"]
281284
Spring --> Display["Dashboard render (Bubble Tea)"]
282285
Theme["Theme configuration"] -.-> Display
286+
InterfaceInfo["Interface details (IP, MAC)"] -.-> Display
283287
end
284288
```
285289

286290
- The sampling loop reads network counters from the operating system, computes a sliding-window average, and emits a sample on a channel.
287291
- The render loop interpolates display values toward the latest sample and renders the dashboard.
292+
- Interface details (IP addresses, MAC, link status) are fetched on demand via `I` using both gopsutil and the Go standard library.
293+
294+
### Internal package structure
295+
296+
```
297+
cmd/flow/main.go
298+
|
299+
├── internal/config ← TOML config management
300+
├── internal/collector ← OS-level network I/O counters + interface details
301+
├── internal/sampler ← Sliding-window sampling loop
302+
|
303+
└── internal/ui ← Bubble Tea Model + views
304+
├── model.go ← State, update loop, key handling
305+
├── views.go ← Dashboard layout and mode selection
306+
├── panels.go ← Download/upload panel rendering
307+
├── overlays.go ← Help, processes, themes, interface info
308+
├── layout.go ← Layout utilities (centering, formatting)
309+
├── keys.go ← Key binding definitions
310+
├── internal/history ← Ring buffer + tracker (peaks/totals)
311+
├── internal/sparkline ← Braille/block graph rendering
312+
├── internal/theme ← 8 colour themes + lipgloss styles
313+
├── internal/animate ← Spring physics, easing, colour lerps
314+
├── internal/ping ← TCP ping measurement
315+
└── internal/processes ← Network process enumeration
316+
```
288317

289318
Separating collection from rendering keeps the interface responsive without adding load to the sampler. Idle CPU usage remains below one percent.
290319

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.1.5
1+
0.1.6

assets/cli_help.png

-39.5 KB
Binary file not shown.

assets/compact_mode.png

2.55 KB
Loading

assets/demo.gif

-3.35 MB
Loading

assets/flow.png

-925 Bytes
Loading

assets/keybinds.png

9.87 KB
Loading

assets/mini_mode.png

-893 Bytes
Loading

assets/normal_mode.png

5.51 KB
Loading

0 commit comments

Comments
 (0)