Skip to content

Commit bd95faa

Browse files
committed
Remove objdiff-cli diff JSON output mode
This has been unimplemented since v3.0.0-alpha.1, and I don't currently have plans to bring it back. If you need it for something, please open an issue!
1 parent 2c57e49 commit bd95faa

File tree

5 files changed

+3
-448
lines changed

5 files changed

+3
-448
lines changed

objdiff-cli/src/cmd/diff.rs

Lines changed: 3 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ use crossterm::{
1919
},
2020
};
2121
use objdiff_core::{
22-
bindings::diff::DiffResult,
2322
build::{
2423
BuildConfig, BuildStatus,
2524
watcher::{Watcher, create_watcher},
@@ -28,7 +27,7 @@ use objdiff_core::{
2827
ProjectConfig, ProjectObject, ProjectObjectMetadata, build_globset,
2928
path::{check_path_buf, platform_path, platform_path_serde_option},
3029
},
31-
diff::{self, DiffObjConfig, MappingConfig, ObjectDiff},
30+
diff::{DiffObjConfig, MappingConfig, ObjectDiff},
3231
jobs::{
3332
Job, JobQueue, JobResult,
3433
objdiff::{ObjDiffConfig, start_build},
@@ -40,10 +39,7 @@ use typed_path::{Utf8PlatformPath, Utf8PlatformPathBuf};
4039

4140
use crate::{
4241
cmd::apply_config_args,
43-
util::{
44-
output::{OutputFormat, write_output},
45-
term::crossterm_panic_handler,
46-
},
42+
util::term::crossterm_panic_handler,
4743
views::{EventControlFlow, EventResult, UiView, function_diff::FunctionDiffUi},
4844
};
4945

@@ -63,12 +59,6 @@ pub struct Args {
6359
#[argp(option, short = 'u')]
6460
/// Unit name within project
6561
unit: Option<String>,
66-
#[argp(option, short = 'o', from_str_fn(platform_path))]
67-
/// Output file (one-shot mode) ("-" for stdout)
68-
output: Option<Utf8PlatformPathBuf>,
69-
#[argp(option)]
70-
/// Output format (json, json-pretty, proto) (default: json)
71-
format: Option<String>,
7262
#[argp(positional)]
7363
/// Function symbol to diff
7464
symbol: Option<String>,
@@ -171,11 +161,7 @@ pub fn run(args: Args) -> Result<()> {
171161
_ => bail!("Either target and base or project and unit must be specified"),
172162
};
173163

174-
if let Some(output) = &args.output {
175-
run_oneshot(&args, output, target_path.as_deref(), base_path.as_deref())
176-
} else {
177-
run_interactive(args, target_path, base_path, project_config)
178-
}
164+
run_interactive(args, target_path, base_path, project_config)
179165
}
180166

181167
fn build_config_from_args(args: &Args) -> Result<(DiffObjConfig, MappingConfig)> {
@@ -194,28 +180,6 @@ fn build_config_from_args(args: &Args) -> Result<(DiffObjConfig, MappingConfig)>
194180
Ok((diff_config, mapping_config))
195181
}
196182

197-
fn run_oneshot(
198-
args: &Args,
199-
output: &Utf8PlatformPath,
200-
target_path: Option<&Utf8PlatformPath>,
201-
base_path: Option<&Utf8PlatformPath>,
202-
) -> Result<()> {
203-
let output_format = OutputFormat::from_option(args.format.as_deref())?;
204-
let (diff_config, mapping_config) = build_config_from_args(args)?;
205-
let target = target_path
206-
.map(|p| obj::read::read(p.as_ref(), &diff_config).with_context(|| format!("Loading {p}")))
207-
.transpose()?;
208-
let base = base_path
209-
.map(|p| obj::read::read(p.as_ref(), &diff_config).with_context(|| format!("Loading {p}")))
210-
.transpose()?;
211-
let result =
212-
diff::diff_objs(target.as_ref(), base.as_ref(), None, &diff_config, &mapping_config)?;
213-
let left = target.as_ref().and_then(|o| result.left.as_ref().map(|d| (o, d)));
214-
let right = base.as_ref().and_then(|o| result.right.as_ref().map(|d| (o, d)));
215-
write_output(&DiffResult::new(left, right), Some(output), output_format)?;
216-
Ok(())
217-
}
218-
219183
pub struct AppState {
220184
pub jobs: JobQueue,
221185
pub waker: Arc<TermWaker>,

objdiff-core/protos/diff.proto

Lines changed: 0 additions & 165 deletions
This file was deleted.
-8.22 KB
Binary file not shown.

0 commit comments

Comments
 (0)