File tree Expand file tree Collapse file tree 2 files changed +26
-1
lines changed Expand file tree Collapse file tree 2 files changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -2932,7 +2932,7 @@ impl<'help> App<'help> {
29322932            help_subcmd. long_version  = None ; 
29332933            help_subcmd = help_subcmd
29342934                . setting ( AppSettings :: DisableHelpFlag ) 
2935-                 . unset_setting ( AppSettings :: PropagateVersion ) ; 
2935+                 . unset_global_setting ( AppSettings :: PropagateVersion ) ; 
29362936
29372937            self . subcommands . push ( help_subcmd) ; 
29382938        } 
Original file line number Diff line number Diff line change @@ -2734,3 +2734,28 @@ fn disable_help_flag_affects_help_subcommand() {
27342734        args
27352735    ) ; 
27362736} 
2737+ 
2738+ #[ test]  
2739+ fn  dont_propagate_version_to_help_subcommand ( )  { 
2740+     let  app = clap:: App :: new ( "test" ) 
2741+         . version ( "1.0" ) 
2742+         . global_setting ( clap:: AppSettings :: PropagateVersion ) 
2743+         . subcommand ( clap:: App :: new ( "subcommand" ) ) ; 
2744+ 
2745+     assert ! ( utils:: compare_output( 
2746+         app. clone( ) , 
2747+         "example help help" , 
2748+         "example-help  
2749+ Print this message or the help of the given subcommand(s) 
2750+ 
2751+ USAGE: 
2752+     example help [SUBCOMMAND]... 
2753+ 
2754+ ARGS: 
2755+     <SUBCOMMAND>...    The subcommand whose help message to display 
2756+ " , 
2757+         false 
2758+     ) ) ; 
2759+ 
2760+     app. debug_assert ( ) ; 
2761+ } 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments