feat: Add the ability to set args for module calls
This commit is contained in:
parent
2b75e2a6ef
commit
abd19b6f72
3 changed files with 37 additions and 0 deletions
|
|
@ -31,6 +31,10 @@ pub struct ModuleRequiredFields<'a> {
|
|||
#[serde(rename = "no-cache", default, skip_serializing_if = "is_false")]
|
||||
pub no_cache: bool,
|
||||
|
||||
#[builder(into)]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub env: Option<IndexMap<String, String>>,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[builder(default, into)]
|
||||
pub config: IndexMap<String, Value>,
|
||||
|
|
@ -77,6 +81,15 @@ impl<'a> ModuleRequiredFields<'a> {
|
|||
))
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn get_env(&self) -> Vec<(&String, &String)> {
|
||||
self.env
|
||||
.as_ref()
|
||||
.iter()
|
||||
.flat_map(|args| args.iter())
|
||||
.collect()
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn get_non_local_source(&'a self) -> Option<&'a str> {
|
||||
let source = self.source.as_deref()?;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue