lsd 1.2.0

An ls command with a lot of pretty colors and some other stuff.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use chrono::Locale;
use once_cell::sync::OnceCell;
use sys_locale::get_locale;

fn locale_str() -> String {
    get_locale().unwrap_or_default().replace('-', "_")
}

/// Finds current locale
pub fn current_locale() -> Locale {
    const DEFAULT: Locale = Locale::en_US;
    static CACHE: OnceCell<Locale> = OnceCell::new();

    *CACHE.get_or_init(|| Locale::try_from(locale_str().as_str()).unwrap_or(DEFAULT))
}