MCPcopy Index your code
hub / github.com/encounter/objdiff / run_oneshot

Function run_oneshot

objdiff-cli/src/cmd/diff.rs:178–206  ·  view source on GitHub ↗
(
    args: &Args,
    output: &Utf8PlatformPath,
    target_path: Option<&Utf8PlatformPath>,
    base_path: Option<&Utf8PlatformPath>,
    unit_options: Option<ProjectOptions>,
)

Source from the content-addressed store, hash-verified

176}
177
178fn run_oneshot(
179 args: &Args,
180 output: &Utf8PlatformPath,
181 target_path: Option<&Utf8PlatformPath>,
182 base_path: Option<&Utf8PlatformPath>,
183 unit_options: Option<ProjectOptions>,
184) -> Result<()> {
185 let output_format = OutputFormat::from_option(args.format.as_deref())?;
186 let (diff_config, mapping_config) = build_config_from_args(args, None, unit_options.as_ref())?;
187 let target = target_path
188 .map(|p| {
189 obj::read::read(p.as_ref(), &diff_config, DiffSide::Target)
190 .with_context(|| format!("Loading {p}"))
191 })
192 .transpose()?;
193 let base = base_path
194 .map(|p| {
195 obj::read::read(p.as_ref(), &diff_config, DiffSide::Base)
196 .with_context(|| format!("Loading {p}"))
197 })
198 .transpose()?;
199 let result =
200 diff::diff_objs(target.as_ref(), base.as_ref(), None, &diff_config, &mapping_config)?;
201 let left = target.as_ref().zip(result.left.as_ref());
202 let right = base.as_ref().zip(result.right.as_ref());
203 let diff_result = DiffResult::new(left, right, &diff_config)?;
204 write_output(&diff_result, Some(output), output_format)?;
205 Ok(())
206}
207
208fn build_config_from_args(
209 args: &Args,

Callers 1

runFunction · 0.85

Calls 4

build_config_from_argsFunction · 0.85
readFunction · 0.85
diff_objsFunction · 0.85
write_outputFunction · 0.85

Tested by

no test coverage detected