Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions bundle/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,14 @@ name = "bundle"
version = "0.0.0"
edition = "2021"

[[bin]]
name = "proto-bin-to-json"
path = "src/main.rs"
required-features = ["build-binary"]

[dependencies]
anyhow = "1.0.44"
clap = { version = "4.4.18", features = ["derive", "env"], optional = true }
codeowners = { path = "../codeowners" }
chrono = { version = "0.4.38", features = ["serde"] }
proto = { path = "../proto" }
Expand Down Expand Up @@ -65,3 +71,4 @@ pyo3 = [
"codeowners/pyo3",
"context/pyo3",
]
build-binary = ["clap"]
26 changes: 26 additions & 0 deletions bundle/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
use std::{fs, path::PathBuf};

use bundle::bin_parse;
use clap::Parser;

#[derive(Debug, Parser)]
#[command(
version,
about = "A tool to convert bundle proto bins into JSON for debugging."
)]
pub struct Cli {
/// Protobuf bin file to convert into JSON
#[arg(required = true)]
pub proto_bin_file: PathBuf,
}

fn main() -> anyhow::Result<()> {
let Cli {
proto_bin_file: path,
} = Cli::parse();
let bin = fs::read(path)?;
let test_report = bin_parse(&bin)?;
let json = serde_json::to_string_pretty(&test_report)?;
println!("{}", json);
Ok(())
}