Skip to content

Commit

Permalink
Merge clap-rs#2949
Browse files Browse the repository at this point in the history
2949: fix(derive): Use variants help_heading r=epage a=epage



Co-authored-by: Ed Page <eopage@gmail.com>
  • Loading branch information
bors[bot] and epage committed Oct 26, 2021
2 parents b77b4e4 + 69a7b71 commit c0ac536
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions clap_derive/src/derives/subcommand.rs
Expand Up @@ -224,7 +224,7 @@ fn gen_augment(
};

let name = attrs.cased_name();
let initial_app_methods = parent_attribute.initial_top_level_methods();
let initial_app_methods = attrs.initial_top_level_methods();
let final_from_attrs = attrs.final_top_level_methods();
let subcommand = quote! {
let #app_var = #app_var.subcommand({
Expand Down Expand Up @@ -267,7 +267,7 @@ fn gen_augment(
};

let name = attrs.cased_name();
let initial_app_methods = parent_attribute.initial_top_level_methods();
let initial_app_methods = attrs.initial_top_level_methods();
let final_from_attrs = attrs.final_top_level_methods();
let subcommand = quote! {
let #app_var = #app_var.subcommand({
Expand Down
6 changes: 3 additions & 3 deletions clap_derive/tests/help.rs
Expand Up @@ -90,27 +90,27 @@ fn app_help_heading_flattened() {
}

#[derive(Debug, Clone, Subcommand)]
#[clap(help_heading = "SUB A")]
enum SubA {
#[clap(flatten)]
SubB(SubB),
#[clap(subcommand)]
SubC(SubC),
SubAOne,
#[clap(help_heading = "SUB A")]
SubATwo {
should_be_in_sub_a: Option<u32>,
},
}

#[derive(Debug, Clone, Subcommand)]
#[clap(help_heading = "SUB B")]
enum SubB {
#[clap(help_heading = "SUB B")]
SubBOne { should_be_in_sub_b: Option<u32> },
}

#[derive(Debug, Clone, Subcommand)]
#[clap(help_heading = "SUB C")]
enum SubC {
#[clap(help_heading = "SUB C")]
SubCOne { should_be_in_sub_c: Option<u32> },
}

Expand Down

0 comments on commit c0ac536

Please sign in to comment.