use crate::config::origin;
use crate::{Ctx, exit};
pub const TEXT: &str = semora_proto::GUIDE;
pub fn text(ctx: &Ctx) -> String {
match &ctx.settings.server {
Some(server) => {
let base = origin(server);
let ws = match base.strip_prefix("https://") {
Some(rest) => format!("wss://{rest}"),
None => base.replacen("http://", "ws://", 1),
};
TEXT.replace("wss://semora.example.com", &ws)
.replace("https://semora.example.com", &base)
}
None => TEXT.to_string(),
}
}
pub fn run(ctx: &Ctx) -> anyhow::Result<i32> {
print!("{}", text(ctx));
Ok(exit::OK)
}