#213 : output hello world for each theme when --list-theme is flagged

pull/238/merge
ms2300 6 years ago committed by David Peter
parent 1088455702
commit 2e3784aa30

@ -0,0 +1,6 @@
// Hello World
fn main() {
println!("Hello World!");
}

@ -34,7 +34,7 @@ use std::process;
use ansi_term::Colour::Green; use ansi_term::Colour::Green;
use app::App; use app::{App, Config};
use assets::{clear_assets, config_dir, HighlightingAssets}; use assets::{clear_assets, config_dir, HighlightingAssets};
use controller::Controller; use controller::Controller;
@ -128,10 +128,14 @@ pub fn list_languages(assets: &HighlightingAssets, term_width: usize) {
} }
} }
pub fn list_themes(assets: &HighlightingAssets) { pub fn list_themes(assets: &HighlightingAssets, config: &mut Config) {
let themes = &assets.theme_set.themes; let themes = &assets.theme_set.themes;
for (theme, _) in themes.iter() { for (theme, _) in themes.iter() {
println!("{}", theme); println!("{}", theme);
config.theme = theme.to_string();
config.files = vec![Some("assets/hello.rs")];
let controller = Controller::new(&config, &assets);
let _res = controller.run();
} }
} }
@ -146,7 +150,7 @@ fn run() -> Result<bool> {
Ok(true) Ok(true)
} }
_ => { _ => {
let config = app.config()?; let mut config = app.config()?;
let assets = HighlightingAssets::new(); let assets = HighlightingAssets::new();
if app.matches.is_present("list-languages") { if app.matches.is_present("list-languages") {
@ -154,7 +158,7 @@ fn run() -> Result<bool> {
Ok(true) Ok(true)
} else if app.matches.is_present("list-themes") { } else if app.matches.is_present("list-themes") {
list_themes(&assets); list_themes(&assets, &mut config);
Ok(true) Ok(true)
} else { } else {

Loading…
Cancel
Save