File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -860,8 +860,10 @@ const parseCore = (
860860 const version = detectVersionSync ( options . version ) ;
861861 if ( version ) {
862862 console . log ( version ) ;
863- process . exit ( 0 ) ;
863+ } else {
864+ console . log ( 'Version information not available' ) ;
864865 }
866+ process . exit ( 0 ) ;
865867 }
866868
867869 // Handle shell completion (when enabled)
@@ -1004,8 +1006,24 @@ const generateCommandHelpNew = (
10041006 */
10051007/* c8 ignore start -- only called from help paths that call process.exit() */
10061008const generateHelpNew = ( state : InternalCliState , theme : Theme ) : string => {
1007- // Build options schema, adding --completion-script if completion is enabled
1009+ // Build options schema, adding built-in options
10081010 let options = state . globalParser ?. __optionsSchema ;
1011+
1012+ // Always add --help and --version (they're always available)
1013+ options = {
1014+ ...options ,
1015+ help : {
1016+ aliases : [ 'h' ] ,
1017+ description : 'Show help information' ,
1018+ type : 'boolean' as const ,
1019+ } ,
1020+ version : {
1021+ description : 'Show version number' ,
1022+ type : 'boolean' as const ,
1023+ } ,
1024+ } ;
1025+
1026+ // Add --completion-script if completion is enabled
10091027 if ( state . options . completion ) {
10101028 options = {
10111029 ...options ,
You can’t perform that action at this time.
0 commit comments