aboutsummaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
authorDaniel Schadt <kingdread@gmx.de>2019-12-25 00:58:06 +0100
committerDaniel Schadt <kingdread@gmx.de>2019-12-25 00:58:06 +0100
commita21e3c7b6c8dac839ef8070804580e531faaad69 (patch)
tree7d0a2528b2bdb75101ce103005141e4ff8ed4465 /src/main.rs
parent95cc3638cf85774ee311bf4b44b2870a7936400d (diff)
parent7f2f9b03debc7fc16f9614df7cb6fa4c0999d128 (diff)
downloadkondou-a21e3c7b6c8dac839ef8070804580e531faaad69.tar.gz
kondou-a21e3c7b6c8dac839ef8070804580e531faaad69.tar.bz2
kondou-a21e3c7b6c8dac839ef8070804580e531faaad69.zip
Merge branch 'user-options'
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();