@@ -97,8 +97,10 @@ const getArguments = (schema = webpackSchema) => {
9797 */
9898 const getDescription = path => {
9999 for ( const { schema } of path ) {
100- if ( schema . cli && schema . cli . helper ) continue ;
101- if ( schema . cliDescription ) return schema . cliDescription ;
100+ if ( schema . cli ) {
101+ if ( schema . cli . helper ) continue ;
102+ if ( schema . cli . description ) return schema . cli . description ;
103+ }
102104 if ( schema . description ) return schema . description ;
103105 }
104106 } ;
@@ -110,8 +112,24 @@ const getArguments = (schema = webpackSchema) => {
110112 */
111113 const getNegatedDescription = path => {
112114 for ( const { schema } of path ) {
113- if ( schema . cli && schema . cli . helper ) continue ;
114- if ( schema . negatedDescription ) return schema . negatedDescription ;
115+ if ( schema . cli ) {
116+ if ( schema . cli . helper ) continue ;
117+ if ( schema . cli . negatedDescription ) return schema . cli . negatedDescription ;
118+ }
119+ }
120+ } ;
121+
122+ /**
123+ *
124+ * @param {PathItem[] } path path in the schema
125+ * @returns {string | undefined } reset description
126+ */
127+ const getResetDescription = path => {
128+ for ( const { schema } of path ) {
129+ if ( schema . cli ) {
130+ if ( schema . cli . helper ) continue ;
131+ if ( schema . cli . resetDescription ) return schema . cli . resetDescription ;
132+ }
115133 }
116134 } ;
117135
@@ -156,13 +174,17 @@ const getArguments = (schema = webpackSchema) => {
156174 const addResetFlag = path => {
157175 const schemaPath = path [ 0 ] . path ;
158176 const name = pathToArgumentName ( `${ schemaPath } .reset` ) ;
159- const description = getDescription ( path ) ;
177+ const description =
178+ getResetDescription ( path ) ||
179+ `Clear all items provided in '${ schemaPath } ' configuration. ${ getDescription (
180+ path
181+ ) } `;
160182 flags [ name ] = {
161183 configs : [
162184 {
163185 type : "reset" ,
164186 multiple : false ,
165- description : `Clear all items provided in ' ${ schemaPath } ' configuration. ${ description } ` ,
187+ description,
166188 path : schemaPath
167189 }
168190 ] ,
0 commit comments