treex-cli 0.1.3__tar.gz → 0.1.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {treex_cli-0.1.3/treex_cli.egg-info → treex_cli-0.1.5}/PKG-INFO +7 -6
- {treex_cli-0.1.3 → treex_cli-0.1.5}/README.md +6 -5
- {treex_cli-0.1.3 → treex_cli-0.1.5}/pyproject.toml +1 -1
- {treex_cli-0.1.3 → treex_cli-0.1.5}/treex.py +39 -10
- {treex_cli-0.1.3 → treex_cli-0.1.5/treex_cli.egg-info}/PKG-INFO +7 -6
- {treex_cli-0.1.3 → treex_cli-0.1.5}/LICENSE +0 -0
- {treex_cli-0.1.3 → treex_cli-0.1.5}/setup.cfg +0 -0
- {treex_cli-0.1.3 → treex_cli-0.1.5}/treex_cli.egg-info/SOURCES.txt +0 -0
- {treex_cli-0.1.3 → treex_cli-0.1.5}/treex_cli.egg-info/dependency_links.txt +0 -0
- {treex_cli-0.1.3 → treex_cli-0.1.5}/treex_cli.egg-info/entry_points.txt +0 -0
- {treex_cli-0.1.3 → treex_cli-0.1.5}/treex_cli.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: treex-cli
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.5
|
|
4
4
|
Summary: List directory contents as a tree with file metadata
|
|
5
5
|
Author: Corey Goldberg
|
|
6
6
|
Maintainer: Corey Goldberg
|
|
@@ -39,10 +39,10 @@ Dynamic: license-file
|
|
|
39
39
|
`treex` is a command-line utility that recursively scans a directory and
|
|
40
40
|
displays its contents as a tree along with file metadata.
|
|
41
41
|
|
|
42
|
-
-
|
|
43
|
-
-
|
|
44
|
-
-
|
|
45
|
-
-
|
|
42
|
+
- Displays human-readable file sizes
|
|
43
|
+
- Shows line counts for text files
|
|
44
|
+
- Identifies binary and unreadable files by type
|
|
45
|
+
- Optionally displays modification timestamps
|
|
46
46
|
- Respects `.gitignore` rules when Git is installed
|
|
47
47
|
|
|
48
48
|
----
|
|
@@ -99,7 +99,7 @@ Install `treex` from [PyPI][pypi-home] using either `pip` or `pipx`:
|
|
|
99
99
|
|
|
100
100
|
```
|
|
101
101
|
$ treex --help
|
|
102
|
-
usage: treex [-h] [-a] [-m] [-s] [directory]
|
|
102
|
+
usage: treex [-h] [-a] [-m] [-q] [-s] [directory]
|
|
103
103
|
|
|
104
104
|
List directory contents as a tree with file metadata.
|
|
105
105
|
|
|
@@ -110,6 +110,7 @@ options:
|
|
|
110
110
|
-h, --help show this help message and exit
|
|
111
111
|
-a, --all show all files (including those ignored by Git)
|
|
112
112
|
-m, --modified show file modification times
|
|
113
|
+
-q, --quiet don't show file metadata
|
|
113
114
|
-s, --summary show summary only
|
|
114
115
|
```
|
|
115
116
|
|
|
@@ -14,10 +14,10 @@
|
|
|
14
14
|
`treex` is a command-line utility that recursively scans a directory and
|
|
15
15
|
displays its contents as a tree along with file metadata.
|
|
16
16
|
|
|
17
|
-
-
|
|
18
|
-
-
|
|
19
|
-
-
|
|
20
|
-
-
|
|
17
|
+
- Displays human-readable file sizes
|
|
18
|
+
- Shows line counts for text files
|
|
19
|
+
- Identifies binary and unreadable files by type
|
|
20
|
+
- Optionally displays modification timestamps
|
|
21
21
|
- Respects `.gitignore` rules when Git is installed
|
|
22
22
|
|
|
23
23
|
----
|
|
@@ -74,7 +74,7 @@ Install `treex` from [PyPI][pypi-home] using either `pip` or `pipx`:
|
|
|
74
74
|
|
|
75
75
|
```
|
|
76
76
|
$ treex --help
|
|
77
|
-
usage: treex [-h] [-a] [-m] [-s] [directory]
|
|
77
|
+
usage: treex [-h] [-a] [-m] [-q] [-s] [directory]
|
|
78
78
|
|
|
79
79
|
List directory contents as a tree with file metadata.
|
|
80
80
|
|
|
@@ -85,6 +85,7 @@ options:
|
|
|
85
85
|
-h, --help show this help message and exit
|
|
86
86
|
-a, --all show all files (including those ignored by Git)
|
|
87
87
|
-m, --modified show file modification times
|
|
88
|
+
-q, --quiet don't show file metadata
|
|
88
89
|
-s, --summary show summary only
|
|
89
90
|
```
|
|
90
91
|
|
|
@@ -147,6 +147,7 @@ def _collect_tree(
|
|
|
147
147
|
stats,
|
|
148
148
|
gitignore,
|
|
149
149
|
rows,
|
|
150
|
+
show_metadata,
|
|
150
151
|
show_modified,
|
|
151
152
|
):
|
|
152
153
|
"""Walk the tree once and collect the output rows."""
|
|
@@ -169,14 +170,29 @@ def _collect_tree(
|
|
|
169
170
|
stats,
|
|
170
171
|
gitignore,
|
|
171
172
|
rows,
|
|
173
|
+
show_metadata,
|
|
172
174
|
show_modified,
|
|
173
175
|
)
|
|
174
176
|
elif entry.is_file():
|
|
175
177
|
stats["files"] += 1
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
178
|
+
if show_metadata:
|
|
179
|
+
size_text, info, size, modified = _file_metadata(entry)
|
|
180
|
+
stats["total_size"] += size
|
|
181
|
+
timestamp = modified if show_modified else None
|
|
182
|
+
rows.append((tree_name, (size_text, info, timestamp)))
|
|
183
|
+
else:
|
|
184
|
+
stats["total_size"] = None
|
|
185
|
+
rows.append((tree_name, None))
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
def print_summary(stats):
|
|
189
|
+
directories = stats["directories"]
|
|
190
|
+
files = stats["files"]
|
|
191
|
+
total_size = stats["total_size"]
|
|
192
|
+
summary = f"{directories:,} directories • {files:,} files"
|
|
193
|
+
if total_size:
|
|
194
|
+
summary += f" • {_format_size(total_size)}"
|
|
195
|
+
print(summary)
|
|
180
196
|
|
|
181
197
|
|
|
182
198
|
def print_tree(
|
|
@@ -184,6 +200,7 @@ def print_tree(
|
|
|
184
200
|
prefix="",
|
|
185
201
|
stats=None,
|
|
186
202
|
gitignore=None,
|
|
203
|
+
show_metadata=True,
|
|
187
204
|
show_modified=False,
|
|
188
205
|
show_tree=True,
|
|
189
206
|
):
|
|
@@ -192,7 +209,15 @@ def print_tree(
|
|
|
192
209
|
stats = {"directories": 0, "files": 0, "total_size": 0}
|
|
193
210
|
rows = []
|
|
194
211
|
# Walk the filesystem once and collect the output
|
|
195
|
-
_collect_tree(
|
|
212
|
+
_collect_tree(
|
|
213
|
+
Path(directory),
|
|
214
|
+
prefix,
|
|
215
|
+
stats,
|
|
216
|
+
gitignore,
|
|
217
|
+
rows,
|
|
218
|
+
show_metadata,
|
|
219
|
+
show_modified,
|
|
220
|
+
)
|
|
196
221
|
if show_tree:
|
|
197
222
|
# Align file metadata with the longest tree/name
|
|
198
223
|
max_tree_name_width = max(
|
|
@@ -235,6 +260,12 @@ def parse_args(argv=None):
|
|
|
235
260
|
action="store_true",
|
|
236
261
|
help="show file modification times",
|
|
237
262
|
)
|
|
263
|
+
parser.add_argument(
|
|
264
|
+
"-q",
|
|
265
|
+
"--quiet",
|
|
266
|
+
action="store_true",
|
|
267
|
+
help="don't show file metadata",
|
|
268
|
+
)
|
|
238
269
|
parser.add_argument(
|
|
239
270
|
"-s",
|
|
240
271
|
"--summary",
|
|
@@ -253,21 +284,19 @@ def main():
|
|
|
253
284
|
# Only initialize Git support if it will be used
|
|
254
285
|
gitignore = None if args.all else GitIgnore(path)
|
|
255
286
|
show_tree = not args.summary
|
|
287
|
+
show_metadata = not args.quiet
|
|
256
288
|
if show_tree:
|
|
257
289
|
print(path)
|
|
258
290
|
stats = print_tree(
|
|
259
291
|
path,
|
|
260
292
|
gitignore=gitignore,
|
|
293
|
+
show_metadata=show_metadata,
|
|
261
294
|
show_modified=args.modified,
|
|
262
295
|
show_tree=show_tree,
|
|
263
296
|
)
|
|
264
297
|
if show_tree:
|
|
265
298
|
print()
|
|
266
|
-
|
|
267
|
-
f"{stats['directories']} directories • "
|
|
268
|
-
f"{stats['files']} files • "
|
|
269
|
-
f"{_format_size(stats['total_size'])}"
|
|
270
|
-
)
|
|
299
|
+
print_summary(stats)
|
|
271
300
|
return 0
|
|
272
301
|
|
|
273
302
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: treex-cli
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.5
|
|
4
4
|
Summary: List directory contents as a tree with file metadata
|
|
5
5
|
Author: Corey Goldberg
|
|
6
6
|
Maintainer: Corey Goldberg
|
|
@@ -39,10 +39,10 @@ Dynamic: license-file
|
|
|
39
39
|
`treex` is a command-line utility that recursively scans a directory and
|
|
40
40
|
displays its contents as a tree along with file metadata.
|
|
41
41
|
|
|
42
|
-
-
|
|
43
|
-
-
|
|
44
|
-
-
|
|
45
|
-
-
|
|
42
|
+
- Displays human-readable file sizes
|
|
43
|
+
- Shows line counts for text files
|
|
44
|
+
- Identifies binary and unreadable files by type
|
|
45
|
+
- Optionally displays modification timestamps
|
|
46
46
|
- Respects `.gitignore` rules when Git is installed
|
|
47
47
|
|
|
48
48
|
----
|
|
@@ -99,7 +99,7 @@ Install `treex` from [PyPI][pypi-home] using either `pip` or `pipx`:
|
|
|
99
99
|
|
|
100
100
|
```
|
|
101
101
|
$ treex --help
|
|
102
|
-
usage: treex [-h] [-a] [-m] [-s] [directory]
|
|
102
|
+
usage: treex [-h] [-a] [-m] [-q] [-s] [directory]
|
|
103
103
|
|
|
104
104
|
List directory contents as a tree with file metadata.
|
|
105
105
|
|
|
@@ -110,6 +110,7 @@ options:
|
|
|
110
110
|
-h, --help show this help message and exit
|
|
111
111
|
-a, --all show all files (including those ignored by Git)
|
|
112
112
|
-m, --modified show file modification times
|
|
113
|
+
-q, --quiet don't show file metadata
|
|
113
114
|
-s, --summary show summary only
|
|
114
115
|
```
|
|
115
116
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|