@@ -1401,17 +1401,33 @@ class Command extends EventEmitter {
14011401
14021402  optionHelp ( )  { 
14031403    const  width  =  this . padWidth ( ) ; 
1404- 
14051404    const  columns  =  process . stdout . columns  ||  80 ; 
14061405    const  descriptionWidth  =  columns  -  width  -  4 ; 
1406+     function  padOptionDetails ( flags ,  description )  { 
1407+       return  pad ( flags ,  width )  +  '  '  +  optionalWrap ( description ,  descriptionWidth ,  width  +  2 ) ; 
1408+     } ; 
14071409
1408-     // Append the help information  
1409-     return  this . options . map ( ( option )  =>  { 
1410+     // Explicit options (including version)  
1411+     const   help   =  this . options . map ( ( option )  =>  { 
14101412      const  fullDesc  =  option . description  + 
14111413        ( ( ! option . negate  &&  option . defaultValue  !==  undefined )  ? ' (default: '  +  JSON . stringify ( option . defaultValue )  +  ')'  : '' ) ; 
1412-       return  pad ( option . flags ,  width )  +  '  '  +  optionalWrap ( fullDesc ,  descriptionWidth ,  width  +  2 ) ; 
1413-     } ) . concat ( [ pad ( this . _helpFlags ,  width )  +  '  '  +  optionalWrap ( this . _helpDescription ,  descriptionWidth ,  width  +  2 ) ] ) 
1414-       . join ( '\n' ) ; 
1414+       return  padOptionDetails ( option . flags ,  fullDesc ) ; 
1415+     } ) ; 
1416+ 
1417+     // Implicit help 
1418+     const  showShortHelpFlag  =  this . _helpShortFlag  &&  ! this . _findOption ( this . _helpShortFlag ) ; 
1419+     const  showLongHelpFlag  =  ! this . _findOption ( this . _helpLongFlag ) ; 
1420+     if  ( showShortHelpFlag  ||  showLongHelpFlag )  { 
1421+       let  helpFlags  =  this . _helpFlags ; 
1422+       if  ( ! showShortHelpFlag )  { 
1423+         helpFlags  =  this . _helpLongFlag ; 
1424+       }  else  if  ( ! showLongHelpFlag )  { 
1425+         helpFlags  =  this . _helpShortFlag ; 
1426+       } 
1427+       help . push ( padOptionDetails ( helpFlags ,  this . _helpDescription ) ) ; 
1428+     } 
1429+ 
1430+     return  help . join ( '\n' ) ; 
14151431  } ; 
14161432
14171433  /** 
0 commit comments