tmux_interface
Description
tmux_interface is a Rust language library for communication with TMUX via CLI.
Usage
-
Add a dependency in your
Cargo.toml
[dependencies] tmux_interface = "^0.1.0"
-
Add extern crate and use in your source file
extern crate tmux_interface;
-
Use it's functions
use tmux_interface::{AttachSession, NewSession, TmuxInterface}; let mut tmux = TmuxInterface::new(); let new_session = NewSession { detached: Some(true), session_name: Some("session_name"), ..Default::default() }; tmux.new_session(Some(&new_session)).unwrap(); let attach_session = AttachSession { target_session: Some("session_name"), ..Default::default() }; tmux.attach_session(Some(&attach)).unwrap(); tmux.kill_session(None, None, Some("session_name")).unwrap();
Misc
-
Versions below
0.1.0
are first public releases, mostly for development and testing purposes. Do not use them in your Projects. -
Used in mosaic - tmux manager
Testing
The library was tested under following conditions.
Tmux:
- tmux 3.0a
Rust:
- stable (manually, Travis CI)
- beta (Travis CI)
- nightly (Travis CI)
OS:
- Debian 11 Bullseye, x64 (manually)
- Ubuntu 16.04 Xenial Xerus, x64 (Travis CI)
- MacOS 10.13.6 High Sierra, x64 (Travis CI)
Directory Structure
-
src/
- crate sources-
Common:
tmux_interface.rs
- common functionserror.rs
- error propagating functionslib.rs
- main library file
-
TMUX functions (structure similar to TMUX manual):
-
Unit tests for functions and their parts:
-
Parsing functions:
sessions.rs
- parse a session listsession.rs
- parse a sessionsession_stack.rs
- session stackwindows.rs
- parse a windows listwindow.rs
- parse a windowwindow_flag.rs
- window flagpanes.rs
- parse a panes listpane.rs
- parse a panepane_tabs.rs
- pane tabstmux_option.rs
- parse an optionversion.rs
- parse version responselayout_cell.rs
- parse layout cell stringlayout_checksum.rs
- calculate layout checksumlayout.rs
- parse layot tree string
-
Unit tests for parsing functions:
-
-
tests/
- crate integration tests (multiple functions):issue1.rs
- issue #1 testssessions_tests.rs
- sessions testswindows_tests.rs
- windows testspanes_tests.rs
- panes teststmux_error_mock.sh
- bash script for testing of tmux error handling functionstmux_interface.rs
tmux_mock.sh
- bash script can be used instead of tmux binary, for simple logging (sniffing) intercommmunication between library functions and tmuxtmux_test.sh
- bash script for output testing of tmux functions
-
Cargo.toml
- crate configuration (File Format) -
CHANGELOG.md
- version history -
clippy.toml
- Clippy configuration file (Clippy) -
.editorconfig
- consistent coding style configuration (File Format) -
LICENSE.md
- license text -
README.md
- common information (this file) -
ROADMAP.md
- future goals, wishlist, ideas -
rustfmt.toml
- rustfmt configuration file (rustfmt) -
rust-toolchain
- rustup toolchain configuration file (rustup) -
.travis.yml
- travis CI configuration (File Format)
Contributing
If you are interested in this project and you have:
- a bug report
- any feature suggestion
- nice code contribution
- an improvment idea
- ...
You are allways welcome, please feel free to use following links to contact me and/or to contribute to the project:
License
tmux_interface is licensed under the MIT license. Please read the license file in this repository for more information.