treex-cli 0.1.6__tar.gz → 0.1.7__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.6/treex_cli.egg-info → treex_cli-0.1.7}/PKG-INFO +1 -1
- {treex_cli-0.1.6 → treex_cli-0.1.7}/pyproject.toml +1 -1
- {treex_cli-0.1.6 → treex_cli-0.1.7}/treex.py +32 -24
- {treex_cli-0.1.6 → treex_cli-0.1.7/treex_cli.egg-info}/PKG-INFO +1 -1
- {treex_cli-0.1.6 → treex_cli-0.1.7}/LICENSE +0 -0
- {treex_cli-0.1.6 → treex_cli-0.1.7}/README.md +0 -0
- {treex_cli-0.1.6 → treex_cli-0.1.7}/setup.cfg +0 -0
- {treex_cli-0.1.6 → treex_cli-0.1.7}/treex_cli.egg-info/SOURCES.txt +0 -0
- {treex_cli-0.1.6 → treex_cli-0.1.7}/treex_cli.egg-info/dependency_links.txt +0 -0
- {treex_cli-0.1.6 → treex_cli-0.1.7}/treex_cli.egg-info/entry_points.txt +0 -0
- {treex_cli-0.1.6 → treex_cli-0.1.7}/treex_cli.egg-info/top_level.txt +0 -0
|
@@ -14,6 +14,7 @@ filesystem is scanned normally without Git filtering.
|
|
|
14
14
|
|
|
15
15
|
import argparse
|
|
16
16
|
import subprocess
|
|
17
|
+
import sys
|
|
17
18
|
from contextlib import suppress
|
|
18
19
|
from datetime import datetime
|
|
19
20
|
from pathlib import Path
|
|
@@ -199,8 +200,10 @@ def print_summary(stats):
|
|
|
199
200
|
directories = stats["directories"]
|
|
200
201
|
files = stats["files"]
|
|
201
202
|
total_size = stats["total_size"]
|
|
202
|
-
|
|
203
|
-
if
|
|
203
|
+
directory_label = "directory" if directories == 1 else "directories"
|
|
204
|
+
file_label = "file" if files == 1 else "files"
|
|
205
|
+
summary = f"{directories:,} {directory_label} • {files:,} {file_label}"
|
|
206
|
+
if total_size is not None:
|
|
204
207
|
summary += f" • {_format_size(total_size)}"
|
|
205
208
|
print(summary)
|
|
206
209
|
|
|
@@ -289,28 +292,33 @@ def parse_args(argv=None):
|
|
|
289
292
|
|
|
290
293
|
|
|
291
294
|
def main():
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
295
|
+
try:
|
|
296
|
+
args = parse_args()
|
|
297
|
+
path = args.directory
|
|
298
|
+
if not path.is_dir():
|
|
299
|
+
print(f"Not a directory: {path}", file=sys.stderr)
|
|
300
|
+
return 1
|
|
301
|
+
# Only initialize Git support if it will be used
|
|
302
|
+
gitignore = None if args.all else GitIgnore(path)
|
|
303
|
+
show_tree = not args.summary
|
|
304
|
+
show_metadata = not args.quiet
|
|
305
|
+
if show_tree:
|
|
306
|
+
print(path)
|
|
307
|
+
stats = print_tree(
|
|
308
|
+
path,
|
|
309
|
+
gitignore=gitignore,
|
|
310
|
+
show_metadata=show_metadata,
|
|
311
|
+
show_modified=args.modified,
|
|
312
|
+
show_tree=show_tree,
|
|
313
|
+
)
|
|
314
|
+
if show_tree:
|
|
315
|
+
print()
|
|
316
|
+
print_summary(stats)
|
|
317
|
+
except KeyboardInterrupt:
|
|
318
|
+
print("\nInterrupted", file=sys.stderr)
|
|
319
|
+
return 130
|
|
320
|
+
else:
|
|
321
|
+
return 0
|
|
314
322
|
|
|
315
323
|
|
|
316
324
|
if __name__ == "__main__":
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|