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: 0 additions & 1 deletion cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ anyhow = "1.0.32"
base64 = "0.21"
bincode = "1.3.3"
cargo_toml = "0.19.2"
chrono = "0.4.19"
clap = { version = "4.5.17", features = ["derive"] }
clap_complete = "4.5.26"
console = "0.15"
Expand Down
18 changes: 5 additions & 13 deletions cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1660,9 +1660,6 @@ fn expand_program(
.as_ref()
.ok_or_else(|| anyhow!("Cargo config is missing a package"))?
.name;
let program_expansions_path = expansions_path.join(package_name);
fs::create_dir_all(&program_expansions_path)?;

let exit = std::process::Command::new("cargo")
.arg("expand")
.arg(target_dir_arg)
Expand All @@ -1676,16 +1673,11 @@ fn expand_program(
std::process::exit(exit.status.code().unwrap_or(1));
}

let version = cargo.version();
let time = chrono::Utc::now().to_string().replace(' ', "_");
let file_path = program_expansions_path.join(format!("{package_name}-{version}-{time}.rs"));
fs::write(&file_path, &exit.stdout).map_err(|e| anyhow::format_err!("{}", e))?;

println!(
"Expanded {} into file {}\n",
package_name,
file_path.to_string_lossy()
);
let stdout = std::io::stdout();
let mut handle = stdout.lock();
handle
.write_all(&exit.stdout)
.map_err(|e| anyhow::format_err!("{}", e))?;
Ok(())
}

Expand Down