news_cli 1.3.3

A CLI to see developer news in the terminal 🐢
Documentation
use std::str::FromStr;
use termimad::Area;

pub fn view_area() -> Area {
    let mut area = Area::full_screen();
    area.pad_for_max_width(120); // we don't want a too wide text column
    area
}

#[derive(Clone)]
pub enum View {
    Web,
    Terminal,
    Ia,
}

impl FromStr for View {
    type Err = ();

    fn from_str(input: &str) -> Result<View, Self::Err> {
        match input {
            "Web" => Ok(View::Web),
            "Terminal" => Ok(View::Terminal),
            "Ia Draft" => Ok(View::Ia),
            _ => Err(()),
        }
    }
}