pub struct UI;
Expand description
User interface handler for terminal output
Provides static methods for printing formatted and colored messages to the terminal during the conversation flow.
§Color Scheme
- Blue: Separators and Claude prompt
- Yellow: Title and exit message
- Green: System prompt info, model info, and user prompt
§Examples
use claude_dialog::ui::UI;
// Display welcome screen
UI::print_welcome("Custom system prompt loaded", None);
// Show user prompt (typically followed by user input)
UI::print_user_prompt();
Implementations§
Source§impl UI
impl UI
Sourcepub fn print_welcome(system_prompt_info: &str, model: Option<&String>)
pub fn print_welcome(system_prompt_info: &str, model: Option<&String>)
Print the welcome banner with system information
Displays a formatted welcome message including the system prompt status and optionally the model being used.
§Arguments
system_prompt_info
- Description of the system prompt configurationmodel
- Optional model name to display
§Output Format
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Claude Dialog Shell
System Prompt: [system_prompt_info]
Model: [model] (if provided)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Type 'exit' or 'quit' to end the conversation
§Examples
use claude_dialog::ui::UI;
// With model specified
UI::print_welcome("Using custom prompt from file", Some(&"claude-3-opus".to_string()));
// Without model
UI::print_welcome("Using default system prompt", None);
Sourcepub fn print_user_prompt()
pub fn print_user_prompt()
Print the user input prompt
Displays a colored prompt indicator for user input. This should be called before reading user input.
§Output
Prints “You> “ in green color without a newline.
§Examples
use claude_dialog::ui::UI;
use std::io::{self, Write};
UI::print_user_prompt();
io::stdout().flush().unwrap(); // Ensure prompt is displayed
// User types their input here
Sourcepub fn print_claude_prompt()
pub fn print_claude_prompt()
Print the Claude response prompt
Displays a colored prompt indicator before Claude’s response. This should be called before executing the Claude command.
§Output
Prints “Claude>” in blue color with a newline.
§Examples
use claude_dialog::ui::UI;
UI::print_claude_prompt();
// Claude's response will follow
Sourcepub fn print_exit_message()
pub fn print_exit_message()
Auto Trait Implementations§
impl Freeze for UI
impl RefUnwindSafe for UI
impl Send for UI
impl Sync for UI
impl Unpin for UI
impl UnwindSafe for UI
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more