grafbabe 0.1.0

Simple openmetrics stats collector
mod config;
mod logger;
mod parse_config;
mod parse_ini;
mod time;
mod version;

pub use config::*;
pub use logger::init_logger;
pub use parse_config::parse_config;
pub use version::{version, version_more};

pub fn usage() {
    let name = std::env::args().next().unwrap_or(version::NAME.to_string());

    eprint!("Usage:\t{name} [-chvv]");
    if cfg!(feature = "mock_data") {
        eprint!(" [ serve | mock <path> | seed <path> ]");
    }
    eprintln!("");

    eprintln!(
        "\nFlags:
\t-c or --config-file <PATH> (path to config file)
\t-h or --help (you're readin' it)
\t-v (print version string)
\t-vv or --version (print more detailed version)\n"
    );

    if cfg!(feature = "mock_data") {
        eprintln!(
            "Commands:
\tserve (runs the program as normal, serving HTTP requests and polling
\t\tthe prometheus endpoint in the background; this is the default)
\tmock <path> (like serve, but reads the file at <path> and uses it as
\t\tmock data; the file must be in prometheus format; the program will
\t\tnot poll the prometheus endpoint in the background)
\tseed <path> (writes a single snapshot to the database, using
\t\tdata read from <path>; the file must be in prometheus format)\n"
        );
    }
}