Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Rust
on:
push:
branches: ["refactor/modular-components"]
pull_request:
workflow_dispatch:

permissions:
contents: read

jobs:
check:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- name: Install stable Rust
run: rustup update stable --no-self-update && rustup default stable && rustup component add rustfmt clippy
- name: Format and resolve dependencies
run: cargo fmt --all && cargo generate-lockfile
- name: Check all targets
run: cargo check --locked --all-targets
- name: Test
run: cargo test --locked --all-targets
- name: Clippy
run: cargo clippy --locked --all-targets -- -D warnings
- name: Save reproducible sources
if: always()
uses: actions/upload-artifact@v4
with:
name: refactor-validation
path: |
Cargo.lock
src/
examples/
retention-days: 3
7 changes: 6 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ version = "0.1.0"
edition = "2024"

[dependencies]
crossterm = "0.29.0"
crossterm = { version = "0.29.0", features = ["event-stream"] }
directories = "6.0"
futures-util = "0.3"
hostname = "0.4.2"
netdev = "0.46.2"
ratatui = "0.30.2"
tempfile = "3"
tokio = { version = "1", features = ["macros", "rt-multi-thread", "process", "time", "io-util", "sync"] }
tui-input = { version = "0.15.4", default-features = false, features = ["crossterm"] }
29 changes: 29 additions & 0 deletions examples/custom_tab.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
//! Run with: cargo run --example custom_tab
//! A compiled extension: the core event loop and existing tabs do not change.
use std::io;
use netracer::{app::App, component::Component, tabs, terminal::TerminalSession};
use ratatui::{Frame, layout::Rect, widgets::{Block, Borders, Paragraph}};

struct NotesTab;

impl Component for NotesTab {
fn id(&self) -> &'static str { "notes-example" }
fn title(&self) -> &'static str { "Notes" }
fn help(&self) -> &'static str { "Q/Esc: Quit" }
fn render(&mut self, frame: &mut Frame, area: Rect) {
frame.render_widget(
Paragraph::new("A third tab registered without changing App or Ping.")
.block(Block::default().title(" Extension example ").borders(Borders::ALL)),
area,
);
}
}

#[tokio::main]
async fn main() -> io::Result<()> {
let mut components = tabs::builtins();
components.push(Box::new(NotesTab));
let mut app = App::new(components)?;
let mut terminal = TerminalSession::new()?;
app.run(terminal.terminal()).await
}
Loading
Loading