diff --git a/src/bin/main.rs b/src/bin/main.rs index 7e4a082..4140a27 100644 --- a/src/bin/main.rs +++ b/src/bin/main.rs @@ -48,12 +48,16 @@ fn main() { /// Sets up a global logger if one is asked for. /// 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 can’t be done in exa’s 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() { extern crate env_logger; extern crate log; - let present = match var_os("EXA_DEBUG") { + let present = match var_os(exa::vars::EXA_DEBUG) { Some(debug) => debug.len() > 0, None => false, }; diff --git a/src/exa.rs b/src/exa.rs index 3a7370f..2316e9c 100644 --- a/src/exa.rs +++ b/src/exa.rs @@ -33,6 +33,7 @@ use fs::{Dir, File}; use fs::feature::ignore::IgnoreCache; use fs::feature::git::GitCache; use options::{Options, Vars}; +pub use options::vars; pub use options::Misfire; use output::{escape, lines, grid, grid_details, details, View, Mode}; diff --git a/src/options/vars.rs b/src/options/vars.rs index 211338a..4b541dd 100644 --- a/src/options/vars.rs +++ b/src/options/vars.rs @@ -24,8 +24,13 @@ pub static EXA_COLORS: &str = "EXA_COLORS"; /// complaining if an argument was specified twice, or if two conflict. /// This is meant to be so you don’t accidentally introduce the wrong /// 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"; +/// 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 /// (`--grid --long`) so it’s only activated if there’s at least the given /// number of rows of output.