Add bin directory.

This commit is contained in:
2026-02-28 14:38:42 -05:00
parent 1c3e3753d7
commit ed31ba7600
20 changed files with 86 additions and 90 deletions

View File

@@ -5,7 +5,7 @@ edition = "2024"
[[bin]] [[bin]]
name = "clide" name = "clide"
path = "src/main.rs" path = "src/bin/clide/main.rs"
[workspace] [workspace]
resolver = "3" resolver = "3"

View File

@@ -28,6 +28,6 @@ fn main() {
.qt_module("Svg") .qt_module("Svg")
.qt_module("Xml") .qt_module("Xml")
.qrc("./resources.qrc") .qrc("./resources.qrc")
.files(["src/ide/gui/colors.rs", "src/ide/gui/filesystem.rs"]) .files(["src/bin/clide/gui/colors.rs", "src/bin/clide/gui/filesystem.rs"])
.build(); .build();
} }

View File

@@ -15,7 +15,7 @@ pub fn loggable(item: TokenStream) -> TokenStream {
let (impl_generics, type_generics, where_clause) = generics.split_for_impl(); let (impl_generics, type_generics, where_clause) = generics.split_for_impl();
let struct_name_str = struct_name.to_string(); let struct_name_str = struct_name.to_string();
let expanded = quote! { let expanded = quote! {
impl #impl_generics crate::logging::Loggable for #struct_name #type_generics #where_clause { impl #impl_generics clide::logging::Loggable for #struct_name #type_generics #where_clause {
const ID: &'static str = #struct_name_str; const ID: &'static str = #struct_name_str;
} }
}; };

View File

@@ -4,7 +4,7 @@
pub mod app_context; pub mod app_context;
use crate::ide::cli::app_context::RunMode; use crate::cli::app_context::RunMode;
use anyhow::{Result, anyhow}; use anyhow::{Result, anyhow};
use clap::Parser; use clap::Parser;

View File

