From 8b20395b3e8e4d263687e18f2350e10999557b34 Mon Sep 17 00:00:00 2001 From: Mark Date: Sat, 5 Aug 2023 10:05:37 -0700 Subject: [PATCH] Minor cleanup --- src/{entry => entrypoint}/mod.rs | 4 +++- src/{entry => entrypoint}/unix/mod.rs | 0 src/{entry => entrypoint}/unix/promptbuffer.rs | 0 src/{entry => entrypoint}/unix/unix.rs | 17 ----------------- src/main.rs | 8 +++++--- 5 files changed, 8 insertions(+), 21 deletions(-) rename src/{entry => entrypoint}/mod.rs (63%) rename src/{entry => entrypoint}/unix/mod.rs (100%) rename src/{entry => entrypoint}/unix/promptbuffer.rs (100%) rename src/{entry => entrypoint}/unix/unix.rs (87%) diff --git a/src/entry/mod.rs b/src/entrypoint/mod.rs similarity index 63% rename from src/entry/mod.rs rename to src/entrypoint/mod.rs index 10003b7..54ff10f 100644 --- a/src/entry/mod.rs +++ b/src/entrypoint/mod.rs @@ -1,10 +1,12 @@ + +// Select main script for target system cfg_if::cfg_if! { if #[cfg(target_family = "unix")] { mod unix; pub use unix::main as main_e; } else { - pub fn main_e () -> Result<(), std::io::Error> { + pub fn main_e() -> Result<(), std::io::Error> { unimplemented!("Not yet implemented."); } } diff --git a/src/entry/unix/mod.rs b/src/entrypoint/unix/mod.rs similarity index 100% rename from src/entry/unix/mod.rs rename to src/entrypoint/unix/mod.rs diff --git a/src/entry/unix/promptbuffer.rs b/src/entrypoint/unix/promptbuffer.rs similarity index 100% rename from src/entry/unix/promptbuffer.rs rename to src/entrypoint/unix/promptbuffer.rs diff --git a/src/entry/unix/unix.rs b/src/entrypoint/unix/unix.rs similarity index 87% rename from src/entry/unix/unix.rs rename to src/entrypoint/unix/unix.rs index b6e5d43..2df098e 100644 --- a/src/entry/unix/unix.rs +++ b/src/entrypoint/unix/unix.rs @@ -13,17 +13,6 @@ use super::promptbuffer::PromptBuffer; use crate::command; use crate::context::Context; -/* -Make this a macro: - #[cfg(debug_assertions)] - RawTerminal::suspend_raw_mode(&stdout).unwrap(); - - code - - #[cfg(debug_assertions)] - RawTerminal::activate_raw_mode(&stdout).unwrap(); -*/ - #[inline(always)] pub fn main() -> Result<(), std::io::Error> { @@ -43,12 +32,6 @@ pub fn main() -> Result<(), std::io::Error> { return Ok(()); } - - //let size = termion::terminal_size().unwrap(); - //write!(stdout, "{:?}", size).unwrap(); - - - 'outer: loop { pb.write_prompt(&mut stdout, &context)?; diff --git a/src/main.rs b/src/main.rs index 699e293..fa97ee6 100644 --- a/src/main.rs +++ b/src/main.rs @@ -6,15 +6,17 @@ pub mod context; pub mod errors; pub mod formattedtext; -mod entry; -use crate::entry::main_e; - use crate::parser::substitute; use crate::errors::DaisyError; use crate::formattedtext::FormattedText; use crate::context::Context; use crate::parser::LineLocation; + +// Run main script for target system +mod entrypoint; +use crate::entrypoint::main_e; + #[cfg(test)] mod tests;