put: report through the view and ask the host-key question through the Prompter

put() loses its MultiProgress parameter: the summary, pre-flight and
connection spinners become view messages, the per-file SFTP transfer
reports determinate progress through view.progress (upload_file takes
a byte-count callback instead of an indicatif bar), and the display is
released through view.suspend on every exit path. The hardcoded
trust-on-first-use prompt in the SSH host-key verification becomes the
Prompter::accept_host_key port (fail-closed by default; the terminal
prompter prints the authenticity banner and confirms), so a remote
frontend can surface its own host-key dialog.
This commit is contained in:
2026-09-18 20:42:17 +02:00
parent bb76e41908
commit 54cb04ba27
6 changed files with 62 additions and 93 deletions
+2 -1
View File
@@ -83,7 +83,8 @@ impl DebUi {
let pb = multi.add(ProgressBar::new(0));
pb.enable_steady_tick(Duration::from_millis(80));
pb.set_style(spinner_style());
pb.set_prefix("Building package");
// Neutral identity until a `target` event names the build
pb.set_prefix("pkh");
pb.set_message("(starting…)");
pb
} else {
+8
View File
@@ -159,6 +159,14 @@ impl crate::report::Prompter for TerminalPrompter {
) -> Result<String, Box<dyn std::error::Error>> {
text(label, default, validate)
}
fn accept_host_key(&self, host: &str, key_type: &str, fingerprint: &str) -> bool {
// The banner is plain output: the confirmation prompt itself must
// stay a single line for its redraw logic
println!("The authenticity of host '{host}' can't be established.");
println!("{key_type} key fingerprint is {fingerprint}.");
confirm("Accept and store this host key?", false).unwrap_or(false)
}
}
/// Run `prompt` with the terminal in raw mode, always restoring it