@@ -25,7 +25,7 @@ const details = [dirs, pkgDirs, files, extensions];
2525/* eslint-disable no-console */
2626
2727const own = makeOwn ( ) ;
28- const options = { dirAction, fileAction, own, stat : 'lstat' , dryRun : true } ;
28+ const options = { dirAction, fileAction, linkAction , own, stat : 'lstat' , dryRun : true } ;
2929
3030async function main ( ) {
3131 const { values : args , ...config } = await configuration . get ( ) ;
@@ -39,11 +39,12 @@ async function main () {
3939
4040 const dir = args . directory ;
4141 options . dryRun = args . dryRun ;
42- options . verbose = args . verbose ;
42+ options . verbose = args . verbose || args . veryVerbose ;
43+ options . veryVerbose = args . veryVerbose ;
4344 options . details = args . details ;
4445
4546 if ( options . verbose ) {
46- console . log ( 'deleting:' ) ;
47+ console . log ( 'deleting: (subtree, file, and ext) ' ) ;
4748 }
4849 return walk ( dir , options )
4950 . then ( ( ) => {
@@ -80,6 +81,10 @@ async function dirAction (filepath, ctx) {
8081 const { dirent, stat, own, stack} = ctx ;
8182 own . dirs += 1 ;
8283
84+ if ( options . veryVerbose ) {
85+ console . log ( `d: ${ stack . join ( '/' ) } ${ dirent . name } ` ) ;
86+ }
87+
8388 if ( dirs . has ( dirent . name ) || ( pkgDirs . has ( dirent . name ) && stack [ stack . length - 2 ] === 'node_modules' ) ) {
8489 // delete this directory after walking it to get the total size
8590 // that was removed. start with the size of this directory.
@@ -99,6 +104,7 @@ async function dirAction (filepath, ctx) {
99104 own . bytesDeleted += subOwn . bytes ;
100105 own . dirs += subOwn . dirs ;
101106 own . dirsDeleted += subOwn . dirs ;
107+ own . files += subOwn . files ;
102108 own . filesDeleted += subOwn . files ;
103109
104110 let details ;
@@ -134,6 +140,10 @@ async function fileAction (filepath, ctx) {
134140 own . bytes += stat . size ;
135141 own . files += 1 ;
136142
143+ if ( options . veryVerbose ) {
144+ console . log ( `f: ${ ctx . stack . join ( '/' ) } ${ dirent . name } ` ) ;
145+ }
146+
137147 if ( files . has ( dirent . name ) ) {
138148 own . filesDeleted += 1 ;
139149 own . bytesDeleted += stat . size ;
@@ -151,6 +161,7 @@ async function fileAction (filepath, ctx) {
151161 }
152162 return ;
153163 }
164+
154165 const ext = path . extname ( dirent . name ) ;
155166
156167 if ( ! xExtensions . has ( ext ) && extensions . has ( ext ) ) {
@@ -175,6 +186,10 @@ async function linkAction (filepath, ctx) {
175186 const { stat, own} = ctx ;
176187 own . bytes += stat . size ;
177188 own . files += 1 ;
189+
190+ if ( options . veryVerbose ) {
191+ console . log ( `l: ${ ctx . stack . join ( '/' ) } ${ ctx . dirent . name } ` ) ;
192+ }
178193}
179194
180195function makeOwn ( proto ) {
0 commit comments