pub struct ClaudeCommand {
pub prompt: String,
pub system_prompt: Option<String>,
pub append_prompt: Option<String>,
pub model: Option<String>,
}Expand description
Represents a Claude command with all necessary parameters
This structure encapsulates all the information needed to construct and execute a Claude CLI command, including prompts, model selection, and system prompt configuration.
§Examples
use claude_dialog::claude_executor::ClaudeCommand;
// Basic command with just a prompt
let cmd = ClaudeCommand {
prompt: "What is Rust?".to_string(),
system_prompt: None,
append_prompt: None,
model: None,
};
// Command with custom system prompt and model
let cmd = ClaudeCommand {
prompt: "Explain memory safety".to_string(),
system_prompt: Some("You are a Rust expert.".to_string()),
append_prompt: None,
model: Some("claude-3-opus".to_string()),
};
// Command with append prompt
let cmd = ClaudeCommand {
prompt: "Write a function".to_string(),
system_prompt: None,
append_prompt: Some("Always use idiomatic Rust.".to_string()),
model: None,
};Fields§
§prompt: StringThe main prompt to send to Claude
system_prompt: Option<String>Optional system prompt that replaces the default
append_prompt: Option<String>Optional prompt to append to the default system prompt
model: Option<String>Optional model specification (e.g., “claude-3-opus”)
Implementations§
Source§impl ClaudeCommand
impl ClaudeCommand
Sourcepub fn build_args(&self) -> Vec<String>
pub fn build_args(&self) -> Vec<String>
Build command-line arguments for the Claude CLI
Constructs a vector of arguments based on the command configuration, including the prompt, system prompts, model selection, and allowed tools.
§Returns
A vector of strings representing the command-line arguments
§Examples
use claude_dialog::claude_executor::ClaudeCommand;
let cmd = ClaudeCommand {
prompt: "Hello".to_string(),
system_prompt: Some("Be helpful".to_string()),
append_prompt: None,
model: Some("claude-3-opus".to_string()),
};
let args = cmd.build_args();
assert!(args.contains(&"--continue".to_string()));
assert!(args.contains(&"-p".to_string()));
assert!(args.contains(&"Hello".to_string()));
assert!(args.contains(&"--system-prompt".to_string()));
assert!(args.contains(&"Be helpful".to_string()));
assert!(args.contains(&"--model".to_string()));
assert!(args.contains(&"claude-3-opus".to_string()));Trait Implementations§
Source§impl Clone for ClaudeCommand
impl Clone for ClaudeCommand
Source§fn clone(&self) -> ClaudeCommand
fn clone(&self) -> ClaudeCommand
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ClaudeCommand
impl RefUnwindSafe for ClaudeCommand
impl Send for ClaudeCommand
impl Sync for ClaudeCommand
impl Unpin for ClaudeCommand
impl UnsafeUnpin for ClaudeCommand
impl UnwindSafe for ClaudeCommand
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