use scout::LiteClient;
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let reference = std::env::args()
.nth(1)
.expect("usage: read <reference> [path]");
let path = std::env::args().nth(2);
let gateway = std::env::var("BEE_GATEWAY")
.unwrap_or_else(|_| "https://download.gateway.ethswarm.org".into());
let scout = LiteClient::read(&gateway)?;
let data = match &path {
Some(p) => scout.cat_path(&reference, p).await?,
None => scout.cat(&reference).await?,
};
print!("{}", String::from_utf8_lossy(&data));
Ok(())
}