Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/cmd_alias.rs
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,7 @@ mod test {
io,
debug: false,
override_host: None,
kcl_retry_config: None,
};

let cmd_alias = crate::cmd_alias::CmdAlias { subcmd: t.cmd };
Expand Down
1 change: 1 addition & 0 deletions src/cmd_auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -614,6 +614,7 @@ mod test {
io,
debug: false,
override_host: None,
kcl_retry_config: None,
};
if let Some(h) = &t.host {
ctx.override_host = Some(h.clone());
Expand Down
1 change: 1 addition & 0 deletions src/cmd_completion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ mod test {
io,
debug: false,
override_host: None,
kcl_retry_config: None,
};

cmd.run(&mut ctx).await.unwrap();
Expand Down
2 changes: 2 additions & 0 deletions src/cmd_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ mod test {
io,
debug: false,
override_host: None,
kcl_retry_config: None,
};

let cmd_config = crate::cmd_config::CmdConfig { subcmd: t.cmd };
Expand Down Expand Up @@ -301,6 +302,7 @@ mod test {
io,
debug: false,
override_host: None,
kcl_retry_config: None,
};

let mut cmd_config = crate::cmd_config::CmdConfig {
Expand Down
1 change: 1 addition & 0 deletions src/cmd_file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -868,6 +868,7 @@ mod test {
io,
debug: false,
override_host: None,
kcl_retry_config: None,
};

let cmd_file = crate::cmd_file::CmdFile { subcmd: t.cmd };
Expand Down
2 changes: 2 additions & 0 deletions src/cmd_generate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ mod test {
io,
debug: false,
override_host: None,
kcl_retry_config: None,
};

let cmd = crate::cmd_generate::CmdGenerateMarkdown { dir: "".to_string() };
Expand Down Expand Up @@ -192,6 +193,7 @@ mod test {
io,
debug: false,
override_host: None,
kcl_retry_config: None,
};

let cmd = crate::cmd_generate::CmdGenerateMarkdown { dir: "".to_string() };
Expand Down
45 changes: 13 additions & 32 deletions src/cmd_kcl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ impl crate::cmd::Command for CmdKclExport {
let units: UnitLength = meta_settings.default_length_units.to_kcmc();
let output_format = get_output_format(&self.output_format, units, self.deterministic);

if crate::context::Context::use_server_kcl_execution() {
let (files, session_data) = if crate::context::Context::use_server_kcl_execution() {
let (mut responses, session_data) = ctx
.run_server_kcl_then_modeling_cmds(
"",
Expand All @@ -176,37 +176,18 @@ impl crate::cmd::Command for CmdKclExport {
anyhow::bail!("Expected Export response from engine");
};

for file in files {
let path = self.output_dir.join(file.name);
std::fs::write(&path, file.contents)?;

writeln!(ctx.io.out, "Wrote file: {}", path.display())?;
}

if self.show_trace {
print_trace_link(&mut ctx.io, &session_data)
}

return Ok(());
}

let client = ctx.api_client("")?;
let ectx = kcl_lib::ExecutorContext::new(&client, settings).await?;
let mut state = kcl_lib::ExecState::new(&ectx);
let session_data = ectx
.run(&program, &mut state)
.await
.map_err(|err| kcl_error_fmt::into_miette(err, &code))?
.1;
kcl_error_fmt::check_exec_state_issues(
&mut ctx.io.err_out,
&filepath.display().to_string(),
&code,
&state,
self.run_options.issue_check(),
)?;

let files = ectx.export(output_format).await?;
(files, session_data)
} else {
ctx.run_kcl_then_export(
&filepath.display().to_string(),
&code,
&program,
settings,
self.run_options.issue_check(),
output_format,
)
.await?
};

// Save the files to our export directory.
for file in files {
Expand Down
1 change: 1 addition & 0 deletions src/cmd_say.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ mod test {
io,
debug: false,
override_host: None,
kcl_retry_config: None,
};

let cmd_say = crate::cmd_say::CmdSay { input: t.cmd.input };
Expand Down
1 change: 1 addition & 0 deletions src/cmd_user.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ mod test {
io,
debug: false,
override_host: None,
kcl_retry_config: None,
};

let cmd_user = crate::cmd_user::CmdUser { subcmd: t.cmd };
Expand Down
Loading
Loading