treex-cli 0.1.5__tar.gz → 0.1.6__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.5/treex_cli.egg-info → treex_cli-0.1.6}/PKG-INFO +8 -7
- {treex_cli-0.1.5 → treex_cli-0.1.6}/README.md +6 -5
- {treex_cli-0.1.5 → treex_cli-0.1.6}/pyproject.toml +2 -2
- {treex_cli-0.1.5 → treex_cli-0.1.6}/treex.py +21 -8
- {treex_cli-0.1.5 → treex_cli-0.1.6/treex_cli.egg-info}/PKG-INFO +8 -7
- {treex_cli-0.1.5 → treex_cli-0.1.6}/LICENSE +0 -0
- {treex_cli-0.1.5 → treex_cli-0.1.6}/setup.cfg +0 -0
- {treex_cli-0.1.5 → treex_cli-0.1.6}/treex_cli.egg-info/SOURCES.txt +0 -0
- {treex_cli-0.1.5 → treex_cli-0.1.6}/treex_cli.egg-info/dependency_links.txt +0 -0
- {treex_cli-0.1.5 → treex_cli-0.1.6}/treex_cli.egg-info/entry_points.txt +0 -0
- {treex_cli-0.1.5 → treex_cli-0.1.6}/treex_cli.egg-info/top_level.txt +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: treex-cli
|
|
3
|
-
Version: 0.1.
|
|
4
|
-
Summary: List directory contents as a tree with file metadata
|
|
3
|
+
Version: 0.1.6
|
|
4
|
+
Summary: List directory contents as a tree with file and directory metadata
|
|
5
5
|
Author: Corey Goldberg
|
|
6
6
|
Maintainer: Corey Goldberg
|
|
7
7
|
License-Expression: MIT
|
|
@@ -25,7 +25,7 @@ Dynamic: license-file
|
|
|
25
25
|
|
|
26
26
|
# treex
|
|
27
27
|
|
|
28
|
-
## List directory contents as a tree with file metadata
|
|
28
|
+
## List directory contents as a tree with file and directory metadata
|
|
29
29
|
|
|
30
30
|
- Copyright (c) 2026 [Corey Goldberg][github-profile]
|
|
31
31
|
- Development: [GitHub][github-repo]
|
|
@@ -37,12 +37,13 @@ Dynamic: license-file
|
|
|
37
37
|
## About
|
|
38
38
|
|
|
39
39
|
`treex` is a command-line utility that recursively scans a directory and
|
|
40
|
-
|
|
40
|
+
lists its contents as a tree along with file and directory metadata.
|
|
41
41
|
|
|
42
|
-
-
|
|
42
|
+
- Shows human-readable file sizes
|
|
43
|
+
- Shows recursive directory sizes
|
|
43
44
|
- Shows line counts for text files
|
|
44
45
|
- Identifies binary and unreadable files by type
|
|
45
|
-
- Optionally
|
|
46
|
+
- Optionally shows modification timestamps
|
|
46
47
|
- Respects `.gitignore` rules when Git is installed
|
|
47
48
|
|
|
48
49
|
----
|
|
@@ -101,7 +102,7 @@ Install `treex` from [PyPI][pypi-home] using either `pip` or `pipx`:
|
|
|
101
102
|
$ treex --help
|
|
102
103
|
usage: treex [-h] [-a] [-m] [-q] [-s] [directory]
|
|
103
104
|
|
|
104
|
-
List directory contents as a tree with file metadata.
|
|
105
|
+
List directory contents as a tree with file and directory metadata.
|
|
105
106
|
|
|
106
107
|
positional arguments:
|
|
107
108
|
directory directory to scan (default: current directory)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# treex
|
|
2
2
|
|
|
3
|
-
## List directory contents as a tree with file metadata
|
|
3
|
+
## List directory contents as a tree with file and directory metadata
|
|
4
4
|
|
|
5
5
|
- Copyright (c) 2026 [Corey Goldberg][github-profile]
|
|
6
6
|
- Development: [GitHub][github-repo]
|
|
@@ -12,12 +12,13 @@
|
|
|
12
12
|
## About
|
|
13
13
|
|
|
14
14
|
`treex` is a command-line utility that recursively scans a directory and
|
|
15
|
-
|
|
15
|
+
lists its contents as a tree along with file and directory metadata.
|
|
16
16
|
|
|
17
|
-
-
|
|
17
|
+
- Shows human-readable file sizes
|
|
18
|
+
- Shows recursive directory sizes
|
|
18
19
|
- Shows line counts for text files
|
|
19
20
|
- Identifies binary and unreadable files by type
|
|
20
|
-
- Optionally
|
|
21
|
+
- Optionally shows modification timestamps
|
|
21
22
|
- Respects `.gitignore` rules when Git is installed
|
|
22
23
|
|
|
23
24
|
----
|
|
@@ -76,7 +77,7 @@ Install `treex` from [PyPI][pypi-home] using either `pip` or `pipx`:
|
|
|
76
77
|
$ treex --help
|
|
77
78
|
usage: treex [-h] [-a] [-m] [-q] [-s] [directory]
|
|
78
79
|
|
|
79
|
-
List directory contents as a tree with file metadata.
|
|
80
|
+
List directory contents as a tree with file and directory metadata.
|
|
80
81
|
|
|
81
82
|
positional arguments:
|
|
82
83
|
directory directory to scan (default: current directory)
|
|
@@ -4,8 +4,8 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "treex-cli"
|
|
7
|
-
version = "0.1.
|
|
8
|
-
description="List directory contents as a tree with file metadata"
|
|
7
|
+
version = "0.1.6"
|
|
8
|
+
description="List directory contents as a tree with file and directory metadata"
|
|
9
9
|
license = "MIT"
|
|
10
10
|
license-files = ["LICENSE"]
|
|
11
11
|
authors = [{name = "Corey Goldberg"}]
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# SPDX-License-Identifier: MIT
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
"""List directory contents as a tree with file metadata.
|
|
5
|
+
"""List directory contents as a tree with file and directory metadata.
|
|
6
6
|
|
|
7
7
|
The directory tree is rendered using Unicode box-drawing characters.
|
|
8
8
|
|
|
@@ -60,15 +60,17 @@ class GitIgnore:
|
|
|
60
60
|
return result.returncode == 0
|
|
61
61
|
|
|
62
62
|
|
|
63
|
-
def _format_size(size):
|
|
63
|
+
def _format_size(size):
|
|
64
64
|
"""Format bytes as a human-readable size."""
|
|
65
65
|
units = ["B", "KB", "MB", "GB", "TB"]
|
|
66
66
|
for unit in units:
|
|
67
|
-
if size < 1024
|
|
67
|
+
if size < 1024:
|
|
68
68
|
if unit == "B":
|
|
69
69
|
return f"{size} B"
|
|
70
70
|
return f"{size:.1f} {unit}"
|
|
71
71
|
size /= 1024
|
|
72
|
+
# Anything above 1 TB is shown in TB
|
|
73
|
+
return f"{size:.1f} TB"
|
|
72
74
|
|
|
73
75
|
|
|
74
76
|
def _format_modified(timestamp):
|
|
@@ -154,17 +156,19 @@ def _collect_tree(
|
|
|
154
156
|
entries = _get_tree_entries(path, gitignore)
|
|
155
157
|
if entries is None:
|
|
156
158
|
rows.append((prefix + "└── [permission denied]", None))
|
|
157
|
-
return
|
|
159
|
+
return 0
|
|
160
|
+
total_size = 0
|
|
158
161
|
for index, entry in enumerate(entries):
|
|
159
162
|
is_last = index == len(entries) - 1
|
|
160
163
|
connector = "└── " if is_last else "├── "
|
|
161
164
|
tree_name = prefix + connector + entry.name
|
|
162
165
|
if entry.is_dir():
|
|
163
166
|
stats["directories"] += 1
|
|
167
|
+
row_index = len(rows)
|
|
164
168
|
rows.append((tree_name, None))
|
|
165
169
|
# Indent nested entries, preserving the tree's vertical branch
|
|
166
170
|
extension = " " if is_last else "│ "
|
|
167
|
-
_collect_tree(
|
|
171
|
+
dir_size = _collect_tree(
|
|
168
172
|
entry,
|
|
169
173
|
prefix + extension,
|
|
170
174
|
stats,
|
|
@@ -173,16 +177,22 @@ def _collect_tree(
|
|
|
173
177
|
show_metadata,
|
|
174
178
|
show_modified,
|
|
175
179
|
)
|
|
180
|
+
total_size += dir_size
|
|
181
|
+
if show_metadata:
|
|
182
|
+
rows[row_index] = (tree_name, (_format_size(dir_size), None, None))
|
|
176
183
|
elif entry.is_file():
|
|
177
|
-
stats["files"] += 1
|
|
178
184
|
if show_metadata:
|
|
179
185
|
size_text, info, size, modified = _file_metadata(entry)
|
|
186
|
+
stats["files"] += 1
|
|
180
187
|
stats["total_size"] += size
|
|
188
|
+
total_size += size
|
|
181
189
|
timestamp = modified if show_modified else None
|
|
182
190
|
rows.append((tree_name, (size_text, info, timestamp)))
|
|
183
191
|
else:
|
|
192
|
+
stats["files"] += 1
|
|
184
193
|
stats["total_size"] = None
|
|
185
194
|
rows.append((tree_name, None))
|
|
195
|
+
return total_size
|
|
186
196
|
|
|
187
197
|
|
|
188
198
|
def print_summary(stats):
|
|
@@ -229,7 +239,9 @@ def print_tree(
|
|
|
229
239
|
print(tree_name)
|
|
230
240
|
continue
|
|
231
241
|
size_text, info, modified = file_info_data
|
|
232
|
-
output = f"{tree_name:<{max_tree_name_width}}{size_text:>10}
|
|
242
|
+
output = f"{tree_name:<{max_tree_name_width}}{size_text:>10}"
|
|
243
|
+
if info is not None:
|
|
244
|
+
output += f" {info:<10}"
|
|
233
245
|
if modified is not None:
|
|
234
246
|
output += f" {modified}"
|
|
235
247
|
print(output)
|
|
@@ -239,7 +251,8 @@ def print_tree(
|
|
|
239
251
|
def parse_args(argv=None):
|
|
240
252
|
"""Parse command-line arguments."""
|
|
241
253
|
parser = argparse.ArgumentParser(
|
|
242
|
-
description="List directory contents as a tree with
|
|
254
|
+
description="List directory contents as a tree with "
|
|
255
|
+
"file and directory metadata.",
|
|
243
256
|
)
|
|
244
257
|
parser.add_argument(
|
|
245
258
|
"directory",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: treex-cli
|
|
3
|
-
Version: 0.1.
|
|
4
|
-
Summary: List directory contents as a tree with file metadata
|
|
3
|
+
Version: 0.1.6
|
|
4
|
+
Summary: List directory contents as a tree with file and directory metadata
|
|
5
5
|
Author: Corey Goldberg
|
|
6
6
|
Maintainer: Corey Goldberg
|
|
7
7
|
License-Expression: MIT
|
|
@@ -25,7 +25,7 @@ Dynamic: license-file
|
|
|
25
25
|
|
|
26
26
|
# treex
|
|
27
27
|
|
|
28
|
-
## List directory contents as a tree with file metadata
|
|
28
|
+
## List directory contents as a tree with file and directory metadata
|
|
29
29
|
|
|
30
30
|
- Copyright (c) 2026 [Corey Goldberg][github-profile]
|
|
31
31
|
- Development: [GitHub][github-repo]
|
|
@@ -37,12 +37,13 @@ Dynamic: license-file
|
|
|
37
37
|
## About
|
|
38
38
|
|
|
39
39
|
`treex` is a command-line utility that recursively scans a directory and
|
|
40
|
-
|
|
40
|
+
lists its contents as a tree along with file and directory metadata.
|
|
41
41
|
|
|
42
|
-
-
|
|
42
|
+
- Shows human-readable file sizes
|
|
43
|
+
- Shows recursive directory sizes
|
|
43
44
|
- Shows line counts for text files
|
|
44
45
|
- Identifies binary and unreadable files by type
|
|
45
|
-
- Optionally
|
|
46
|
+
- Optionally shows modification timestamps
|
|
46
47
|
- Respects `.gitignore` rules when Git is installed
|
|
47
48
|
|
|
48
49
|
----
|
|
@@ -101,7 +102,7 @@ Install `treex` from [PyPI][pypi-home] using either `pip` or `pipx`:
|
|
|
101
102
|
$ treex --help
|
|
102
103
|
usage: treex [-h] [-a] [-m] [-q] [-s] [directory]
|
|
103
104
|
|
|
104
|
-
List directory contents as a tree with file metadata.
|
|
105
|
+
List directory contents as a tree with file and directory metadata.
|
|
105
106
|
|
|
106
107
|
positional arguments:
|
|
107
108
|
directory directory to scan (default: current directory)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|