Contributing

Contributions are welcome! tmux-thumbs is written in Rust. Below are the steps to set up your development environment.

Development Setup

  1. Install Rust: Ensure you have rustc and cargo installed. Rustup is recommended.
  2. Clone the Repo:
    git clone https://github.com/fcsonline/tmux-thumbs
    cd tmux-thumbs

Running Tests

The project uses standard Cargo testing. The tests cover pattern matching regex, alphabet generation, and color parsing.

# Run all tests
cargo test

# Run tests with verbose output
cargo test --verbose

Relevant test files:

  • src/state.rs: Tests regex matching against sample text.
  • src/alphabets.rs: Tests hint generation logic.
  • src/swapper.rs: Tests the shell command execution logic.

Formatting

Please ensure your code is formatted according to the project's style:

cargo fmt --all -- --check

Configuration is defined in .rustfmt.toml.

Project Structure

  • src/main.rs: Entry point for the binary and CLI argument parsing.
  • src/swapper.rs: Logic for handling Tmux pane swapping and command execution.
  • src/state.rs: Core logic for text parsing and regex matching.
  • src/view.rs: Handles the terminal UI rendering (using termion).
  • src/alphabets.rs: Hint character generation.
  • src/colors.rs: ANSI and Hex color handling.