1
1
<div align =" center " >
2
2
<h2 >File Tree CLI</h2 >
3
- <!-- <img src="./public/logo.svg" alt="MoviesPrix" width="250" /> -->
4
3
<p >A modern CLI tool for visualizing directory structures with advanced filtering and display options.</p >
5
4
</div >
6
5
19
18
- 💾 Save output to file
20
19
- ⚡ Performance optimized
21
20
22
- ## Installation
21
+ ## Usage
22
+
23
+ You can run the CLI tool directly using npx without installation:
23
24
24
25
``` bash
25
- npm install -g file-tree-cli
26
+ npx file-tree-cli [options] [directory]
26
27
```
27
28
28
- ## Usage
29
+ If you prefer to install it globally (optional):
29
30
30
31
``` bash
31
- tree [options] [directory]
32
+ npm install -g file-tree-cli
33
+ file-tree [options] [directory]
32
34
```
33
35
34
36
If no directory is specified, the current directory will be used.
@@ -37,56 +39,56 @@ If no directory is specified, the current directory will be used.
37
39
38
40
``` bash
39
41
# Display tree of current directory
40
- tree
42
+ npx file- tree-cli
41
43
42
44
# Display tree of specific directory
43
- tree /path/to/directory
45
+ npx file- tree-cli /path/to/directory
44
46
45
47
# Show tree with file sizes
46
- tree -s
48
+ npx file- tree-cli -s
47
49
48
50
# Show only JavaScript and TypeScript files
49
- tree --ext js,ts
51
+ npx file- tree-cli --ext js,ts
50
52
51
53
# Show files modified dates and sizes
52
- tree -s -m
54
+ npx file- tree-cli -s -m
53
55
```
54
56
55
57
### Advanced Examples
56
58
57
59
``` bash
58
60
# Show only directories, sorted by name
59
- tree --dirs-only --sort name
61
+ npx file- tree-cli --dirs-only --sort name
60
62
61
63
# Show only JavaScript files and their sizes
62
- tree --ext js -s
64
+ npx file- tree-cli --ext js -s
63
65
64
66
# Show tree with custom depth and excluded directories
65
- tree -d 3 -e " dist,coverage"
67
+ npx file- tree-cli -d 3 -e " dist,coverage"
66
68
67
69
# Show all files (including hidden) sorted by size
68
- tree -a --sort size
70
+ npx file- tree-cli -a --sort size
69
71
70
72
# Export tree to a file
71
- tree -o output.txt
73
+ npx file- tree-cli -o output.txt
72
74
```
73
75
74
76
## Options
75
77
76
- | Option | Description |
77
- | -------------------------- | ---------------------------------------------- |
78
- | ` -d, --max-depth <number> ` | Maximum depth to traverse |
79
- | ` -a, --all ` | Show hidden files |
80
- | ` -e, --exclude <items> ` | Comma-separated list of directories to exclude |
81
- | ` -s, --show-size ` | Show file sizes |
82
- | ` -m, --modified ` | Show last modified date |
83
- | ` -f, --pattern <pattern> ` | Filter items by regex pattern |
84
- | ` --ext <extensions> ` | Filter by file extensions (comma-separated) |
85
- | ` --sort <type> ` | Sort items by: name, size, or date |
86
- | ` -r, --reverse ` | Reverse sort order |
87
- | ` --dirs-only ` | Show only directories |
88
- | ` --files-only ` | Show only files |
89
- | ` -o, --output <file> ` | Save output to file |
78
+ | Option | Description | Default |
79
+ | -------------------------- | ---------------------------------------------- | ------- |
80
+ | ` -d, --max-depth <number> ` | Maximum depth to traverse | ∞ |
81
+ | ` -a, --all ` | Show hidden files | false |
82
+ | ` -e, --exclude <items> ` | Comma-separated list of directories to exclude | [ ] |
83
+ | ` -s, --show-size ` | Show file sizes | false |
84
+ | ` -m, --modified ` | Show last modified date | false |
85
+ | ` -f, --pattern <pattern> ` | Filter items by regex pattern | null |
86
+ | ` --ext <extensions> ` | Filter by file extensions (comma-separated) | [ ] |
87
+ | ` --sort <type> ` | Sort items by: name, size, or date | name |
88
+ | ` -r, --reverse ` | Reverse sort order | false |
89
+ | ` --dirs-only ` | Show only directories | false |
90
+ | ` --files-only ` | Show only files | false |
91
+ | ` -o, --output <file> ` | Save output to file | null |
90
92
91
93
## Output Format
92
94
@@ -109,6 +111,7 @@ git clone https://github.com/devxprite/file-tree-cli.git
109
111
110
112
2 . Install dependencies:
111
113
``` bash
114
+ cd file-tree-cli
112
115
npm install
113
116
```
114
117
@@ -117,15 +120,26 @@ npm install
117
120
npm run build
118
121
```
119
122
120
- 4 . Link for local development :
123
+ 4 . Test locally :
121
124
``` bash
125
+ # Run directly from the project directory
126
+ npm start
127
+
128
+ # Or use npm link for global testing
122
129
npm link
130
+ tree [options] [directory]
123
131
```
124
132
125
133
## Contributing
126
134
127
- Contributions are welcome! Please feel free to submit a Pull Request.
135
+ Contributions are welcome! Here's how you can contribute:
136
+
137
+ 1 . Fork the repository
138
+ 2 . Create your feature branch (` git checkout -b feature/AmazingFeature ` )
139
+ 3 . Commit your changes (` git commit -m 'Add some AmazingFeature' ` )
140
+ 4 . Push to the branch (` git push origin feature/AmazingFeature ` )
141
+ 5 . Open a Pull Request
128
142
129
143
## License
130
144
131
- MIT
145
+ This project is licensed under the MIT License - see the [ LICENSE ] ( LICENSE ) file for details.
0 commit comments