Skip to content

Commit

Permalink
braid: add 'help' subcommand
Browse files Browse the repository at this point in the history
  • Loading branch information
astraw committed Nov 29, 2024
1 parent 6b5fe81 commit 866d315
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions braid/src/bin/braid.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use clap::Parser;
use clap::{CommandFactory, Parser};
use color_eyre::{eyre::WrapErr, Result};

#[derive(Debug, Parser)]
#[command(author, version, about)]
struct BraidLauncherCliArgs {
/// Command to execute (e.g. run, show-config, default-config)
/// Command to execute (e.g. run, show-config, default-config, help)
command: String,
/// Options specific to the command
options: Vec<String>,
Expand All @@ -20,6 +20,12 @@ fn main() -> Result<()> {
let args = BraidLauncherCliArgs::parse();
tracing::debug!("{:?}", args);

if args.command == "help" {
let help = BraidLauncherCliArgs::command().render_long_help();
println!("{}", help.ansi());
return Ok(());
}

let cmd_name = format!("braid-{}", args.command);

let status = std::process::Command::new(&cmd_name)
Expand Down

0 comments on commit 866d315

Please sign in to comment.