Skip to main content

ssh_cli/sftp/
mod.rs

1// SPDX-License-Identifier: MIT OR Apache-2.0
2// G-SFTP: SFTP CLI surface (one-shot; stream transfers; no full-file heap).
3#![forbid(unsafe_code)]
4//! SFTP subsystem operations over SSH (upload/download/ls/mkdir/rm/stat/rename).
5//!
6//! Complements SCP (regular-file wire). SFTP adds directory trees and FS ops.
7//! Multi-host fan-out uses [`crate::concurrency::map_bounded`]. Multi-file on one
8//! host reuses **one** SFTP session (G-SFTP-19).
9
10use crate::cli::SftpAction;
11use crate::constants::SFTP_FALLBACK_BASENAME;
12use crate::errors::SshCliError;
13use crate::i18n::{self, Message};
14use crate::output;
15use crate::ssh::client::{SshClient, TransferResult};
16use crate::ssh::sftp_path::{ensure_local_under, validate_entry_name};
17use crate::ssh::sftp_session;
18use crate::ssh::sftp_types::{SftpListEntry, SftpStat};
19use crate::vps;
20use std::path::{Path, PathBuf};
21use std::time::Instant;
22
23pub(crate) mod batch;
24
25/// Runtime overrides for the `sftp` subcommand (parity with scp + agent G-SFTP-18).
26mod dispatch;
27mod emit;
28mod setup;
29
30pub use dispatch::run_sftp;
31pub(crate) use emit::{emit_fs_op, emit_list, emit_stat, emit_transfer};
32pub(crate) use setup::apply_sftp_options;
33pub use setup::SftpOptions;
34pub(crate) use setup::{connect_client, remote_str};