static-file-server 0.0.3

A simple static file server
Documentation
1
2
3
4
5
6
7
8
9
use anyhow::anyhow;
use std::io::Write;
use termcolor::{Color, ColorChoice, ColorSpec, StandardStream, WriteColor};

pub fn colored_msg(msg: &str, color: Color) -> anyhow::Result<()> {
    let mut stdout = StandardStream::stdout(ColorChoice::Always);
    stdout.set_color(ColorSpec::new().set_fg(Some(color)))?;
    writeln!(&mut stdout, "{}", msg).map_err(|e| anyhow!(e))
}