Skip to content

Commit

Permalink
feat: Show help when missing args for all cmds. (#209)
Browse files Browse the repository at this point in the history
Update CLI handling for all commands to ensure help text is printed when no
arguments are provided. We did this inconsistently before, where it was
applied at the top level but not at any levels below that.

Signed-off-by: Andrew Lilley Brinker <alilleybrinker@gmail.com>
  • Loading branch information
alilleybrinker authored Nov 12, 2024
1 parent b466baf commit b9dbde0
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions omnibor-cli/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ pub enum Command {
}

#[derive(Debug, clap::Args)]
#[command(arg_required_else_help = true)]
pub struct ArtifactArgs {
#[clap(subcommand)]
command: Option<ArtifactCommand>,
Expand All @@ -140,13 +141,15 @@ pub enum ArtifactCommand {
}

#[derive(Debug, Clone, clap::Args)]
#[command(arg_required_else_help = true)]
pub struct IdArgs {
/// Path to identify
#[arg(short = 'p', long = "path", help_heading = "Important Flags")]
pub path: PathBuf,
}

#[derive(Debug, Clone, clap::Args)]
#[command(arg_required_else_help = true)]
pub struct FindArgs {
/// Artifact ID to match
#[arg(short = 'a', long = "aid", help_heading = "Important Flags")]
Expand All @@ -158,6 +161,7 @@ pub struct FindArgs {
}

#[derive(Debug, clap::Args)]
#[command(arg_required_else_help = true)]
pub struct ManifestArgs {
#[clap(subcommand)]
command: ManifestCommand,
Expand All @@ -180,12 +184,15 @@ pub enum ManifestCommand {
}

#[derive(Debug, clap::Args)]
#[command(arg_required_else_help = true)]
pub struct ManifestAddArgs {}

#[derive(Debug, clap::Args)]
#[command(arg_required_else_help = true)]
pub struct ManifestRemoveArgs {}

#[derive(Debug, clap::Args)]
#[command(arg_required_else_help = true)]
pub struct ManifestCreateArgs {
/// Inputs to record in the manifest
#[arg(short = 'i', long = "input", help_heading = "Important Flags")]
Expand All @@ -201,6 +208,7 @@ pub struct ManifestCreateArgs {
}

#[derive(Debug, clap::Args)]
#[command(arg_required_else_help = true)]
pub struct DebugArgs {
#[clap(subcommand)]
command: Option<DebugCommand>,
Expand Down

0 comments on commit b9dbde0

Please sign in to comment.