MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / write_upload_archive

Function write_upload_archive

crates/openshell-cli/src/ssh.rs:605–630  ·  view source on GitHub ↗
(writer: W, source: UploadSource)

Source from the content-addressed store, hash-verified

603}
604
605fn write_upload_archive<W: Write>(writer: W, source: UploadSource) -> Result<()> {
606 let mut archive = tar::Builder::new(writer);
607 match source {
608 UploadSource::SinglePath {
609 local_path,
610 tar_name,
611 } => {
612 append_upload_path(&mut archive, &local_path, Path::new(&tar_name), false)?;
613 }
614 UploadSource::FileList {
615 base_dir,
616 files,
617 archive_prefix,
618 } => {
619 for file in &files {
620 let full_path = base_dir.join(file);
621 let archive_path = archive_prefix
622 .as_ref()
623 .map_or_else(|| PathBuf::from(file), |prefix| prefix.join(file));
624 append_upload_path(&mut archive, &full_path, &archive_path, true)?;
625 }
626 }
627 }
628 archive.finish().into_diagnostic()?;
629 Ok(())
630}
631
632fn append_upload_path<W: Write>(
633 archive: &mut tar::Builder<W>,

Callers 2

ssh_tar_uploadFunction · 0.85
upload_archive_entriesFunction · 0.85

Calls 1

append_upload_pathFunction · 0.85

Tested by

no test coverage detected