@@ -2,7 +2,7 @@
// //
// SPDX-License-Identifier: GNU General Public License v3.0 or later // SPDX-License-Identifier: GNU General Public License v3.0 or later
use crate::ide::cli::Cli; use crate::cli::Cli;
use anyhow::{Context, Result}; use anyhow::{Context, Result};
pub struct AppContext { pub struct AppContext {
@@ -18,7 +18,7 @@ impl AppContext {
// If no path was provided, use the current directory. // If no path was provided, use the current directory.
None => std::env::current_dir().context("Failed to obtain current directory")?, None => std::env::current_dir().context("Failed to obtain current directory")?,
}; };
crate::info!(target:"main()", "Root path detected: {path:?}"); clide::info!(target:"main()", "Root path detected: {path:?}");
Ok(Self { Ok(Self {
path, path,

View File

@@ -6,12 +6,12 @@ pub mod colors;
pub mod filesystem; pub mod filesystem;
pub mod icon_provider; pub mod icon_provider;
use crate::ide::cli::app_context::AppContext; use crate::cli::app_context::AppContext;
use anyhow::Result; use anyhow::Result;
use cxx_qt_lib::{QMapPair, QMapPair_QString_QVariant, QString, QVariant}; use cxx_qt_lib::{QMapPair, QMapPair_QString_QVariant, QString, QVariant};
pub fn run(app_context: AppContext) -> Result<()> { pub fn run(app_context: AppContext) -> Result<()> {
crate::trace!(target:"gui::run()", "Starting the GUI editor at {:?}", app_context.path); clide::trace!(target:"gui::run()", "Starting the GUI editor at {:?}", app_context.path);
use cxx_qt_lib::{QGuiApplication, QQmlApplicationEngine, QUrl}; use cxx_qt_lib::{QGuiApplication, QQmlApplicationEngine, QUrl};

View File

@@ -2,7 +2,7 @@
// //
// SPDX-License-Identifier: GNU General Public License v3.0 or later // SPDX-License-Identifier: GNU General Public License v3.0 or later
use crate::theme::colors::Colors; use clide::theme::colors::Colors;
use cxx_qt_lib::QColor; use cxx_qt_lib::QColor;
#[cxx_qt::bridge] #[cxx_qt::bridge]

View File

@@ -76,7 +76,7 @@ impl qobject::FileSystem {
let meta = fs::metadata(path.to_string()) let meta = fs::metadata(path.to_string())
.unwrap_or_else(|_| panic!("Failed to get file metadata {path:?}")); .unwrap_or_else(|_| panic!("Failed to get file metadata {path:?}"));
if !meta.is_file() { if !meta.is_file() {
crate::warn!(target:"FileSystem", "Attempted to open file {path:?} that is not a valid file"); clide::warn!(target:"FileSystem", "Attempted to open file {path:?} that is not a valid file");
return QString::default(); return QString::default();
} }
let path_str = path.to_string(); let path_str = path.to_string();
@@ -141,6 +141,6 @@ impl qobject::FileSystem {
} }
fn icon(self: std::pin::Pin<&mut Self>, path: &QString) -> QString { fn icon(self: std::pin::Pin<&mut Self>, path: &QString) -> QString {
QString::from(crate::fs::icon(path.to_string().as_str()).to_string()) QString::from(clide::fs::icon(path.to_string().as_str()).to_string())
} }
} }

View File

@@ -2,18 +2,22 @@
// //
// SPDX-License-Identifier: GNU General Public License v3.0 or later // SPDX-License-Identifier: GNU General Public License v3.0 or later
mod cli;
mod gui;
mod tui;
use anyhow::{Context, Result}; use anyhow::{Context, Result};
use clap::Parser; use clap::Parser;
use clide::ide::cli::Cli; use cli::Cli;
use clide::ide::cli::app_context::{AppContext, RunMode}; use cli::app_context::{AppContext, RunMode};
use std::process::{Command, Stdio}; use std::process::{Command, Stdio};
fn main() -> Result<()> { fn main() -> Result<()> {
let args = Cli::parse(); let args = Cli::parse();
let app_context = AppContext::new(args)?; let app_context = AppContext::new(args)?;
match app_context.run_mode { match app_context.run_mode {
RunMode::GuiAttached => clide::ide::gui::run(app_context), RunMode::GuiAttached => gui::run(app_context),
RunMode::Tui => clide::ide::tui::run(app_context), RunMode::Tui => tui::run(app_context),
RunMode::Gui => { RunMode::Gui => {
clide::trace!(target:"main()", "Starting GUI in a new process"); clide::trace!(target:"main()", "Starting GUI in a new process");
Command::new(std::env::current_exe()?) Command::new(std::env::current_exe()?)

View File

@@ -11,10 +11,10 @@ pub mod explorer;
pub mod logger; pub mod logger;
pub mod menu_bar; pub mod menu_bar;
use crate::ide::cli::app_context::AppContext; use crate::cli::app_context::AppContext;
use crate::logging::Loggable;
use ::log::LevelFilter; use ::log::LevelFilter;
use anyhow::{Context, Result}; use anyhow::{Context, Result};
use clide::logging::Loggable;
use ratatui::Terminal; use ratatui::Terminal;
use ratatui::backend::CrosstermBackend; use ratatui::backend::CrosstermBackend;
use ratatui::crossterm::event::{ use ratatui::crossterm::event::{
@@ -36,7 +36,7 @@ struct Tui {
} }
pub fn run(app_context: AppContext) -> Result<()> { pub fn run(app_context: AppContext) -> Result<()> {
crate::trace!(target: "clide::tui::run", "Starting TUI"); clide::trace!(target: "clide::tui::run", "Starting TUI");
Tui::new(app_context)?.start() Tui::new(app_context)?.start()
} }
@@ -44,7 +44,7 @@ impl Tui {
fn new(app_context: AppContext) -> Result<Self> { fn new(app_context: AppContext) -> Result<Self> {
init_logger(LevelFilter::Trace)?; init_logger(LevelFilter::Trace)?;
set_default_level(LevelFilter::Trace); set_default_level(LevelFilter::Trace);
crate::debug!("Logging initialized"); clide::debug!("Logging initialized");
let mut dir = env::temp_dir(); let mut dir = env::temp_dir();
dir.push("clide.log"); dir.push("clide.log");
@@ -56,7 +56,7 @@ impl Tui {
.output_file(false) .output_file(false)
.output_separator(':'); .output_separator(':');
set_log_file(file_options); set_log_file(file_options);
crate::debug!("Logging to file: {dir:?}"); clide::debug!("Logging to file: {dir:?}");
Ok(Self { Ok(Self {
terminal: Terminal::new(CrosstermBackend::new(stdout()))?, terminal: Terminal::new(CrosstermBackend::new(stdout()))?,
@@ -65,7 +65,7 @@ impl Tui {
} }
fn start(self) -> Result<()> { fn start(self) -> Result<()> {
crate::info!("Starting the TUI editor at {:?}", self.root_path); clide::info!("Starting the TUI editor at {:?}", self.root_path);
ratatui::crossterm::execute!( ratatui::crossterm::execute!(
stdout(), stdout(),
EnterAlternateScreen, EnterAlternateScreen,
@@ -82,7 +82,7 @@ impl Tui {
} }
fn stop() -> Result<()> { fn stop() -> Result<()> {
crate::info!("Stopping the TUI editor"); clide::info!("Stopping the TUI editor");
disable_raw_mode()?; disable_raw_mode()?;
ratatui::crossterm::execute!( ratatui::crossterm::execute!(
stdout(), stdout(),

View File

@@ -2,7 +2,7 @@
// //
// SPDX-License-Identifier: GNU General Public License v3.0 or later // SPDX-License-Identifier: GNU General Public License v3.0 or later
use crate::logging::Loggable; use clide::logging::Loggable;
use ratatui::buffer::Buffer; use ratatui::buffer::Buffer;
use ratatui::layout::{Constraint, Direction, Layout, Rect}; use ratatui::layout::{Constraint, Direction, Layout, Rect};
use ratatui::text::{Line, Span}; use ratatui::text::{Line, Span};
@@ -13,7 +13,7 @@ pub struct About {}
impl About { impl About {
pub fn new() -> Self { pub fn new() -> Self {
// crate::trace!("Building {}", Self::id()); // clide::trace!("Building {}", Self::id());
Self {} Self {}
} }
} }

View File

@@ -2,13 +2,13 @@
// //
// SPDX-License-Identifier: GNU General Public License v3.0 or later // SPDX-License-Identifier: GNU General Public License v3.0 or later
use crate::ide::tui::about::About; use crate::tui::about::About;
use crate::ide::tui::component::{Action, Component, Focus, FocusState, Visibility, VisibleState}; use crate::tui::component::{Action, Component, Focus, FocusState, Visibility, VisibleState};
use crate::ide::tui::editor_tab::EditorTab; use crate::tui::editor_tab::EditorTab;
use crate::ide::tui::explorer::Explorer; use crate::tui::explorer::Explorer;
use crate::ide::tui::logger::Logger; use crate::tui::logger::Logger;
use crate::ide::tui::menu_bar::MenuBar; use crate::tui::menu_bar::MenuBar;
use crate::logging::Loggable; use clide::logging::Loggable;
use anyhow::{Context, Result}; use anyhow::{Context, Result};
use ratatui::DefaultTerminal; use ratatui::DefaultTerminal;
use ratatui::buffer::Buffer; use ratatui::buffer::Buffer;
@@ -42,7 +42,7 @@ pub struct App<'a> {
impl<'a> App<'a> { impl<'a> App<'a> {
pub fn new(root_path: PathBuf) -> Result<Self> { pub fn new(root_path: PathBuf) -> Result<Self> {
crate::trace!("Building {}", Self::ID); clide::trace!("Building");
let app = Self { let app = Self {
editor_tab: EditorTab::new(), editor_tab: EditorTab::new(),
explorer: Explorer::new(&root_path)?, explorer: Explorer::new(&root_path)?,
@@ -56,13 +56,13 @@ impl<'a> App<'a> {
/// Logic that should be executed once on application startup. /// Logic that should be executed once on application startup.
pub fn start(&mut self) -> Result<()> { pub fn start(&mut self) -> Result<()> {
crate::trace!("Starting App"); clide::trace!("Starting App");
Ok(()) Ok(())
} }
pub fn run(mut self, mut terminal: DefaultTerminal) -> Result<()> { pub fn run(mut self, mut terminal: DefaultTerminal) -> Result<()> {
self.start()?; self.start()?;
crate::trace!("Entering App run loop"); clide::trace!("Entering App run loop");
loop { loop {
terminal.draw(|f| { terminal.draw(|f| {
f.render_widget(&mut self, f.area()); f.render_widget(&mut self, f.area());
@@ -88,7 +88,7 @@ impl<'a> App<'a> {
Some(editor) => editor.component_state.help_text.clone(), Some(editor) => editor.component_state.help_text.clone(),
None => { None => {
if !self.editor_tab.is_empty() { if !self.editor_tab.is_empty() {
crate::error!("Failed to get Editor while drawing bottom status bar"); clide::error!("Failed to get Editor while drawing bottom status bar");
} }
"Failed to get current Editor while getting widget help text".to_string() "Failed to get current Editor while getting widget help text".to_string()
} }
@@ -112,26 +112,26 @@ impl<'a> App<'a> {
} }
fn clear_focus(&mut self) { fn clear_focus(&mut self) {
crate::info!("Clearing all widget focus"); clide::info!("Clearing all widget focus");
self.explorer.component_state.set_focus(Focus::Inactive); self.explorer.component_state.set_focus(Focus::Inactive);
self.explorer.component_state.set_focus(Focus::Inactive); self.explorer.component_state.set_focus(Focus::Inactive);
self.logger.component_state.set_focus(Focus::Inactive); self.logger.component_state.set_focus(Focus::Inactive);
self.menu_bar.component_state.set_focus(Focus::Inactive); self.menu_bar.component_state.set_focus(Focus::Inactive);
match self.editor_tab.current_editor_mut() { match self.editor_tab.current_editor_mut() {
None => { None => {
crate::error!("Failed to get current Editor while clearing focus") clide::error!("Failed to get current Editor while clearing focus")
} }
Some(editor) => editor.component_state.set_focus(Focus::Inactive), Some(editor) => editor.component_state.set_focus(Focus::Inactive),
} }
} }
fn change_focus(&mut self, focus: AppComponent) { fn change_focus(&mut self, focus: AppComponent) {
crate::info!("Changing widget focus to {:?}", focus); clide::info!("Changing widget focus to {:?}", focus);
self.clear_focus(); self.clear_focus();
match focus { match focus {
AppComponent::Editor => match self.editor_tab.current_editor_mut() { AppComponent::Editor => match self.editor_tab.current_editor_mut() {
None => { None => {
crate::error!("Failed to get current Editor while changing focus") clide::error!("Failed to get current Editor while changing focus")
} }
Some(editor) => editor.component_state.set_focus(Focus::Active), Some(editor) => editor.component_state.set_focus(Focus::Active),
}, },
@@ -274,13 +274,13 @@ impl<'a> Component for App<'a> {
Action::Quit | Action::Handled => Ok(action), Action::Quit | Action::Handled => Ok(action),
Action::Save => match self.editor_tab.current_editor_mut() { Action::Save => match self.editor_tab.current_editor_mut() {
None => { None => {
crate::error!("Failed to get current editor while handling App Action::Save"); clide::error!("Failed to get current editor while handling App Action::Save");
Ok(Action::Noop) Ok(Action::Noop)
} }
Some(editor) => match editor.save() { Some(editor) => match editor.save() {
Ok(_) => Ok(Action::Handled), Ok(_) => Ok(Action::Handled),
Err(e) => { Err(e) => {
crate::error!("Failed to save editor contents: {e}"); clide::error!("Failed to save editor contents: {e}");
Ok(Action::Noop) Ok(Action::Noop)
} }
}, },
@@ -299,14 +299,14 @@ impl<'a> Component for App<'a> {
Err(_) => Ok(Action::Noop), Err(_) => Ok(Action::Noop),
}, },
Action::ReloadFile => { Action::ReloadFile => {
crate::trace!("Reloading file for current editor"); clide::trace!("Reloading file for current editor");
if let Some(editor) = self.editor_tab.current_editor_mut() { if let Some(editor) = self.editor_tab.current_editor_mut() {
editor editor
.reload_contents() .reload_contents()
.map(|_| Action::Handled) .map(|_| Action::Handled)
.context("Failed to handle Action::ReloadFile") .context("Failed to handle Action::ReloadFile")
} else { } else {
crate::error!( clide::error!(
"Failed to get current editor while handling App Action::ReloadFile" "Failed to get current editor while handling App Action::ReloadFile"
); );
Ok(Action::Noop) Ok(Action::Noop)

View File

@@ -4,9 +4,9 @@
#![allow(dead_code, unused_variables)] #![allow(dead_code, unused_variables)]
use crate::ide::tui::component::Focus::Inactive; use crate::tui::component::Focus::Inactive;
use crate::logging::Loggable; use clide::logging::Loggable;
use crate::theme::colors::Colors; use clide::theme::colors::Colors;
use Focus::Active; use Focus::Active;
use anyhow::Result; use anyhow::Result;
use ratatui::crossterm::event::{Event, KeyEvent, MouseEvent}; use ratatui::crossterm::event::{Event, KeyEvent, MouseEvent};
@@ -75,7 +75,7 @@ impl ComponentState {
} }
fn new() -> Self { fn new() -> Self {
crate::trace!(target:Self::id(), "Building {}", Self::id()); clide::trace!(target:Self::id(), "Building {}", Self::id());
Self { Self {
focus: Active, focus: Active,
vis: Visibility::Visible, vis: Visibility::Visible,

View File

@@ -2,8 +2,8 @@
// //
// SPDX-License-Identifier: GNU General Public License v3.0 or later // SPDX-License-Identifier: GNU General Public License v3.0 or later
use crate::ide::tui::component::{Action, Component, ComponentState, Focus, FocusState}; use crate::tui::component::{Action, Component, ComponentState, Focus, FocusState};
use crate::logging::Loggable; use clide::logging::Loggable;
use anyhow::{Context, Result, bail}; use anyhow::{Context, Result, bail};
use edtui::{ use edtui::{
EditorEventHandler, EditorState, EditorTheme, EditorView, LineNumbers, Lines, SyntaxHighlighter, EditorEventHandler, EditorState, EditorTheme, EditorView, LineNumbers, Lines, SyntaxHighlighter,
@@ -27,7 +27,7 @@ pub struct Editor {
impl Editor { impl Editor {
pub fn new(path: &std::path::Path) -> Self { pub fn new(path: &std::path::Path) -> Self {
crate::trace!("Building {}", <Self as Loggable>::ID); clide::trace!("Building {}", <Self as Loggable>::ID);
Editor { Editor {
state: EditorState::default(), state: EditorState::default(),
event_handler: EditorEventHandler::default(), event_handler: EditorEventHandler::default(),
@@ -41,10 +41,10 @@ impl Editor {
} }
pub fn reload_contents(&mut self) -> Result<()> { pub fn reload_contents(&mut self) -> Result<()> {
crate::trace!("Reloading editor file contents {:?}", self.file_path); clide::trace!("Reloading editor file contents {:?}", self.file_path);
match self.file_path.clone() { match self.file_path.clone() {
None => { None => {
crate::error!("Failed to reload editor contents with None file_path"); clide::error!("Failed to reload editor contents with None file_path");
bail!("Failed to reload editor contents with None file_path") bail!("Failed to reload editor contents with None file_path")
} }
Some(path) => self.set_contents(&path), Some(path) => self.set_contents(&path),
@@ -52,7 +52,7 @@ impl Editor {
} }
pub fn set_contents(&mut self, path: &std::path::Path) -> Result<()> { pub fn set_contents(&mut self, path: &std::path::Path) -> Result<()> {
crate::trace!("Setting Editor contents from path {:?}", path); clide::trace!("Setting Editor contents from path {:?}", path);
if let Ok(contents) = std::fs::read_to_string(path) { if let Ok(contents) = std::fs::read_to_string(path) {
let lines: Vec<_> = contents let lines: Vec<_> = contents
.lines() .lines()
@@ -68,10 +68,10 @@ impl Editor {
pub fn save(&self) -> Result<()> { pub fn save(&self) -> Result<()> {
if let Some(path) = &self.file_path { if let Some(path) = &self.file_path {
crate::trace!("Saving Editor contents {:?}", path); clide::trace!("Saving Editor contents {:?}", path);
return std::fs::write(path, self.state.lines.to_string()).map_err(|e| e.into()); return std::fs::write(path, self.state.lines.to_string()).map_err(|e| e.into());
}; };
crate::error!("Failed saving Editor contents; file_path was None"); clide::error!("Failed saving Editor contents; file_path was None");
bail!("File not saved. No file path set.") bail!("File not saved. No file path set.")
} }
} }

View File

@@ -2,9 +2,8 @@
// //
// SPDX-License-Identifier: GNU General Public License v3.0 or later // SPDX-License-Identifier: GNU General Public License v3.0 or later
use crate::ide::tui::component::{Action, Component, Focus, FocusState}; use crate::tui::editor::Editor;
use crate::ide::tui::editor::Editor; use clide::logging::Loggable;
use crate::logging::Loggable;
use anyhow::{Context, Result, anyhow}; use anyhow::{Context, Result, anyhow};
use ratatui::buffer::Buffer; use ratatui::buffer::Buffer;
use ratatui::crossterm::event::{Event, KeyCode, KeyEvent, KeyModifiers}; use ratatui::crossterm::event::{Event, KeyCode, KeyEvent, KeyModifiers};
@@ -12,6 +11,7 @@ use ratatui::layout::Rect;
use ratatui::prelude::{Color, Style}; use ratatui::prelude::{Color, Style};
use ratatui::widgets::{Block, Borders, Padding, Tabs, Widget}; use ratatui::widgets::{Block, Borders, Padding, Tabs, Widget};
use std::collections::HashMap; use std::collections::HashMap;
use crate::tui::component::{Action, Component, Focus, FocusState};
// Render the tabs with keys as titles // Render the tabs with keys as titles
// Tab keys can be file names. // Tab keys can be file names.
@@ -25,7 +25,7 @@ pub struct EditorTab {
impl EditorTab { impl EditorTab {
pub fn new() -> Self { pub fn new() -> Self {
crate::trace!("Building {}", <Self as Loggable>::ID); clide::trace!("Building {}", <Self as Loggable>::ID);
Self { Self {
editors: HashMap::new(), editors: HashMap::new(),
tab_order: Vec::new(), tab_order: Vec::new(),
@@ -35,7 +35,7 @@ impl EditorTab {
pub fn next_editor(&mut self) { pub fn next_editor(&mut self) {
let next = (self.current_editor + 1) % self.tab_order.len(); let next = (self.current_editor + 1) % self.tab_order.len();
crate::trace!( clide::trace!(
"Moving from {} to next editor tab at {}", "Moving from {} to next editor tab at {}",
self.current_editor, self.current_editor,
next next
@@ -49,7 +49,7 @@ impl EditorTab {
.current_editor .current_editor
.checked_sub(1) .checked_sub(1)
.unwrap_or(self.tab_order.len() - 1); .unwrap_or(self.tab_order.len() - 1);
crate::trace!( clide::trace!(
"Moving from {} to previous editor tab at {}", "Moving from {} to previous editor tab at {}",
self.current_editor, self.current_editor,
prev prev
@@ -62,7 +62,7 @@ impl EditorTab {
match self.tab_order.get(index) { match self.tab_order.get(index) {
None => { None => {
if !self.tab_order.is_empty() { if !self.tab_order.is_empty() {
crate::error!("Failed to get editor tab key with invalid index {index}"); clide::error!("Failed to get editor tab key with invalid index {index}");
} }
None None
} }
@@ -80,7 +80,7 @@ impl EditorTab {
} }
pub fn set_current_tab_focus(&mut self, focus: Focus) { pub fn set_current_tab_focus(&mut self, focus: Focus) {
crate::trace!( clide::trace!(
"Setting current tab {} focus to {:?}", "Setting current tab {} focus to {:?}",
self.current_editor, self.current_editor,
focus focus
@@ -89,10 +89,10 @@ impl EditorTab {
} }
pub fn set_tab_focus(&mut self, focus: Focus, index: usize) { pub fn set_tab_focus(&mut self, focus: Focus, index: usize) {
crate::trace!("Setting tab {} focus to {:?}", index, focus); clide::trace!("Setting tab {} focus to {:?}", index, focus);
if focus == Focus::Active && index != self.current_editor { if focus == Focus::Active && index != self.current_editor {
// If we are setting another tab to active, disable the current one. // If we are setting another tab to active, disable the current one.
crate::trace!( clide::trace!(
"New tab {} focus set to Active; Setting current tab {} to Inactive", "New tab {} focus set to Active; Setting current tab {} to Inactive",
index, index,
self.current_editor self.current_editor
@@ -101,11 +101,11 @@ impl EditorTab {
} }
match self.get_editor_key(index) { match self.get_editor_key(index) {
None => { None => {
crate::error!("Failed setting tab focus for invalid key {index}"); clide::error!("Failed setting tab focus for invalid key {index}");
} }
Some(key) => match self.editors.get_mut(&key) { Some(key) => match self.editors.get_mut(&key) {
None => { None => {
crate::error!( clide::error!(
"Failed to update tab focus at index {} with invalid key: {}", "Failed to update tab focus at index {} with invalid key: {}",
self.current_editor, self.current_editor,
self.tab_order[self.current_editor] self.tab_order[self.current_editor]
@@ -117,12 +117,12 @@ impl EditorTab {
} }
pub fn open_tab(&mut self, path: &std::path::Path) -> Result<()> { pub fn open_tab(&mut self, path: &std::path::Path) -> Result<()> {
crate::trace!("Opening new EditorTab with path {:?}", path); clide::trace!("Opening new EditorTab with path {:?}", path);
if self if self
.editors .editors
.contains_key(&path.to_string_lossy().to_string()) .contains_key(&path.to_string_lossy().to_string())
{ {
crate::warn!("EditorTab already opened with this file"); clide::warn!("EditorTab already opened with this file");
return Ok(()); return Ok(());
} }
@@ -147,12 +147,12 @@ impl EditorTab {
.to_owned(); .to_owned();
match self.editors.remove(&key) { match self.editors.remove(&key) {
None => { None => {
crate::error!("Failed to remove editor tab {key} with invalid index {index}") clide::error!("Failed to remove editor tab {key} with invalid index {index}")
} }
Some(_) => { Some(_) => {
self.prev_editor(); self.prev_editor();
self.tab_order.remove(index); self.tab_order.remove(index);
crate::info!("Closed editor tab {key} at index {index}") clide::info!("Closed editor tab {key} at index {index}")
} }
} }
Ok(()) Ok(())

View File

@@ -2,10 +2,10 @@
// //
// SPDX-License-Identifier: GNU General Public License v3.0 or later // SPDX-License-Identifier: GNU General Public License v3.0 or later
use crate::fs::entry_meta::EntryMeta; use crate::tui::component::{Action, Component, ComponentState, Focus, FocusState};
use crate::ide::tui::component::{Action, Component, ComponentState, Focus, FocusState};
use crate::logging::Loggable;
use anyhow::{Context, Result, bail}; use anyhow::{Context, Result, bail};
use clide::fs::entry_meta::EntryMeta;
use clide::logging::Loggable;
use ratatui::buffer::Buffer; use ratatui::buffer::Buffer;
use ratatui::crossterm::event::{Event, KeyCode, KeyEvent, MouseEvent, MouseEventKind}; use ratatui::crossterm::event::{Event, KeyCode, KeyEvent, MouseEvent, MouseEventKind};
use ratatui::layout::{Alignment, Position, Rect}; use ratatui::layout::{Alignment, Position, Rect};
@@ -26,7 +26,7 @@ pub struct Explorer<'a> {
impl<'a> Explorer<'a> { impl<'a> Explorer<'a> {
pub fn new(path: &PathBuf) -> Result<Self> { pub fn new(path: &PathBuf) -> Result<Self> {
crate::trace!("Building {}", <Self as Loggable>::ID); clide::trace!("Building {}", <Self as Loggable>::ID);
let explorer = Explorer { let explorer = Explorer {
root_path: EntryMeta::new(path)?, root_path: EntryMeta::new(path)?,
tree_items: Self::build_tree_from_path(path)?, tree_items: Self::build_tree_from_path(path)?,

View File

@@ -2,8 +2,8 @@
// //
// SPDX-License-Identifier: GNU General Public License v3.0 or later // SPDX-License-Identifier: GNU General Public License v3.0 or later
use crate::ide::tui::component::{Action, Component, ComponentState, Focus, FocusState}; use crate::tui::component::{Action, Component, ComponentState, Focus, FocusState};
use crate::logging::Loggable; use clide::logging::Loggable;
use log::LevelFilter; use log::LevelFilter;
use ratatui::buffer::Buffer; use ratatui::buffer::Buffer;
use ratatui::crossterm::event::{Event, KeyCode, KeyEvent}; use ratatui::crossterm::event::{Event, KeyCode, KeyEvent};
@@ -22,7 +22,7 @@ pub struct Logger {
impl Logger { impl Logger {
pub fn new() -> Self { pub fn new() -> Self {
crate::trace!("Building {}", <Self as Loggable>::ID); clide::trace!("Building {}", <Self as Loggable>::ID);
let state = TuiWidgetState::new(); let state = TuiWidgetState::new();
state.transition(TuiWidgetEvent::HideKey); state.transition(TuiWidgetEvent::HideKey);
Self { Self {

View File

@@ -2,11 +2,11 @@
// //
// SPDX-License-Identifier: GNU General Public License v3.0 or later // SPDX-License-Identifier: GNU General Public License v3.0 or later
use crate::ide::tui::component::{Action, Component, ComponentState, FocusState}; use crate::tui::component::{Action, Component, ComponentState, FocusState};
use crate::ide::tui::menu_bar::MenuBarItemOption::{ use crate::tui::menu_bar::MenuBarItemOption::{
About, CloseTab, Exit, Reload, Save, ShowHideExplorer, ShowHideLogger, About, CloseTab, Exit, Reload, Save, ShowHideExplorer, ShowHideLogger,
}; };
use crate::logging::Loggable; use clide::logging::Loggable;
use anyhow::Context; use anyhow::Context;
use ratatui::buffer::Buffer; use ratatui::buffer::Buffer;
use ratatui::crossterm::event::{KeyCode, KeyEvent}; use ratatui::crossterm::event::{KeyCode, KeyEvent};
@@ -92,7 +92,7 @@ pub struct MenuBar {
impl MenuBar { impl MenuBar {
const DEFAULT_HELP: &str = "(←/h)/(→/l): Select option | Enter: Choose selection"; const DEFAULT_HELP: &str = "(←/h)/(→/l): Select option | Enter: Choose selection";
pub fn new() -> Self { pub fn new() -> Self {
crate::trace!("Building"); clide::trace!("Building");
Self { Self {
selected: MenuBarItem::File, selected: MenuBarItem::File,
opened: None, opened: None,

View File

@@ -1,7 +0,0 @@
// SPDX-FileCopyrightText: 2026, Shaun Reed <shaunrd0@gmail.com>
//
// SPDX-License-Identifier: GNU General Public License v3.0 or later
pub mod cli;
pub mod gui;
pub mod tui;

View File

@@ -3,6 +3,5 @@
// SPDX-License-Identifier: GNU General Public License v3.0 or later // SPDX-License-Identifier: GNU General Public License v3.0 or later
pub mod fs; pub mod fs;
pub mod ide;
pub mod logging; pub mod logging;
pub mod theme; pub mod theme;