fix(cli): 🚑 formatting issues

This commit is contained in:
Lucas Colombo 2024-09-17 17:50:27 -03:00
parent 5929ae514e
commit c6e5b319b3
Signed by: lucas
GPG Key ID: EF34786CFEFFAE35

View File

@ -1,70 +1,72 @@
mod framework { mod framework {
pub mod app; pub mod app;
pub mod component; pub mod component;
pub mod events; pub mod events;
pub mod keyboard; pub mod keyboard;
pub mod tui; pub mod tui;
} }
use {eyre::Result, palette::rgb::Rgb, ratatui::style::Color, std::str::FromStr}; use {eyre::Result, palette::rgb::Rgb, ratatui::style::Color, std::str::FromStr};
pub use framework::app::{App, Kb}; pub use framework::{
pub use framework::component::{Children, Component}; app::{App, Kb},
pub use framework::events::{Action, Event}; component::{Children, Component},
pub use framework::keyboard::KeyBindings; events::{Action, Event},
pub use framework::tui::{Frame, Tui, IO}; keyboard::KeyBindings,
tui::{Frame, Tui, IO},
pub mod utils { };
pub mod component {
pub use super::super::framework::component::{ pub mod utils {
child_downcast, child_downcast_mut, init_children, pass_action_handler_to_children, pub mod component {
pass_message_to_children, update_children, pub use super::super::framework::component::{
}; child_downcast, child_downcast_mut, init_children, pass_action_handler_to_children,
} pass_message_to_children, update_children,
};
pub mod keyboard { }
pub use super::super::framework::keyboard::{key_event_to_string, parse_key_sequence};
} pub mod keyboard {
} pub use super::super::framework::keyboard::{key_event_to_string, parse_key_sequence};
}
// ratatui prelude }
pub mod rataui {
pub use ratatui::prelude::*; // ratatui prelude
} pub mod rataui {
pub use ratatui::prelude::*;
#[macro_export] }
macro_rules! components {
( $( $x:expr $( => $t:ty )* ),* ) => { #[macro_export]
{ macro_rules! components {
let mut temp_vec = Vec::new(); ( $( $x:expr $( => $t:ty )* ),* ) => {
$( {
temp_vec.push( let mut temp_vec = Vec::new();
Box::new($x) $(
as Box<dyn lool::cli::tui::framework::component::Component $( $t + )* > temp_vec.push(
); Box::new($x)
)* as Box<dyn lool::cli::tui::framework::component::Component $( $t + )* >
temp_vec );
} )*
}; temp_vec
} }
};
#[macro_export] }
macro_rules! children {
( $( $name:expr => $value:expr ),* ) => { #[macro_export]
{ macro_rules! children {
let mut map = std::collections::HashMap::new(); ( $( $name:expr => $value:expr ),* ) => {
$( {
map.insert( let mut map = std::collections::HashMap::new();
$name.to_string(), $(
Box::new($value) as Box<dyn lool::cli::tui::framework::component::Component> map.insert(
); $name.to_string(),
)* Box::new($value) as Box<dyn lool::cli::tui::framework::component::Component>
map );
} )*
}; map
} }
};
pub fn rgb(hex: &str) -> Result<Color> { }
let rgb: Rgb<u8, u8> = Rgb::from_str(hex)?;
Ok(Color::Rgb(rgb.red, rgb.green, rgb.blue)) pub fn rgb(hex: &str) -> Result<Color> {
} let rgb: Rgb<u8, u8> = Rgb::from_str(hex)?;
Ok(Color::Rgb(rgb.red, rgb.green, rgb.blue))
}