diff options
author | Matan Kushner <hello@matchai.me> | 2019-07-27 18:25:13 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-27 18:25:13 -0400 |
commit | 0bc28c521df789d3aae5ceb541ee336aefa14340 (patch) | |
tree | 2f5aca63ac63e9970ff0587f5e4dc973d56cc0a9 /src/print.rs | |
parent | 95ce43ee70d51ce1181806b7c0f1ce623a618b4b (diff) |
feat: Add configuration for add_newline (#116)
- Replace TableExt with a Config trait that extends toml::value::Table
Add configuration for add_newline
- add_newline is a root-level configuration value. When set to false, the initial newline before the prompt is removed.
Diffstat (limited to 'src/print.rs')
-rw-r--r-- | src/print.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/print.rs b/src/print.rs index ae712e123..3cd185e41 100644 --- a/src/print.rs +++ b/src/print.rs @@ -2,6 +2,7 @@ use clap::ArgMatches; use rayon::prelude::*; use std::io::{self, Write}; +use crate::config::Config; use crate::context::Context; use crate::module::Module; use crate::modules; @@ -23,12 +24,15 @@ const PROMPT_ORDER: &[&str] = &[ pub fn prompt(args: ArgMatches) { let context = Context::new(args); + let config = &context.config; let stdout = io::stdout(); let mut handle = stdout.lock(); // Write a new line before the prompt - writeln!(handle).unwrap(); + if config.get_as_bool("add_newline") != Some(false) { + writeln!(handle).unwrap(); + } let modules = PROMPT_ORDER .par_iter() |