extern crate reqwest;
extern crate serde_json;
extern crate serde_yaml;

use std::env;

fn main() {
    let collection: Vec<String> = env::args().collect();

    for current in collection.iter().skip(1) {
        let _bar = get_url(current);
    }
}

fn get_url(val: &String) -> Result<(), reqwest::Error> {
    let echo_json: serde_json::Value = reqwest::Client::new()
        .get(val)
        .send()?
        .json()?;

    let result = serde_yaml::to_string(&echo_json).unwrap();
    println!("{}", result);
    Ok(())
}
