1
0
Fork 0
mirror of https://github.com/lise-henry/crowbook synced 2024-05-23 09:06:17 +02:00

Fix display of stats when using advanced and feature is not built

Fixes #56
This commit is contained in:
Elisabeth Henry 2018-06-01 02:57:08 +02:00
parent 2c8cf45d24
commit a3ab516339

View File

@ -77,7 +77,20 @@ impl Stats {
pub fn new(book: &Book, advanced: bool) -> Stats {
let lang = book.options.get_str("lang").unwrap();
let lang = Stats::language_from_str(lang);
let mut stats = Stats { chapters: vec![], advanced: advanced };
let mut stats;
if cfg!(not(feature = "nightly")) {
if advanced {
warn!("{}", lformat!("This version of crowboook has been compiled without support for advanced statistics"));
}
stats = Stats { chapters: vec![], advanced: false };
} else {
stats = Stats { chapters: vec![], advanced: advanced };
if !advanced {
info!("{}", lformat!("For more advanced statistics, use the --verbose or -v option"));
}
}
for c in &book.chapters {
let name = c.filename.clone();