new: drive the wizard and verification offers through the Prompter port
The interactive half of pkh new no longer touches the terminal prompt module directly: run() takes a Prompter, picks the wizard or the plain resolve path through interactive(), and every select/text/confirm question (including the verification offers) goes through the port. Cancellations propagate as Err, preserving Ctrl+C-aborts; the summary and vendoring-notice prints become log lines. A builder-server embed can now drive the whole scaffold wizard over its own wire format by implementing Prompter.
This commit is contained in:
+6
-2
@@ -321,10 +321,14 @@ fn main() {
|
||||
// the structural self-checks inside `scaffold` always run), with
|
||||
// the scaffold outcome (e.g. a failed vendoring) shaping the
|
||||
// offer.
|
||||
let prompter = pkh::ui::prompt::TerminalPrompter;
|
||||
if let Err(e) = rt.block_on(async {
|
||||
let opts = pkh::new::questions::run(cli).await?;
|
||||
let opts = pkh::new::questions::run(cli, &prompter).await?;
|
||||
let outcome = pkh::new::scaffold(opts.clone(), &multi)?;
|
||||
pkh::new::questions::offer_verification(&opts, &outcome, &multi, no_verify).await;
|
||||
pkh::new::questions::offer_verification(
|
||||
&opts, &outcome, &multi, no_verify, &prompter,
|
||||
)
|
||||
.await;
|
||||
Ok::<(), Box<dyn std::error::Error>>(())
|
||||
}) {
|
||||
error!("{}", e);
|
||||
|
||||
Reference in New Issue
Block a user