diff options
author | Daniel Schadt <kingdread@gmx.de> | 2019-12-25 00:50:24 +0100 |
---|---|---|
committer | Daniel Schadt <kingdread@gmx.de> | 2019-12-25 00:50:24 +0100 |
commit | 95cc3638cf85774ee311bf4b44b2870a7936400d (patch) | |
tree | 79ceedd1f0c220214fe9ac147410c46b12794fa1 /src | |
parent | a442d0b3b8ad68885a59604b168bc45269ded62e (diff) | |
download | kondou-95cc3638cf85774ee311bf4b44b2870a7936400d.tar.gz kondou-95cc3638cf85774ee311bf4b44b2870a7936400d.tar.bz2 kondou-95cc3638cf85774ee311bf4b44b2870a7936400d.zip |
add flag to disable caching
Diffstat (limited to 'src')
-rw-r--r-- | src/cache.rs | 2 | ||||
-rw-r--r-- | src/main.rs | 12 |
2 files changed, 12 insertions, 2 deletions
diff --git a/src/cache.rs b/src/cache.rs index 2b490ec..09c8512 100644 --- a/src/cache.rs +++ b/src/cache.rs @@ -66,7 +66,7 @@ impl Cache for FileCache { } /// A cache that does nothing. -struct NoopCache; +pub struct NoopCache; impl NoopCache { pub fn new() -> Self { diff --git a/src/main.rs b/src/main.rs index eb5ef06..767d5ee 100644 --- a/src/main.rs +++ b/src/main.rs @@ -340,9 +340,19 @@ fn run() -> MainResult<()> { .default_value("buildtemplate.png") .takes_value(true), ) + .arg( + Arg::with_name("no-cache") + .help("Disables the cache") + .long("no-cache") + .takes_value(false), + ) .get_matches(); - let mut api = Api::new(cache::FileCache::new()); + let mut api = if matches.is_present("no-cache") { + Api::new(cache::NoopCache::new()) + } else { + Api::new(cache::FileCache::new()) + }; let build = if matches.is_present("chatlink") { run_chatlink(&mut api, &matches)? } else { |