Release 2.7.0: executable handbooks and native user-site workflows
This commit is contained in:
1 parent
aa0c4d0f55
commit
d9aef957f7
562 files changed
+21064
-20387
No files matched your search
+7
-1
@@ -35,6 +35,8 @@ pub struct CallStep {
|
||||
pub function: String,
|
||||
pub args: BTreeMap<String, serde_json::Value>,
|
||||
pub effects: String,
|
||||
#[serde(default, skip_serializing_if = "is_false")]
|
||||
pub literal_args: bool,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub result: Option<serde_json::Value>,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
@@ -43,6 +45,8 @@ pub struct CallStep {
|
||||
pub toget: Option<String>,
|
||||
}
|
||||
|
||||
fn is_false(value: &bool) -> bool { !*value }
|
||||
|
||||
fn sessions_root() -> PathBuf {
|
||||
if let Ok(p) = std::env::var("MARQDO_CALL_SESSION_DIR") {
|
||||
return PathBuf::from(p);
|
||||
@@ -179,7 +183,7 @@ fn replay_live(session: &CallSession, backend: Backend) -> Result<BTreeMap<Strin
|
||||
for (k, jv) in &step.args {
|
||||
let mut val = json_to_value(jv).map_err(|e| anyhow::anyhow!(e))?;
|
||||
if let Value::Text(t) = &val {
|
||||
if t.starts_with('$') || t.starts_with('@') {
|
||||
if !step.literal_args && (t.starts_with('$') || t.starts_with('@')) {
|
||||
let key = &t[1..];
|
||||
val = live
|
||||
.get(key)
|
||||
@@ -249,6 +253,7 @@ pub fn record_step(
|
||||
function: function.to_string(),
|
||||
args: arg_map,
|
||||
effects: effects.as_str(),
|
||||
literal_args: false,
|
||||
result: if is_json_friendly(result) {
|
||||
value_to_json(result).ok()
|
||||
} else {
|
||||
@@ -321,6 +326,7 @@ mod write_snapshot_tests {
|
||||
fs::write(dir.join("log.txt"), "once").unwrap();
|
||||
for backend in [Backend::Tree, Backend::Bytecode] {
|
||||
let step = CallStep {
|
||||
literal_args: false,
|
||||
file: Path::new(env!("CARGO_MANIFEST_DIR"))
|
||||
.join("lib/fs.mq.md")
|
||||
.to_string_lossy()
|
||||
|
||||
Reference in new issue
Block a user