1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
use std::collections::BTreeMap;
use std::env;
use crate::compile::Config;
pub type Variables = BTreeMap<String, String>;
#[derive(Copy, Clone)]
pub enum LogFormat {
PLAIN,
JSON,
}
pub struct Options {
pub(crate) config: Config,
pub(crate) variables: Variables,
pub(crate) input_files: Option<Vec<String>>,
}
pub fn determine_variables() -> Variables {
let prefix = "YSV_VAR_";
env::vars().filter(
|(variable, _)| variable.starts_with(prefix)
).map(
|(variable, value)| (
variable.replace(prefix, ""),
value,
)
).collect()
}