#tmux #interface #cli-interface

tmux_interface

Rust language library for communication with TMUX via CLI

13 releases

0.3.2 Mar 4, 2024
0.3.1 Jul 16, 2023
0.3.0 May 31, 2023
0.2.1 Aug 7, 2021
0.0.5 Jul 23, 2019

#45 in Command-line interface

Download history 175/week @ 2024-06-11 154/week @ 2024-06-18 219/week @ 2024-06-25 191/week @ 2024-07-02 179/week @ 2024-07-09 246/week @ 2024-07-16 183/week @ 2024-07-23 284/week @ 2024-07-30 218/week @ 2024-08-06 207/week @ 2024-08-13 281/week @ 2024-08-20 341/week @ 2024-08-27 220/week @ 2024-09-03 267/week @ 2024-09-10 199/week @ 2024-09-17 340/week @ 2024-09-24

1,053 downloads per month
Used in 12 crates

MIT license

3MB
55K SLoC

tmux_interface

Build Status Crates.io Documentation

Description

tmux_interface is a library for communication with TMUX via CLI written in Rust programming language. The crate documentation can be found on the docs.rs page.

Usage

  1. Add a dependency in your Cargo.toml. Versions below 1.0.0 are mostly for development and testing purposes (use them in your projects on your own risk, further versions may have different API).

    [dependencies]
    tmux_interface = "1.0.0"
    
  2. Add extern crate in your source file.

    extern crate tmux_interface;
    
  3. Use it's functions

    Example 1

    use tmux_interface::{HasSession, KillSession, NewSession, NewWindow, SplitWindow, Tmux};
    
    let target_session = "example_1";
    
    // tmux new -d -s example_1 ; neww ; splitw -v
    Tmux::new()
        .add_command(NewSession::new().detached().session_name(target_session))
        .add_command(NewWindow::new())
        .add_command(SplitWindow::new().vertical())
        .output()
        .unwrap();
    
    // tmux has -t example_1
    let status = Tmux::with_command(HasSession::new().target_session(target_session))
        .status()
        .unwrap()
        .success();
    
    assert!(status);
    
    // tmux kill-session -t example_1
    Tmux::with_command(KillSession::new().target_session(target_session))
        .output()
        .unwrap();
    
    

Testing

The library is still in experimental development stage (unstable).

  • many features are unimplemented or not well tested
  • some APIs/structures/names/... can be changed in the future
  • some design patterns of the library can be changed
  • almost all library documentation is missing at the moment
  • ...

The library was tested using GitHub Actions under following conditions:

  • OS:

    • Linux (Ubuntu 20.04.2 LTS Focal Fossa, x64)
    • Windows
    • MacOS (10.13.6 High Sierra, x64)
  • Rust:

    • stable
    • beta
    • nightly
  • Tmux (covered tmux versions crate features):

    • master - tmux_X_X
    • 3.3a - tmux_3_3a
    • 3.3 - tmux_3_3
    • 3.2a - tmux_3_2a
    • 3.2 - tmux_3_2
    • 3.1c - tmux_3_1c
    • 3.1b - tmux_3_1b
    • 3.1a - tmux_3_1a
    • 3.1 - tmux_3_1
    • 3.0a - tmux_3_0a
    • 3.0 - tmux_3_0
    • 2.9a - tmux_2_9a
    • 2.9 - tmux_2_9
    • 2.8 - tmux_2_8
    • 2.7 - tmux_2_7
    • 2.6 - tmux_2_6
    • 2.5 - tmux_2_5
    • 2.4 - tmux_2_4
    • 2.3 - tmux_2_3
    • 2.2 - tmux_2_2
    • 2.1 - tmux_2_1
    • 2.0 - tmux_2_0
    • 1.9a - tmux_1_9a
    • 1.9 - tmux_1_9
    • 1.8 - tmux_1_8
    • 1.7 - tmux_1_7
    • 1.6 - tmux_1_6
    • 1.5 - tmux_1_5
    • 1.4 - tmux_1_4 - tmux compilation error
    • 1.3 - tmux_1_3 - tmux compilation error
    • 1.2 - tmux_1_2 - tmux compilation error
    • 1.1 - tmux_1_1 - tmux compilation error
    • 1.0 - tmux_1_0 - tmux compilation error
    • 0.9 - tmux_0_9 - tmux compilation error
    • 0.8 - tmux_0_8 - tmux compilation error

Contributors

License

tmux_interface library is licensed under the MIT license. Please read the license file in the repository for more information.

See also

No runtime deps

Features