vars.rs 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. use std::ffi::OsString;
  2. // General variables
  3. /// Environment variable used to colour files, both by their filesystem type
  4. /// (symlink, socket, directory) and their file name or extension (image,
  5. /// video, archive);
  6. pub static LS_COLORS: &str = "LS_COLORS";
  7. /// Environment variable used to override the width of the terminal, in
  8. /// characters.
  9. pub static COLUMNS: &str = "COLUMNS";
  10. /// Environment variable used to datetime format.
  11. pub static TIME_STYLE: &str = "TIME_STYLE";
  12. // exa-specific variables
  13. /// Environment variable used to colour exa’s interface when colours are
  14. /// enabled. This includes all the colours that LS_COLORS would recognise,
  15. /// overriding them if necessary. It can also contain exa-specific codes.
  16. pub static EXA_COLORS: &str = "EXA_COLORS";
  17. /// Environment variable used to switch on strict argument checking, such as
  18. /// complaining if an argument was specified twice, or if two conflict.
  19. /// This is meant to be so you don’t accidentally introduce the wrong
  20. /// behaviour in a script, rather than for general command-line use.
  21. /// Any non-empty value will turn strict mode on.
  22. pub static EXA_STRICT: &str = "EXA_STRICT";
  23. /// Environment variable used to make exa print out debugging information as
  24. /// it runs. Any non-empty value will turn debug mode on.
  25. pub static EXA_DEBUG: &str = "EXA_DEBUG";
  26. /// Environment variable used to limit the grid-details view
  27. /// (`--grid --long`) so it’s only activated if there’s at least the given
  28. /// number of rows of output.
  29. pub static EXA_GRID_ROWS: &str = "EXA_GRID_ROWS";
  30. /// Mockable wrapper for `std::env::var_os`.
  31. pub trait Vars {
  32. fn get(&self, name: &'static str) -> Option<OsString>;
  33. }
  34. // Test impl that just returns the value it has.
  35. #[cfg(test)]
  36. impl Vars for Option<OsString> {
  37. fn get(&self, _name: &'static str) -> Option<OsString> {
  38. self.clone()
  39. }
  40. }