MCPcopy Index your code
hub / github.com/ChrisFeldmeier/OpenCodeRust / run_non_interactive

Function run_non_interactive

crates/opencode-cli/src/main.rs:1333–1424  ·  view source on GitHub ↗
(
    message: Vec<String>,
    command: Option<String>,
    continue_last: bool,
    session: Option<String>,
    fork: bool,
    share: bool,
    model: Option<String>,
    agent_name: String,
    f

Source from the content-addressed store, hash-verified

1331}
1332
1333async fn run_non_interactive(
1334 message: Vec<String>,
1335 command: Option<String>,
1336 continue_last: bool,
1337 session: Option<String>,
1338 fork: bool,
1339 share: bool,
1340 model: Option<String>,
1341 agent_name: String,
1342 files: Vec<PathBuf>,
1343 format: RunOutputFormat,
1344 title: Option<String>,
1345 attach: Option<String>,
1346 dir: Option<PathBuf>,
1347 _port: Option<u16>,
1348 variant: Option<String>,
1349 _thinking: bool,
1350) -> anyhow::Result<()> {
1351 if let Some(dir) = dir {
1352 std::env::set_current_dir(&dir).map_err(|e| {
1353 anyhow::anyhow!("Failed to change directory to {}: {}", dir.display(), e)
1354 })?;
1355 }
1356
1357 if fork && !continue_last && session.is_none() {
1358 anyhow::bail!("--fork requires --continue or --session");
1359 }
1360
1361 let mut input = collect_run_input(message)?;
1362 append_cli_file_attachments(&mut input, &files)?;
1363
1364 if let Some(base_url) = attach {
1365 return run_non_interactive_attach(
1366 base_url,
1367 input,
1368 command,
1369 continue_last,
1370 session,
1371 fork,
1372 share,
1373 model,
1374 variant,
1375 format,
1376 title,
1377 )
1378 .await;
1379 }
1380
1381 if continue_last || session.is_some() || fork || share {
1382 eprintln!(
1383 "Note: session/share flags are currently applied when using `run --attach <server>`."
1384 );
1385 }
1386
1387 if let Some(command_name) = command {
1388 let cwd = std::env::current_dir()?;
1389 let mut registry = CommandRegistry::new();
1390 let _ = registry.load_from_directory(&cwd);

Callers 1

mainFunction · 0.85

Calls 11

collect_run_inputFunction · 0.85
newFunction · 0.85
parse_model_and_providerFunction · 0.85
run_chat_sessionFunction · 0.85
is_emptyMethod · 0.80
with_argumentsMethod · 0.80
load_from_directoryMethod · 0.45
executeMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected