summaryrefslogtreecommitdiffhomepage
path: root/src/opt.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/opt.rs')
-rw-r--r--src/opt.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/opt.rs b/src/opt.rs
index 196420e..87bc910 100644
--- a/src/opt.rs
+++ b/src/opt.rs
@@ -10,6 +10,7 @@ use crate::log;
use log::LogLevel;
+static OPT_DAEMON: OnceLock<bool> = OnceLock::new();
static OPT_LOG_LEVEL: OnceLock<LogLevel> = OnceLock::new();
static OPT_NO_SPLASH: OnceLock<bool> = OnceLock::new();
@@ -125,6 +126,7 @@ impl Opt {
}
pub fn set_opt(self) -> Result<()> {
+ set_opt("OPT_DAEMON", &OPT_DAEMON, self.daemon)?;
set_opt("OPT_LOG_LEVEL", &OPT_LOG_LEVEL, self.log_level)?;
set_opt("OPT_NO_SPLASH", &OPT_NO_SPLASH, self.no_splash)?;
@@ -141,6 +143,10 @@ impl Opt {
}
}
+pub fn daemon() -> bool {
+ *OPT_DAEMON.get().unwrap_or(&DEFAULT_DAEMON)
+}
+
pub fn no_splash() -> bool {
*OPT_NO_SPLASH.get().unwrap_or(&DEFAULT_NO_SPLASH)
}