report: reproduce the pre-refactor CLI output through the ports
Instead of carrying raw UI in core, the ports now represent everything
the CLI used to do inline:
- Prompter::present shows context outside of a question (the wizard
summary screen, the vendoring notice spacing); TerminalPrompter
prints it on stdout exactly like the println!s it replaces, server
embeds forward it as a display event.
- generate_entry returns the generated entry (package, versions,
series, path) instead of printing; the CLI renders the same lines.
- BuildTarget carries a flow-composed display line and a tee_log flag:
the terminal adapter renders it verbatim ("Building source package
...", "Building ... for series/arch", "Uploading ... to ...") and
uploads open no build log.
- The unmet build-dependency diagnostics are rendered by the CLI from
the typed error, in the original order (details, then summary).
- --verbose constructs no live view at all (an idle widget used to
linger), and the re-vendor offer only logs when it is actually
asked, so headless runs print the error exactly once.
This commit is contained in:
+23
-4
@@ -30,18 +30,28 @@ pub type Validator = dyn Fn(&str) -> Result<(), String>;
|
||||
|
||||
/// Identity of the build whose events follow, as announced through
|
||||
/// [`BuildView::target`].
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct BuildTarget<'a> {
|
||||
/// Source package name (e.g. `hello`).
|
||||
pub package: &'a str,
|
||||
/// Full version being built (e.g. `2.10-3`).
|
||||
pub version: &'a str,
|
||||
/// What the build targets: a distribution series, optionally with an
|
||||
/// architecture (`noble`, `sid`, `noble/arm64`).
|
||||
/// architecture (`noble`, `sid`, `noble/arm64`), or the upload target
|
||||
/// label.
|
||||
pub target: &'a str,
|
||||
/// Whether this is a source-only build (producing a `.dsc`) as opposed
|
||||
/// to a binary build (producing `.deb` files).
|
||||
/// Ready-to-render status line for display adapters, composed by the
|
||||
/// flow (e.g. "Building source package hello (2.10-3) for unstable",
|
||||
/// "Uploading hello (2.10-3) to ppa:user/ppa"): the wording is the
|
||||
/// flow's, adapters render it verbatim.
|
||||
pub display: String,
|
||||
/// Whether this is a source-only build (producing a `.dsc`); names the
|
||||
/// terminal adapter's tee log (`build-*.log` vs `deb-*.log`).
|
||||
pub source_only: bool,
|
||||
/// Whether the view should tee raw subprocess output to its log file.
|
||||
/// Flows without subprocess output (uploads) pass `false` and create
|
||||
/// no log file.
|
||||
pub tee_log: bool,
|
||||
}
|
||||
|
||||
/// Observer of a running build: target identification, phases, status
|
||||
@@ -156,6 +166,15 @@ pub trait Prompter: Send + Sync {
|
||||
fn accept_host_key(&self, _host: &str, _key_type: &str, _fingerprint: &str) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
/// Present information to the user outside of any question: the
|
||||
/// scaffold wizard's summary screen, prominent notices around a
|
||||
/// warning. Terminal implementations print the text as-is (unstyled,
|
||||
/// on stdout); server implementations forward it as a display event.
|
||||
/// Implementations that cannot show anything drop it — flows only
|
||||
/// present context that is also available structurally (returned data,
|
||||
/// log records).
|
||||
fn present(&self, _text: &str) {}
|
||||
}
|
||||
|
||||
/// Inert view and prompter: drops every event and answers every question
|
||||
|
||||
Reference in New Issue
Block a user