aboutsummaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs
index 767d5ee..d8e66a1 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -10,6 +10,7 @@ extern crate num_traits;
extern crate reqwest;
extern crate rusttype;
extern crate termcolor;
+extern crate toml;
extern crate xdg;
use std::error::Error as StdError;
@@ -32,6 +33,7 @@ mod bt;
mod cache;
mod output;
mod render;
+mod useropts;
use clap::{App, Arg, ArgMatches};
@@ -346,6 +348,12 @@ fn run() -> MainResult<()> {
.long("no-cache")
.takes_value(false),
)
+ .arg(
+ Arg::with_name("config")
+ .help("Specifies the render option file.")
+ .long("config")
+ .takes_value(true),
+ )
.get_matches();
let mut api = if matches.is_present("no-cache") {
@@ -365,7 +373,13 @@ fn run() -> MainResult<()> {
println!("{}", build.chatlink());
}
- let mut renderer = render::Renderer::new(&mut api, Default::default());
+ let render_options = if let Some(config_path) = matches.value_of("config") {
+ useropts::load_file(config_path)?
+ } else {
+ Default::default()
+ };
+
+ let mut renderer = render::Renderer::new(&mut api, render_options);
match renderer.render_buildtemplate(&build) {
Ok(img) => {
let filename = matches.value_of("outfile").unwrap();