File tree Expand file tree Collapse file tree 1 file changed +3
-4
lines changed
implement-shell-tools/cat Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Original file line number Diff line number Diff line change @@ -24,8 +24,7 @@ if (files.length === 0) {
2424}
2525
2626// Global counters across all files
27- let lineCounter = 1 ;
28- let nonBlankCounter = 1 ;
27+ let counter = 1 ;
2928
3029for ( const file of files ) {
3130 try {
@@ -34,10 +33,10 @@ for (const file of files) {
3433
3534 if ( showNoBlankNumb ) { // Number only non-blank lines
3635 content = lines . map ( line =>
37- line . trim ( ) === '' ? '' : `${ nonBlankCounter ++ } \t${ line } `
36+ line . trim ( ) === '' ? '' : `${ counter ++ } \t${ line } `
3837 ) . join ( '\n' ) ;
3938 } else if ( showLineNumb ) { // Number all lines
40- content = lines . map ( ( line ) => `${ lineCounter ++ } \t${ line } ` ) . join ( '\n' ) ;
39+ content = lines . map ( ( line ) => `${ counter ++ } \t${ line } ` ) . join ( '\n' ) ;
4140 }
4241 console . log ( content ) ;
4342 } catch ( err ) {
You can’t perform that action at this time.
0 commit comments