inquire/
config.rs

1//! Global config definitions.
2
3use std::sync::Mutex;
4
5use lazy_static::lazy_static;
6
7use crate::ui::RenderConfig;
8
9lazy_static! {
10    static ref GLOBAL_RENDER_CONFIGURATION: Mutex<RenderConfig> =
11        Mutex::new(RenderConfig::default());
12}
13
14pub fn get_configuration() -> RenderConfig {
15    *GLOBAL_RENDER_CONFIGURATION.lock().unwrap()
16}
17
18/// Acquires a write lock to the global RenderConfig object
19/// and updates the inner value with the provided argument.
20pub fn set_global_render_config(config: RenderConfig) {
21    let mut guard = GLOBAL_RENDER_CONFIGURATION.lock().unwrap();
22    *guard = config;
23}
24
25/// Default page size when displaying options to the user.
26pub const DEFAULT_PAGE_SIZE: usize = 7;
27
28/// Default value of vim mode.
29pub const DEFAULT_VIM_MODE: bool = false;