Move EXA_DEBUG variable to vars file

This commit is contained in:
Benjamin Sago 2017-10-08 17:24:50 +01:00
parent a45bcfe058
commit e154b58268
3 changed files with 12 additions and 2 deletions

View File

@ -48,12 +48,16 @@ fn main() {
/// Sets up a global logger if one is asked for. /// Sets up a global logger if one is asked for.
/// The EXA_DEBUG environment variable controls whether log messages are /// The EXA_DEBUG environment variable controls whether log messages are
/// displayed or not. Currently there are just two settings (on and off) /// displayed or not. Currently there are just two settings (on and off).
///
/// This cant be done in exas own option parsing because that part of it
/// logs as well, so by the time execution gets there, the logger needs to
/// have already been set up.
pub fn configure_logger() { pub fn configure_logger() {
extern crate env_logger; extern crate env_logger;
extern crate log; extern crate log;
let present = match var_os("EXA_DEBUG") { let present = match var_os(exa::vars::EXA_DEBUG) {
Some(debug) => debug.len() > 0, Some(debug) => debug.len() > 0,
None => false, None => false,
}; };

View File

@ -33,6 +33,7 @@ use fs::{Dir, File};
use fs::feature::ignore::IgnoreCache; use fs::feature::ignore::IgnoreCache;
use fs::feature::git::GitCache; use fs::feature::git::GitCache;
use options::{Options, Vars}; use options::{Options, Vars};
pub use options::vars;
pub use options::Misfire; pub use options::Misfire;
use output::{escape, lines, grid, grid_details, details, View, Mode}; use output::{escape, lines, grid, grid_details, details, View, Mode};

View File

@ -24,8 +24,13 @@ pub static EXA_COLORS: &str = "EXA_COLORS";
/// complaining if an argument was specified twice, or if two conflict. /// complaining if an argument was specified twice, or if two conflict.
/// This is meant to be so you dont accidentally introduce the wrong /// This is meant to be so you dont accidentally introduce the wrong
/// behaviour in a script, rather than for general command-line use. /// behaviour in a script, rather than for general command-line use.
/// Any non-empty value will turn strict mode on.
pub static EXA_STRICT: &str = "EXA_STRICT"; pub static EXA_STRICT: &str = "EXA_STRICT";
/// Environment variable used to make exa print out debugging information as
/// it runs. Any non-empty value will turn debug mode on.
pub static EXA_DEBUG: &str = "EXA_DEBUG";
/// Environment variable used to limit the grid-details view /// Environment variable used to limit the grid-details view
/// (`--grid --long`) so its only activated if theres at least the given /// (`--grid --long`) so its only activated if theres at least the given
/// number of rows of output. /// number of rows of output.