### Run Basic Example Source: https://github.com/tatounee/ratatui-explorer/blob/master/README.md Demonstrates the simplest usage of the ratatui-explorer library with the crossterm backend. This command compiles and runs the 'basic' example provided with the library. ```shell cargo run --example basic ``` -------------------------------- ### Install ratatui-explorer Dependencies Source: https://github.com/tatounee/ratatui-explorer/blob/master/README.md Shows the Cargo command to add the ratatui-explorer library along with ratatui and crossterm as dependencies to a Rust project. This is the initial setup step for using the library. ```plaintext cargo add ratatui ratatui-explorer crossterm ``` -------------------------------- ### Run Light and Dark Theme Example Source: https://github.com/tatounee/ratatui-explorer/blob/master/README.md Executes an example showcasing how to switch between custom themes within the ratatui-explorer file explorer. This allows for dynamic visual changes during runtime. ```shell cargo run --example light_and_dark_theme ``` -------------------------------- ### Basic ratatui-explorer Implementation Source: https://github.com/tatounee/ratatui-explorer/blob/master/README.md Provides a fundamental example of setting up and running a file explorer using ratatui-explorer and the crossterm backend. It covers enabling raw mode, entering the alternate screen, rendering the widget, and handling basic key events for navigation and quitting. ```rust use std::io::{self, stdout}; use crossterm::{ event::{read, Event, KeyCode}, terminal::{disable_raw_mode, enable_raw_mode, EnterAlternateScreen, LeaveAlternateScreen}, ExecutableCommand, }; use ratatui::prelude::*; use ratatui_explorer::{FileExplorer, Theme}; fn main() -> io::Result<()> { enable_raw_mode()?; stdout().execute(EnterAlternateScreen)?; let mut terminal = Terminal::new(CrosstermBackend::new(stdout()))?; // Create a new file explorer with the default theme and title. let theme = Theme::default().add_default_title(); let mut file_explorer = FileExplorer::with_theme(theme)?; loop { // Render the file explorer widget. terminal.draw(|f| { f.render_widget(&file_explorer.widget(), f.area()); })?; // Read the next event from the terminal. let event = read()?; if let Event::Key(key) = event { if key.code == KeyCode::Char('q') { break; } } // Handle the event in the file explorer. file_explorer.handle(&event)?; } disable_raw_mode()?; stdout().execute(LeaveAlternateScreen)?; Ok(()) } ``` -------------------------------- ### Run File Preview Example Source: https://github.com/tatounee/ratatui-explorer/blob/master/README.md Launches an example that adapts the file explorer's interface based on the currently selected file. This feature allows for displaying file-specific information or previews. ```shell cargo run --example file_preview ``` -------------------------------- ### Customize ratatui-explorer Theme Source: https://github.com/tatounee/ratatui-explorer/blob/master/README.md Illustrates how to customize the appearance of the ratatui-explorer widget using the `Theme` struct. This includes setting default titles, adding dynamic titles based on file count, applying block borders, styling highlighted items and directories, and defining a custom highlight symbol. ```rust use ratatui::{prelude::*, widgets::*}; use ratatui_explorer::Theme; let theme = Theme::default() .add_default_title() .with_title_bottom(|fe| format!("[{} files]", fe.files().len()).into()) .with_block(Block::default().borders(Borders::ALL).border_type(BorderType::Rounded)) .with_highlight_item_style(Style::default().fg(Color::Yellow).add_modifier(Modifier::BOLD)) .with_highlight_dir_style(Style::default().fg(Color::Red).add_modifier(Modifier::BOLD)) .with_highlight_symbol("> ".into()); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.