use sprawling::serving;
pub(super) fn print_banner(
city: &std::path::Path,
url: &str,
client_line: &str,
keyed: &serving::Keyed,
) {
println!();
println!(" sprawling is running.");
println!();
println!(" city {}", city.display());
println!(" WebUI {url}");
println!(" client {client_line}");
println!();
match keyed {
serving::Keyed::Unshown(_) => {}
serving::Keyed::Adopted(_) => {
println!(" key the one you configured; this city will ask for it");
println!();
}
serving::Keyed::Minted(code) => {
println!(" key {code}");
println!();
println!(" This address reaches past this machine, so the city minted a key.");
println!(" It is shown once and replaced the next time you start; a program on");
println!(" another machine presents it with --token.");
println!();
}
}
println!(" Open the WebUI in a browser. Ctrl-C stops the city.");
println!();
}
pub(super) enum Reader {
LineConsole,
Log,
}
pub(super) fn print_pairing(reader: Reader) {
match reader {
Reader::LineConsole => {
println!(" This terminal reads one line at a time. `/help` lists what it takes,");
println!(" and `/serving` says where this city listens and what is running in it.");
println!(" `/web` opens a browser on this machine already paired with the city.");
}
Reader::Log => {
println!(" No pairing code is printed here, because this output is usually kept");
println!(" as a log. To pair a browser on this machine, serve the city with --open,");
println!(" which opens a page already paired, or with --console and type `/web`.");
}
}
println!();
}