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:
parent
1af505c5c3
commit
921f9f2d76
|
|
@ -1,4 +1,6 @@
|
||||||
use std::ffi::OsString;
|
use std::ffi::OsString;
|
||||||
|
use std::process::Command;
|
||||||
|
use std::str;
|
||||||
|
|
||||||
use crate::terminal as term;
|
use crate::terminal as term;
|
||||||
use crate::terminal::args::{Args, Error, Help};
|
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)
|
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::blank();
|
||||||
term::print("See `rad <command> --help` to learn about a specific command.");
|
term::print("See `rad <command> --help` to learn about a specific command.");
|
||||||
term::blank();
|
term::blank();
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ use radicle_cli::terminal::args::{Args, Error, Help};
|
||||||
|
|
||||||
pub const HELP: Help = Help {
|
pub const HELP: Help = Help {
|
||||||
name: "web",
|
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"),
|
version: env!("CARGO_PKG_VERSION"),
|
||||||
usage: r#"
|
usage: r#"
|
||||||
Usage
|
Usage
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue