#![doc = include_str!("../README.md")]
use std::path::PathBuf;
use std::str::FromStr;
use anyhow::Context;
use clap::Parser;
use tracing::debug;
use tracing::trace;
use tracing_log::log::info;
mod telemetry;
#[derive(Parser, Debug)]
struct Cli {
#[arg(long, value_name = "NAME")]
floor_name: Option<String>,
floor_level: i8,
#[arg(short, long, action = clap::ArgAction::Count)]
verbose: u8,
path: PathBuf,
}
fn main() -> anyhow::Result<()> {
human_panic::setup_panic!();
let args = Cli::try_parse()?;
telemetry::setup_logging(args.verbose);
debug!("got args: {args:?}");
let _building_part = parse_ifc(args.path).unwrap();
info!("parsed ifc");
Ok(())
}
fn parse_ifc(path: PathBuf)->anyhow::Result<ifc_rs::IFC>{
let content = std::fs::read_to_string(&path)
.with_context(|| format!("could not read file `{}`", path.display()))?;
trace!("read file of length {}", content.len());
ifc_rs::IFC::from_str(&content)
}