@@ -1461,8 +1461,6 @@ impl<'a, 'v, 'ab, 'u, 'h, 'ar> App<'a, 'v, 'ab, 'u, 'h, 'ar>{
1461
1461
// previous positionals too. This will denote where to start
1462
1462
// let mut req_pos_from_name = None;
1463
1463
if let Some ( p) = self . positionals_idx . get ( & pos_counter) {
1464
-
1465
-
1466
1464
if self . blacklist . contains ( p. name ) {
1467
1465
matches. args . remove ( p. name ) ;
1468
1466
self . report_error ( format ! ( "The argument '{}' cannot be used with {}" ,
@@ -1641,15 +1639,25 @@ impl<'a, 'v, 'ab, 'u, 'h, 'ar> App<'a, 'v, 'ab, 'u, 'h, 'ar>{
1641
1639
matches. usage = Some ( self . create_usage ( None ) ) ;
1642
1640
1643
1641
if let Some ( sc_name) = subcmd_name {
1642
+ let mut mid_string = String :: new ( ) ;
1643
+ if !self . subcmds_neg_reqs {
1644
+ let mut hs = self . required . iter ( ) . map ( |n| * n) . collect :: < Vec < _ > > ( ) ;
1645
+ matches. args . keys ( ) . map ( |k| hs. push ( * k) ) . collect :: < Vec < _ > > ( ) ;
1646
+ let reqs = self . get_required_from ( hs) ;
1647
+
1648
+ mid_string. push_str ( & reqs. iter ( ) . fold ( String :: new ( ) , |acc, s| acc + & format ! ( " {}" , s) [ ..] ) [ ..] )
1649
+ }
1650
+ mid_string. push_str ( " " ) ;
1644
1651
if let Some ( ref mut sc) = self . subcommands . get_mut ( & sc_name) {
1645
1652
let mut new_matches = ArgMatches :: new ( ) ;
1646
- // bin_name should be parent's bin_name + the sc's name separated by a space
1653
+ // bin_name should be parent's bin_name + [<reqs>] + the sc's name separated by a
1654
+ // space
1647
1655
sc. bin_name = Some ( format ! ( "{}{}{}" ,
1648
1656
self . bin_name. clone( ) . unwrap_or( "" . to_owned( ) ) ,
1649
1657
if self . bin_name. is_some( ) {
1650
- " "
1658
+ mid_string
1651
1659
} else {
1652
- ""
1660
+ "" . to_owned ( )
1653
1661
} ,
1654
1662
sc. name. clone( ) ) ) ;
1655
1663
sc. get_matches_from ( & mut new_matches, it) ;
0 commit comments