vedant 0.1.0__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.
- vedant-0.1.0/PKG-INFO +27 -0
- vedant-0.1.0/README.md +19 -0
- vedant-0.1.0/pyproject.toml +14 -0
- vedant-0.1.0/setup.cfg +4 -0
- vedant-0.1.0/src/vedant/__init__.py +1 -0
- vedant-0.1.0/src/vedant/cli.py +89 -0
- vedant-0.1.0/src/vedant.egg-info/PKG-INFO +27 -0
- vedant-0.1.0/src/vedant.egg-info/SOURCES.txt +9 -0
- vedant-0.1.0/src/vedant.egg-info/dependency_links.txt +1 -0
- vedant-0.1.0/src/vedant.egg-info/entry_points.txt +2 -0
- vedant-0.1.0/src/vedant.egg-info/top_level.txt +1 -0
vedant-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: vedant
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: My CLI tool
|
|
5
|
+
Author: Vedant
|
|
6
|
+
Requires-Python: >=3.8
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
|
|
9
|
+
# Vedant CLI
|
|
10
|
+
|
|
11
|
+
A fast command-line tool that prints the directory tree of the current folder.
|
|
12
|
+
|
|
13
|
+
## Install (recommended)
|
|
14
|
+
```bash
|
|
15
|
+
pipx install vedant
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Install (not recommended)
|
|
19
|
+
```bash
|
|
20
|
+
pip install vedant
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Install (for local development)
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
pip install -e .
|
|
27
|
+
```
|
vedant-0.1.0/README.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Vedant CLI
|
|
2
|
+
|
|
3
|
+
A fast command-line tool that prints the directory tree of the current folder.
|
|
4
|
+
|
|
5
|
+
## Install (recommended)
|
|
6
|
+
```bash
|
|
7
|
+
pipx install vedant
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
## Install (not recommended)
|
|
11
|
+
```bash
|
|
12
|
+
pip install vedant
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Install (for local development)
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
pip install -e .
|
|
19
|
+
```
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "vedant"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "My CLI tool"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.8"
|
|
7
|
+
authors = [{name="Vedant"}]
|
|
8
|
+
|
|
9
|
+
[build-system]
|
|
10
|
+
requires = ["setuptools"]
|
|
11
|
+
build-backend = "setuptools.build_meta"
|
|
12
|
+
|
|
13
|
+
[project.scripts]
|
|
14
|
+
vedant = "vedant.cli:main"
|
vedant-0.1.0/setup.cfg
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.1.0"
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import argparse
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
|
|
5
|
+
# folders to show but NOT traverse inside
|
|
6
|
+
BLOCKED = {".git", "node_modules", "__pycache__"}
|
|
7
|
+
|
|
8
|
+
# colors (works in modern terminals)
|
|
9
|
+
BLUE = "\033[94m"
|
|
10
|
+
GREEN = "\033[92m"
|
|
11
|
+
RESET = "\033[0m"
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def build_tree(root: Path, dirs_only=False, prefix=""):
|
|
15
|
+
lines = []
|
|
16
|
+
|
|
17
|
+
try:
|
|
18
|
+
entries = list(os.scandir(root))
|
|
19
|
+
except PermissionError:
|
|
20
|
+
return []
|
|
21
|
+
|
|
22
|
+
# sort directories first
|
|
23
|
+
entries.sort(key=lambda e: (not e.is_dir(), e.name.lower()))
|
|
24
|
+
|
|
25
|
+
if dirs_only:
|
|
26
|
+
entries = [e for e in entries if e.is_dir()]
|
|
27
|
+
|
|
28
|
+
for i, entry in enumerate(entries):
|
|
29
|
+
|
|
30
|
+
connector = "└── " if i == len(entries) - 1 else "├── "
|
|
31
|
+
|
|
32
|
+
name = entry.name
|
|
33
|
+
is_dir = entry.is_dir(follow_symlinks=False)
|
|
34
|
+
|
|
35
|
+
# colored display
|
|
36
|
+
display = f"{BLUE}{name}{RESET}" if is_dir else f"{GREEN}{name}{RESET}"
|
|
37
|
+
|
|
38
|
+
lines.append(prefix + connector + display)
|
|
39
|
+
|
|
40
|
+
# traverse unless blocked
|
|
41
|
+
if is_dir and name not in BLOCKED:
|
|
42
|
+
extension = " " if i == len(entries)-1 else "│ "
|
|
43
|
+
lines += build_tree(
|
|
44
|
+
Path(entry.path),
|
|
45
|
+
dirs_only,
|
|
46
|
+
prefix + extension,
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
return lines
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def main():
|
|
53
|
+
|
|
54
|
+
parser = argparse.ArgumentParser(
|
|
55
|
+
description="Show directory tree"
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
parser.add_argument(
|
|
59
|
+
"--dirs-only",
|
|
60
|
+
action="store_true",
|
|
61
|
+
help="show only directories",
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
parser.add_argument(
|
|
65
|
+
"--save",
|
|
66
|
+
action="store_true",
|
|
67
|
+
help="ask to save output",
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
args = parser.parse_args()
|
|
71
|
+
|
|
72
|
+
lines = ["."]
|
|
73
|
+
lines += build_tree(Path("."), dirs_only=args.dirs_only)
|
|
74
|
+
|
|
75
|
+
output = "\n".join(lines)
|
|
76
|
+
print(output)
|
|
77
|
+
|
|
78
|
+
# ask user to save only if flag provided
|
|
79
|
+
if args.save:
|
|
80
|
+
choice = input("\nSave to vedant_tree.txt ? (y/n): ").lower()
|
|
81
|
+
if choice == "y":
|
|
82
|
+
# remove color codes before saving
|
|
83
|
+
import re
|
|
84
|
+
clean = re.sub(r"\033\[[0-9;]*m", "", output)
|
|
85
|
+
|
|
86
|
+
with open("vedant_tree.txt", "w", encoding="utf-8") as f:
|
|
87
|
+
f.write(clean)
|
|
88
|
+
|
|
89
|
+
print("Saved → vedant_tree.txt")
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: vedant
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: My CLI tool
|
|
5
|
+
Author: Vedant
|
|
6
|
+
Requires-Python: >=3.8
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
|
|
9
|
+
# Vedant CLI
|
|
10
|
+
|
|
11
|
+
A fast command-line tool that prints the directory tree of the current folder.
|
|
12
|
+
|
|
13
|
+
## Install (recommended)
|
|
14
|
+
```bash
|
|
15
|
+
pipx install vedant
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Install (not recommended)
|
|
19
|
+
```bash
|
|
20
|
+
pip install vedant
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Install (for local development)
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
pip install -e .
|
|
27
|
+
```
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
vedant
|