Use G3Status formatting for /project loading message

Changed from 'Project loaded: ✓ file1  ✓ file2' to
'g3: loading <project-name> .. ✓ file1  ✓ file2 .. [done]'

- Add G3Status::loading_project() for consistent status formatting
- Update /project command to use new formatting
- Remove unused crossterm imports from commands.rs
This commit is contained in:
Dhanji R. Prasanna
2026-01-22 21:03:46 +05:30
parent a488a6aa99
commit dfdc21c3cf
2 changed files with 18 additions and 7 deletions

View File

@@ -5,7 +5,6 @@
use anyhow::Result; use anyhow::Result;
use rustyline::Editor; use rustyline::Editor;
use std::path::PathBuf; use std::path::PathBuf;
use crossterm::style::{Color, SetForegroundColor, ResetColor};
use g3_core::ui_writer::UiWriter; use g3_core::ui_writer::UiWriter;
use g3_core::Agent; use g3_core::Agent;
@@ -369,12 +368,9 @@ pub async fn handle_command<W: UiWriter>(
agent.ui_writer().set_project_path(project.path.clone(), project_name); agent.ui_writer().set_project_path(project.path.clone(), project_name);
// Print loaded status // Print loaded status
print!( let project_name = project.path.file_name()
"{}Project loaded:{} {}\n", .and_then(|n| n.to_str()).unwrap_or("project");
SetForegroundColor(Color::Green), G3Status::loading_project(project_name, &project.format_loaded_status());
ResetColor,
project.format_loaded_status()
);
// Store active project // Store active project
*active_project = Some(project); *active_project = Some(project);

View File

@@ -269,6 +269,21 @@ impl G3Status {
); );
Self::status(&status); Self::status(&status);
} }
/// Print project loading status: "g3: loading <project-name> .. ✓ file1 ✓ file2 .. [done]"
///
/// Used by the /project command to show what project files were loaded.
pub fn loading_project(project_name: &str, loaded_files_status: &str) {
print!(
"{} loading {}{}{} .. {} ..",
Self::format_prefix(),
SetForegroundColor(Color::Cyan),
project_name,
ResetColor,
loaded_files_status
);
Self::done();
}
} }
#[cfg(test)] #[cfg(test)]