netls 1.0.0

Network connections viewer for daily use and automation - container visibility, JSON/CSV output, process tree, live watch mode
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use crossterm::{
    execute,
    terminal::{LeaveAlternateScreen, disable_raw_mode},
};
use std::io;

/// RAII guard that restores the terminal to its original state when dropped.
/// Works for both watch (raw crossterm) and TUI (ratatui) modes.
pub struct TerminalGuard;

impl Drop for TerminalGuard {
    fn drop(&mut self) {
        let _ = disable_raw_mode();
        let _ = execute!(io::stdout(), LeaveAlternateScreen, crossterm::cursor::Show);
    }
}