cli: Display rad-web in rad --help

Only show `rad-web` in help, if we are able to run the binary.
This commit is contained in:
Sebastian Martinez 2024-01-24 15:17:00 +01:00 committed by cloudhead
parent 1af505c5c3
commit 921f9f2d76
No known key found for this signature in database
2 changed files with 13 additions and 1 deletions

View File

@ -1,4 +1,6 @@
use std::ffi::OsString;
use std::process::Command;
use std::str;
use crate::terminal as term;
use crate::terminal::args::{Args, Error, Help};
@ -81,6 +83,16 @@ pub fn run(_options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
term::format::dim(help.description)
);
}
// Obtain the rad-web help.
if let Ok(output) = Command::new("rad-web").arg("--help").output() {
if let Some(description) = str::from_utf8(&output.stdout)?.lines().nth(1) {
term::info!(
"\t{} {}",
term::format::bold(format!("{:-12}", "web")),
term::format::dim(description)
);
}
}
term::blank();
term::print("See `rad <command> --help` to learn about a specific command.");
term::blank();

View File

@ -15,7 +15,7 @@ use radicle_cli::terminal::args::{Args, Error, Help};
pub const HELP: Help = Help {
name: "web",
description: "Start HTTP API server and connect the web explorer to it",
description: "Run the HTTP daemon and connect the web explorer to it",
version: env!("CARGO_PKG_VERSION"),
usage: r#"
Usage