Rusty-tui 0.1.0

A simple TUI library for making CLI applications with ease.
Documentation
# Example Usage of Label and InputBox

In this example, we will demonstrate how to create a simple terminal user interface (TUI) application using the `Label` and `InputBox` structs from our library. This application will prompt the user to enter their name and then greet them with a label.

## Prerequisites

Ensure you have Rust installed on your machine. If you haven’t set up a project yet, you can create one using:

```bash
cargo new tui_example
cd tui_example
```

Then, add your library as a dependency in `Cargo.toml`.

## Example Code

Here’s a complete example that utilizes both the `Label` and `InputBox` structs:

```rust
use std::io::{self, Write}; // Importing necessary modules for input/output operations
mod labels; // Assuming Label is in labels.rs
mod input_box; // Assuming InputBox is in input_box.rs

fn main() -> io::Result<()> {
    // Create a label to prompt the user
    let prompt_label = labels::Label::new("Please enter your name:", 5, 5);
    let mut input_box = input_box::InputBox::new("", "Enter your name...", 5, 7);

    // Draw the prompt label
    let mut stdout = io::stdout();
    prompt_label.draw(&mut stdout)?;

    // Get user input
    let user_name = input_box.get_input()?;

    // Create a greeting label
    let greeting_label = labels::Label::new(&format!("Hello, {}!", user_name), 5, 9);

    // Draw the greeting label
    greeting_label.draw(&mut stdout)?;

    Ok(())
}
```

## Explanation of the Code

1. **Importing Modules**: We start by importing necessary modules for input and output operations. We also include our `Label` and `InputBox` modules.

2. **Creating a Label**: We create a `Label` instance to prompt the user to enter their name.

3. **Creating an Input Box**: An `InputBox` instance is created, initialized with an empty string and a placeholder.

4. **Drawing the Prompt**: We use the `draw` method to display the prompt label on the console.

5. **Getting User Input**: The `get_input` method of `InputBox` is called to retrieve the user’s name.

6. **Creating a Greeting**: After the user inputs their name, we create another `Label` instance to greet the user.

7. **Displaying the Greeting**: Finally, we draw the greeting label on the console.

## Running the Example

To run the example, navigate to your project directory and execute the following command:

```bash
cargo run
```

This will compile your project and run the TUI application. You should see the prompt asking for your name, and after entering it, a greeting will be displayed.