use super::ClaudeCommand;
use std::path::PathBuf;
impl ClaudeCommand {
#[inline]
#[must_use]
pub fn with_model<S: Into<String>>( mut self, model: S ) -> Self {
self.args.push( "--model".to_string() );
self.args.push( model.into() );
self
}
#[inline]
#[must_use]
pub fn with_api_key<S: Into<String>>( mut self, key: S ) -> Self {
self.args.push( "--api-key".to_string() );
self.args.push( key.into() );
self
}
#[inline]
#[must_use]
pub fn with_verbose( mut self, verbose: bool ) -> Self {
if verbose {
self.args.push( "--verbose".to_string() );
}
self
}
#[inline]
#[must_use]
pub fn with_system_prompt<S: Into<String>>( mut self, prompt: S ) -> Self {
self.args.push( "--system-prompt".to_string() );
self.args.push( prompt.into() );
self
}
#[inline]
#[must_use]
pub fn with_sandbox_mode( mut self, sandbox: bool ) -> Self {
self.sandbox_mode = Some( sandbox );
self
}
#[inline]
#[must_use]
pub fn with_session_dir<P: Into<PathBuf>>( mut self, dir: P ) -> Self {
self.session_dir = Some( dir.into() );
self
}
#[inline]
#[must_use]
pub fn with_top_p( mut self, top_p: f64 ) -> Self {
self.top_p = Some( top_p );
self
}
#[inline]
#[must_use]
pub fn with_top_k( mut self, top_k: u32 ) -> Self {
self.top_k = Some( top_k );
self
}
#[inline]
#[must_use]
pub fn with_dry_run( mut self, dry_run: bool ) -> Self {
self.dry_run = dry_run;
self
}
#[inline]
#[must_use]
pub fn with_print( mut self, print: bool ) -> Self {
if print {
self.args.push( "-p".to_string() );
}
self
}
#[inline]
#[must_use]
pub fn with_output_format( mut self, format: crate::types::OutputFormat ) -> Self {
self.args.push( "--output-format".to_string() );
self.args.push( format.as_str().to_string() );
self
}
#[inline]
#[must_use]
pub fn with_input_format( mut self, format: crate::types::InputFormat ) -> Self {
self.args.push( "--input-format".to_string() );
self.args.push( format.as_str().to_string() );
self
}
#[inline]
#[must_use]
pub fn with_include_partial_messages( mut self, include: bool ) -> Self {
if include {
self.args.push( "--include-partial-messages".to_string() );
}
self
}
#[inline]
#[must_use]
pub fn with_replay_user_messages( mut self, replay: bool ) -> Self {
if replay {
self.args.push( "--replay-user-messages".to_string() );
}
self
}
#[inline]
#[must_use]
pub fn with_json_schema<S: Into<String>>( mut self, schema: S ) -> Self {
self.args.push( "--json-schema".to_string() );
self.args.push( schema.into() );
self
}
#[inline]
#[must_use]
pub fn with_add_dir<S: Into<String>>( mut self, path: S ) -> Self {
self.args.push( "--add-dir".to_string() );
self.args.push( path.into() );
self
}
#[inline]
#[must_use]
pub fn with_effort( mut self, level: crate::types::EffortLevel ) -> Self {
self.args.push( "--effort".to_string() );
self.args.push( level.as_str().to_string() );
self
}
#[inline]
#[must_use]
pub fn with_fallback_model<S: Into<String>>( mut self, model: S ) -> Self {
self.args.push( "--fallback-model".to_string() );
self.args.push( model.into() );
self
}
#[inline]
#[must_use]
pub fn with_max_budget_usd( mut self, amount: f64 ) -> Self {
self.args.push( "--max-budget-usd".to_string() );
self.args.push( format!( "{amount}" ) );
self
}
#[inline]
#[must_use]
pub fn with_mcp_config<I, S>( mut self, configs: I ) -> Self
where
I: IntoIterator<Item = S>,
S: Into<String>,
{
for config in configs {
self.args.push( "--mcp-config".to_string() );
self.args.push( config.into() );
}
self
}
#[inline]
#[must_use]
pub fn with_strict_mcp_config( mut self, strict: bool ) -> Self {
if strict {
self.args.push( "--strict-mcp-config".to_string() );
}
self
}
#[inline]
#[must_use]
pub fn with_settings<S: Into<String>>( mut self, settings: S ) -> Self {
self.args.push( "--settings".to_string() );
self.args.push( settings.into() );
self
}
#[inline]
#[must_use]
pub fn with_setting_sources<S: Into<String>>( mut self, sources: S ) -> Self {
self.args.push( "--setting-sources".to_string() );
self.args.push( sources.into() );
self
}
#[inline]
#[must_use]
pub fn with_agent<S: Into<String>>( mut self, agent: S ) -> Self {
self.args.push( "--agent".to_string() );
self.args.push( agent.into() );
self
}
#[inline]
#[must_use]
pub fn with_agents<S: Into<String>>( mut self, json: S ) -> Self {
self.args.push( "--agents".to_string() );
self.args.push( json.into() );
self
}
#[inline]
#[must_use]
pub fn with_plugin_dir<I, S>( mut self, dirs: I ) -> Self
where
I: IntoIterator<Item = S>,
S: Into<String>,
{
for dir in dirs {
self.args.push( "--plugin-dir".to_string() );
self.args.push( dir.into() );
}
self
}
#[inline]
#[must_use]
pub fn with_resume( mut self, id: Option<&str> ) -> Self {
self.args.push( "-r".to_string() );
if let Some( session_id ) = id {
self.args.push( session_id.to_string() );
}
self
}
#[inline]
#[must_use]
pub fn with_session_id<S: Into<String>>( mut self, id: S ) -> Self {
self.args.push( "--session-id".to_string() );
self.args.push( id.into() );
self
}
#[inline]
#[must_use]
pub fn with_fork_session( mut self, fork: bool ) -> Self {
if fork {
self.args.push( "--fork-session".to_string() );
}
self
}
#[inline]
#[must_use]
pub fn with_no_session_persistence( mut self, no_persist: bool ) -> Self {
if no_persist {
self.args.push( "--no-session-persistence".to_string() );
}
self
}
#[inline]
#[must_use]
pub fn with_from_pr<S: Into<String>>( mut self, value: S ) -> Self {
self.args.push( "--from-pr".to_string() );
self.args.push( value.into() );
self
}
#[inline]
#[must_use]
pub fn with_append_system_prompt<S: Into<String>>( mut self, prompt: S ) -> Self {
self.args.push( "--append-system-prompt".to_string() );
self.args.push( prompt.into() );
self
}
#[inline]
#[must_use]
pub fn with_permission_mode( mut self, mode: crate::types::PermissionMode ) -> Self {
self.args.push( "--permission-mode".to_string() );
self.args.push( mode.as_str().to_string() );
self
}
#[inline]
#[must_use]
pub fn with_allow_dangerously_skip_permissions( mut self, allow: bool ) -> Self {
if allow {
self.args.push( "--allow-dangerously-skip-permissions".to_string() );
}
self
}
#[inline]
#[must_use]
pub fn with_debug( mut self, filter: Option<&str> ) -> Self {
self.args.push( "-d".to_string() );
if let Some( f ) = filter {
self.args.push( f.to_string() );
}
self
}
#[inline]
#[must_use]
pub fn with_debug_file<S: Into<String>>( mut self, path: S ) -> Self {
self.args.push( "--debug-file".to_string() );
self.args.push( path.into() );
self
}
#[inline]
#[must_use]
pub fn with_betas<I, S>( mut self, betas: I ) -> Self
where
I: IntoIterator<Item = S>,
S: Into<String>,
{
for beta in betas {
self.args.push( "--betas".to_string() );
self.args.push( beta.into() );
}
self
}
#[inline]
#[must_use]
pub fn with_brief( mut self, brief: bool ) -> Self {
if brief {
self.args.push( "--brief".to_string() );
}
self
}
#[inline]
#[must_use]
pub fn with_disable_slash_commands( mut self, disable: bool ) -> Self {
if disable {
self.args.push( "--disable-slash-commands".to_string() );
}
self
}
#[inline]
#[must_use]
pub fn with_file<I, S>( mut self, specs: I ) -> Self
where
I: IntoIterator<Item = S>,
S: Into<String>,
{
for spec in specs {
self.args.push( "--file".to_string() );
self.args.push( spec.into() );
}
self
}
#[inline]
#[must_use]
pub fn with_worktree( mut self, name: Option<&str> ) -> Self {
self.args.push( "-w".to_string() );
if let Some( n ) = name {
self.args.push( n.to_string() );
}
self
}
#[inline]
#[must_use]
pub fn with_tmux( mut self, tmux: bool ) -> Self {
if tmux {
self.args.push( "--tmux".to_string() );
}
self
}
#[inline]
#[must_use]
pub fn with_ide( mut self, ide: bool ) -> Self {
if ide {
self.args.push( "--ide".to_string() );
}
self
}
#[inline]
#[must_use]
pub fn with_chrome( mut self, enabled: Option<bool> ) -> Self {
self.chrome = enabled;
self
}
}