moved around the consts so that default prefix env var isnt being read into the framework. made theme color configurable

This commit is contained in:
2020-10-13 14:35:13 +01:00
parent cfdcab4f01
commit ceac7be083
6 changed files with 37 additions and 25 deletions

View File

@ -1,11 +1,11 @@
pub const PREFIX: &str = "$";
pub const DAY: u64 = 86_400;
pub const HOUR: u64 = 3_600;
pub const MINUTE: u64 = 60;
pub const CHARACTERS: &str = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_";
const THEME_COLOR_FALLBACK: u32 = 0x8fb677;
use std::{collections::HashSet, env, iter::FromIterator};
use regex::Regex;
@ -47,4 +47,10 @@ lazy_static! {
env::var("PYTHON_LOCATION").unwrap_or_else(|_| "venv/bin/python3".to_string());
pub static ref STRINGS_TABLE: String =
env::var("STRINGS_TABLE").unwrap_or_else(|_| "strings".to_string());
pub static ref DEFAULT_PREFIX: String =
env::var("DEFAULT_PREFIX").unwrap_or_else(|_| "$".to_string());
pub static ref THEME_COLOR: u32 = env::var("THEME_COLOR").map_or(
THEME_COLOR_FALLBACK,
|inner| u32::from_str_radix(&inner, 16).unwrap_or(THEME_COLOR_FALLBACK)
);
}