use clap::Parser;
use zebo::Zebo;
#[derive(Debug, Hash, PartialEq, Eq, PartialOrd, Ord, Clone, Copy)]
struct DocumentId(u64);
impl zebo::DocumentId for DocumentId {
fn as_u64(&self) -> u64 {
self.0
}
fn from_u64(id: u64) -> Self {
DocumentId(id)
}
}
#[derive(Parser)]
#[command(name = "zebo-inspect")]
#[command(about = "Inspect and validate Zebo page contents")]
#[command(version)]
struct Cli {
zebo_path: String,
#[arg(long, required = true)]
page_id: u64,
#[arg(long)]
skip_content_checks: bool,
#[arg(long)]
skip_document_content: bool,
#[arg(long)]
skip_header_info: bool,
#[arg(long)]
doc_id: Option<u64>,
#[arg(long)]
starting_doc_id: Option<u64>,
}
static PAGE_SIZE: u64 = 1024 * 1024 * 1024;
fn main() {
const MAX_DOC_PER_PAGE: u32 = 1_000_000;
let cli = Cli::parse();
let zebo = Zebo::<MAX_DOC_PER_PAGE, PAGE_SIZE, DocumentId>::try_new(&cli.zebo_path)
.expect("Failed to create Zebo instance");
zebo.debug_content_with_options(
cli.page_id,
&mut std::io::stdout(),
cli.skip_content_checks,
cli.skip_document_content,
cli.skip_header_info,
cli.doc_id,
cli.starting_doc_id,
)
.expect("Failed to debug content");
println!("Done");
}