File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import { program } from "commander" ;
2+ import { on } from "node:events" ;
23import { promises as fs } from "node:fs" ;
34import path from "node:path" ;
45
@@ -14,24 +15,14 @@ program
1415program . parse ( ) ;
1516
1617const paths = program . args ;
18+ const { 1 : onePerLine , all } = program . opts ( ) ;
1719
1820const directory = paths . length === 0 ? "." : paths [ 0 ] ;
1921
2022let entries = await fs . readdir ( directory ) ;
21- console . log ( entries . join ( " " ) ) ;
2223
24+ if ( onePerLine ) {
25+ console . log ( entries . filter ( ( entry ) => entry [ 0 ] !== "." ) . join ( "\n" ) ) ;
26+ // entries.filter((entry) => { entry[0] === "." })
27+ }
2328
24- // entries.forEach((entry) => {
25- // console.log(entry);
26- // });
27-
28- // Read directory entries
29- // console.log(entries);
30- // for (const directory of directories) {
31-
32- // console.log(entries);
33- // }
34-
35- // console.log(entries);
36-
37- // --- Read directory contents ---
You can’t perform that action at this time.
0 commit comments