diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..9108367 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,31 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +## [Unreleased] + +## [1.0.0] - 2025-12-30 + +### Added + +- documentation and comments +- help menu +- list for saved connections, +- delete connection confirmation popup, +- listeners for all the popups/menus + +### Changed + +- code refactoring and cleanup +- force full modularization of codebase + +## [0.1.0] - 2025-12-21 (init date) + +### Added + +- Initial project structure +- Working state with some feat like network scanning + +[Unreleased]: https://github.com/santoshxshrestha/nmtui/compare/v1.0.0...HEAD +[1.0.0]: https://github.com/santoshxshrestha/nmtui/releases/tag/v1.0.0 +[0.1.0]: https://github.com/santoshxshrestha/nmtui/releases/tag/v0.1.0 diff --git a/Cargo.lock b/Cargo.lock index a994c18..70bfc13 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -336,9 +336,9 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.16" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ee5b5339afb4c41626dde77b7a611bd4f2c202b897852b4bcf5d03eddc61010" +checksum = "92ecc6618181def0457392ccd0ee51198e065e016d1d527a7ac1b6dc7c1f09d2" [[package]] name = "lazy_static" @@ -423,7 +423,7 @@ dependencies = [ [[package]] name = "nmtui" -version = "0.1.0" +version = "1.0.0" dependencies = [ "color-eyre", "crossterm 0.29.0", @@ -488,9 +488,9 @@ checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" [[package]] name = "proc-macro2" -version = "1.0.103" +version = "1.0.104" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ee95bc4ef87b8d5ba32e8b7714ccc834865276eab0aed5c9958d00ec45f49e8" +checksum = "9695f8df41bb4f3d222c95a67532365f569318332d03d5f3f67f37b20e6ebdf0" dependencies = [ "unicode-ident", ] @@ -583,9 +583,9 @@ checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" [[package]] name = "ryu" -version = "1.0.21" +version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62049b2877bf12821e8f9ad256ee38fdc31db7387ec2d3b3f403024de2034aea" +checksum = "a50f4cf475b65d88e057964e0e9bb1f0aa9bbb2036dc65c64596b42932536984" [[package]] name = "scopeguard" diff --git a/Cargo.toml b/Cargo.toml index 63ede6a..f521e8e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "nmtui" -version = "0.1.0" +version = "1.0.0" edition = "2024" authors = ["Santosh Shrestha "] description = "Wrapper around nmcli" diff --git a/README.md b/README.md index e0a7c01..a10b9e2 100644 --- a/README.md +++ b/README.md @@ -1 +1,53 @@ -wrapper around cli +# nmtui + +A Terminal UI (TUI) for NetworkManager, built in Rust as a simple wrapper around `nmcli`. + +> This app was created mainly for learning Rust, exploring TUI design, and experimenting with how terminal applications work. It’s not meant to be super polished or perfect-just a fun side project! + +_This Rust code spends so much time cloning and unlocking things, it’s almost as leisurely as a Python script trying to sort a spreadsheet column-with a side of JavaScript callbacks for maximum confusion. But with better learning and experience, future versions will absolutely get sharper and faster!_ + +## What’s this? + +It’s basically a text-based network manager for your Linux system (using NetworkManager), controlled from your terminal-like `nmtui`, but home-brewed. You can: + +- See available wifi networks +- Connect/disconnect networks +- Manage saved connections +- See current status-all in your terminal + +## How do I use it? + +### Build + +You’ll need Rust (https://rustup.rs), then run: + +``` +cargo build --release +``` + +### Install (recommended) + +You can also install directly from crates.io using Cargo: + +``` +cargo install nmtui +``` + +### Run + +``` +cargo run +``` + +...or run the compiled binary from `target/release/nmtui`. + +## Notes + +- Only tested on Linux (with NetworkManager installed) +- Some features might be a bit rough-pull requests & feedback are welcome! + +## License + +MIT ([see LICENSE](./LICENSE)) + +--- diff --git a/flake.lock b/flake.lock index 56a8086..0cccec1 100644 --- a/flake.lock +++ b/flake.lock @@ -59,11 +59,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1766651565, - "narHash": "sha256-QEhk0eXgyIqTpJ/ehZKg9IKS7EtlWxF3N7DXy42zPfU=", + "lastModified": 1766902085, + "narHash": "sha256-coBu0ONtFzlwwVBzmjacUQwj3G+lybcZ1oeNSQkgC0M=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "3e2499d5539c16d0d173ba53552a4ff8547f4539", + "rev": "c0b0e0fddf73fd517c3471e546c0df87a42d53f4", "type": "github" }, "original": { diff --git a/src/apps/core/saved_connection.rs b/src/apps/core/saved_connection.rs index 3ff0a8c..5c1b098 100644 --- a/src/apps/core/saved_connection.rs +++ b/src/apps/core/saved_connection.rs @@ -58,6 +58,30 @@ impl SavedConnections { } impl App { + /// Handle keyboard input when the saved-connections UI is active and update the application state. + /// + /// Recognizes key presses and performs the following actions: + /// - 'q' or Esc: close the saved-connections view + /// - Ctrl+C: exit the application + /// - 'd': show the delete-confirmation dialog + /// - 'j' or Down: advance the saved-connection selection by one + /// - 'k' or Up: move the saved-connection selection back by one + /// - 'h' or '?': show the help view + /// - Ctrl+R: refresh the saved connections list by re-fetching saved connections + /// + /// # Returns + /// + /// `Ok(())` on success, or an `io::Error` if polling or reading terminal input fails. + /// + /// # Examples + /// + /// ``` + /// # use std::io; + /// # // `App` must be constructed according to the surrounding codebase. + /// # let mut app = App::default(); + /// // Process any pending saved-list input once. + /// let _ = app.handle_saved(); + /// ``` pub fn handle_saved(&mut self) -> io::Result<()> { if poll(Duration::from_micros(1))? { match event::read()? { @@ -88,7 +112,7 @@ impl App { kind: event::KeyEventKind::Press, .. }) => { - // this is the function that deleted the connection from the main lists too + // this will evaluate to run the delete confirmation dialog from the core ui self.show_delete_confirmation = true; } @@ -134,6 +158,14 @@ impl App { }) => { self.show_help = true; } + Event::Key(KeyEvent { + code: event::KeyCode::Char('r'), + kind: event::KeyEventKind::Press, + modifiers: event::KeyModifiers::CONTROL, + .. + }) => { + self.saved_connection.fetch_saved_connections(); + } _ => {} }; }