1use clap::Parser;
2use std::io::{stdin, Read};
3use std::process;
4
5use dns_types::hosts::types::Hosts;
6use dns_types::zones::types::Zone;
7
8#[derive(Parser)]
10struct Args {}
15
16fn main() {
17 Args::parse();
18
19 let mut buf = String::new();
20 if let Err(err) = stdin().read_to_string(&mut buf) {
21 eprintln!("error reading hosts file from stdin: {err:?}");
22 process::exit(1);
23 }
24
25 match Hosts::deserialise(&buf) {
26 Ok(hosts) => print!("{}", Zone::from(hosts).serialise()),
27 Err(err) => {
28 eprintln!("error parsing hosts file from stdin: {err:?}");
29 process::exit(1);
30 }
31 }
32}