@@ -130,6 +130,7 @@ interface CommandOption {
130130 negatedDescription ?: string ;
131131 defaultValue ?: string ;
132132 hidden ?: boolean ;
133+ negativeHidden ?: boolean ;
133134 group ?: "core" ;
134135}
135136
@@ -831,7 +832,7 @@ class WebpackCLI {
831832 false ,
832833 ) ;
833834
834- optionForCommand . hidden = option . hidden || false ;
835+ optionForCommand . hidden = option . hidden || option . negativeHidden || false ;
835836
836837 command . addOption ( optionForCommand ) ;
837838 }
@@ -1010,8 +1011,10 @@ class WebpackCLI {
10101011 } ,
10111012 ] ;
10121013
1013- // Options from webpack core to be included in the minimum help output
1014- const minimumHelpFlags = [
1014+ // Extract all the flags being exported from core.
1015+ // A list of cli flags generated by core can be found here https://github.com/webpack/webpack/blob/main/test/__snapshots__/Cli.basictest.js.snap
1016+ // Fast search, `includes` is slow
1017+ const minHelpSet = new Set ( [
10151018 "mode" ,
10161019 "watch" ,
10171020 "watch-options-stdin" ,
@@ -1022,12 +1025,8 @@ class WebpackCLI {
10221025 "name" ,
10231026 "output-path" ,
10241027 "extends" ,
1025- ] ;
1026-
1027- // Extract all the flags being exported from core.
1028- // A list of cli flags generated by core can be found here https://github.com/webpack/webpack/blob/main/test/__snapshots__/Cli.basictest.js.snap
1029- // Fast search, `includes` is slow
1030- const minHelpSet = new Set ( minimumHelpFlags ) ;
1028+ ] ) ;
1029+ const minimumNegativeHelpFlags = new Set ( [ "devtool" ] ) ;
10311030 const coreArgs = this . webpack . cli . getArguments ( ) ;
10321031 // Take memory
10331032 const options : CommandOption [ ] = Array . from ( {
@@ -1047,6 +1046,7 @@ class WebpackCLI {
10471046 description : meta . description ,
10481047 group : "core" ,
10491048 hidden : ! minHelpSet . has ( name ) ,
1049+ negativeHidden : ! minimumNegativeHelpFlags . has ( name ) ,
10501050 } ;
10511051 }
10521052
0 commit comments