codetree-cli 0.2.0__tar.gz → 0.2.2__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.
- {codetree_cli-0.2.0 → codetree_cli-0.2.2}/PKG-INFO +4 -4
- {codetree_cli-0.2.0 → codetree_cli-0.2.2}/README.md +3 -3
- {codetree_cli-0.2.0 → codetree_cli-0.2.2}/codetree/cli.py +8 -34
- {codetree_cli-0.2.0 → codetree_cli-0.2.2}/codetree_cli.egg-info/PKG-INFO +4 -4
- {codetree_cli-0.2.0 → codetree_cli-0.2.2}/setup.py +1 -1
- {codetree_cli-0.2.0 → codetree_cli-0.2.2}/codetree/__init__.py +0 -0
- {codetree_cli-0.2.0 → codetree_cli-0.2.2}/codetree_cli.egg-info/SOURCES.txt +0 -0
- {codetree_cli-0.2.0 → codetree_cli-0.2.2}/codetree_cli.egg-info/dependency_links.txt +0 -0
- {codetree_cli-0.2.0 → codetree_cli-0.2.2}/codetree_cli.egg-info/entry_points.txt +0 -0
- {codetree_cli-0.2.0 → codetree_cli-0.2.2}/codetree_cli.egg-info/top_level.txt +0 -0
- {codetree_cli-0.2.0 → codetree_cli-0.2.2}/pyproject.toml +0 -0
- {codetree_cli-0.2.0 → codetree_cli-0.2.2}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: codetree-cli
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.2
|
|
4
4
|
Summary: A tool for counting lines of code in a project.
|
|
5
5
|
Home-page: https://github.com/rezamardaniDev/codetree.git
|
|
6
6
|
Author: Reza Mardani
|
|
@@ -19,7 +19,7 @@ Dynamic: home-page
|
|
|
19
19
|
Dynamic: requires-python
|
|
20
20
|
Dynamic: summary
|
|
21
21
|
|
|
22
|
-
# Codetree
|
|
22
|
+
# Codetree Cli
|
|
23
23
|
|
|
24
24
|
Codetree is a Python tool that helps you count the lines of code in your project directory. It supports multiple programming languages and provides a detailed breakdown of the number of lines in your project files. Perfect for analyzing and tracking the size of your codebase in an easy-to-read format.
|
|
25
25
|
|
|
@@ -37,7 +37,7 @@ Codetree is a Python tool that helps you count the lines of code in your project
|
|
|
37
37
|
Install Codetree directly from PyPI using pip:
|
|
38
38
|
|
|
39
39
|
```bash
|
|
40
|
-
pip install codetree
|
|
40
|
+
pip install codetree-cli
|
|
41
41
|
```
|
|
42
42
|
|
|
43
43
|
### Manual Installation
|
|
@@ -55,7 +55,7 @@ pip install .
|
|
|
55
55
|
Use Codetree via the command-line interface (CLI). Run the following command in your terminal:
|
|
56
56
|
|
|
57
57
|
```bash
|
|
58
|
-
codetree
|
|
58
|
+
codetree
|
|
59
59
|
```
|
|
60
60
|
|
|
61
61
|
This scans the specified directory (or current directory by default) and outputs the number of lines of code in each file, plus a summary of total lines.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Codetree
|
|
1
|
+
# Codetree Cli
|
|
2
2
|
|
|
3
3
|
Codetree is a Python tool that helps you count the lines of code in your project directory. It supports multiple programming languages and provides a detailed breakdown of the number of lines in your project files. Perfect for analyzing and tracking the size of your codebase in an easy-to-read format.
|
|
4
4
|
|
|
@@ -16,7 +16,7 @@ Codetree is a Python tool that helps you count the lines of code in your project
|
|
|
16
16
|
Install Codetree directly from PyPI using pip:
|
|
17
17
|
|
|
18
18
|
```bash
|
|
19
|
-
pip install codetree
|
|
19
|
+
pip install codetree-cli
|
|
20
20
|
```
|
|
21
21
|
|
|
22
22
|
### Manual Installation
|
|
@@ -34,7 +34,7 @@ pip install .
|
|
|
34
34
|
Use Codetree via the command-line interface (CLI). Run the following command in your terminal:
|
|
35
35
|
|
|
36
36
|
```bash
|
|
37
|
-
codetree
|
|
37
|
+
codetree
|
|
38
38
|
```
|
|
39
39
|
|
|
40
40
|
This scans the specified directory (or current directory by default) and outputs the number of lines of code in each file, plus a summary of total lines.
|
|
@@ -21,43 +21,25 @@ def count_lines_of_code(file_path):
|
|
|
21
21
|
lines = file.readlines()
|
|
22
22
|
return len(lines)
|
|
23
23
|
except Exception as e:
|
|
24
|
-
# If there is an error reading the file, print the error and skip the file
|
|
25
24
|
print(f"Error reading {file_path}: {e}")
|
|
26
25
|
return 0
|
|
27
26
|
|
|
28
27
|
def print_directory_tree(path):
|
|
29
28
|
"""Prints the directory structure with files and their line counts."""
|
|
30
29
|
folder_files = defaultdict(list)
|
|
31
|
-
folder_count = 0
|
|
32
|
-
checked_files = 0
|
|
33
|
-
|
|
34
|
-
# Process the root directory separately to include files in the root
|
|
35
|
-
if not os.path.basename(path).startswith('.'): # Skip hidden files and folders
|
|
36
|
-
folder_name = os.path.basename(path)
|
|
37
|
-
folder_count += 1 # Increment folder count
|
|
38
|
-
for file in sorted(os.listdir(path)):
|
|
39
|
-
file_path = os.path.join(path, file)
|
|
40
|
-
if os.path.isfile(file_path) and not file.startswith('.'):
|
|
41
|
-
lines = count_lines_of_code(file_path)
|
|
42
|
-
if lines > 0:
|
|
43
|
-
folder_files[folder_name].append((file, lines))
|
|
44
|
-
checked_files += 1 # Increment checked files count
|
|
30
|
+
folder_count = 0
|
|
31
|
+
checked_files = 0
|
|
45
32
|
|
|
46
33
|
# Walk through the directory and get files with line counts
|
|
47
34
|
for root, dirs, files in os.walk(path):
|
|
48
|
-
# Skip
|
|
35
|
+
# Skip hidden directories
|
|
49
36
|
dirs[:] = [d for d in dirs if not d.startswith('.')]
|
|
50
37
|
|
|
51
|
-
# Only process the current directory if it does not start with a dot
|
|
52
38
|
rel_root = os.path.relpath(root, path)
|
|
53
|
-
if rel_root
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
folder_name = rel_root if rel_root != '.' else os.path.basename(path)
|
|
57
|
-
folder_count += 1 # Increment folder count
|
|
39
|
+
folder_name = rel_root if rel_root != '.' else 'root' # Show root separately
|
|
40
|
+
folder_count += 1
|
|
58
41
|
|
|
59
42
|
for file in sorted(files):
|
|
60
|
-
# Skip files that start with a dot
|
|
61
43
|
if file.startswith('.'):
|
|
62
44
|
continue
|
|
63
45
|
|
|
@@ -65,7 +47,7 @@ def print_directory_tree(path):
|
|
|
65
47
|
lines = count_lines_of_code(file_path)
|
|
66
48
|
if lines > 0:
|
|
67
49
|
folder_files[folder_name].append((file, lines))
|
|
68
|
-
checked_files += 1
|
|
50
|
+
checked_files += 1
|
|
69
51
|
|
|
70
52
|
# Print directory tree with line counts
|
|
71
53
|
for folder in sorted(folder_files.keys()):
|
|
@@ -79,29 +61,21 @@ def print_directory_tree(path):
|
|
|
79
61
|
def scan_directory(path):
|
|
80
62
|
"""Scan the directory and prints summary of files and line counts."""
|
|
81
63
|
print(f"\nScanning directory: {path}")
|
|
82
|
-
total_files = 0
|
|
83
64
|
total_lines = 0
|
|
84
|
-
folder_count = 0
|
|
85
|
-
checked_files = 0
|
|
86
65
|
|
|
87
66
|
folder_count, checked_files = print_directory_tree(path)
|
|
88
67
|
|
|
89
|
-
# Count total
|
|
68
|
+
# Count total lines
|
|
90
69
|
for root, dirs, files in os.walk(path):
|
|
91
|
-
# Skip any directories that start with a dot
|
|
92
70
|
dirs[:] = [d for d in dirs if not d.startswith('.')]
|
|
93
71
|
|
|
94
72
|
for file in files:
|
|
95
|
-
# Skip files that start with a dot
|
|
96
73
|
if file.startswith('.'):
|
|
97
74
|
continue
|
|
98
75
|
|
|
99
76
|
file_path = os.path.join(root, file)
|
|
100
77
|
lines = count_lines_of_code(file_path)
|
|
101
|
-
|
|
102
|
-
total_files += 1
|
|
103
|
-
total_lines += lines
|
|
104
|
-
checked_files += 1
|
|
78
|
+
total_lines += lines
|
|
105
79
|
|
|
106
80
|
print(f"\nTotal files checked: {checked_files}")
|
|
107
81
|
print(f"Total lines of code: {total_lines}")
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: codetree-cli
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.2
|
|
4
4
|
Summary: A tool for counting lines of code in a project.
|
|
5
5
|
Home-page: https://github.com/rezamardaniDev/codetree.git
|
|
6
6
|
Author: Reza Mardani
|
|
@@ -19,7 +19,7 @@ Dynamic: home-page
|
|
|
19
19
|
Dynamic: requires-python
|
|
20
20
|
Dynamic: summary
|
|
21
21
|
|
|
22
|
-
# Codetree
|
|
22
|
+
# Codetree Cli
|
|
23
23
|
|
|
24
24
|
Codetree is a Python tool that helps you count the lines of code in your project directory. It supports multiple programming languages and provides a detailed breakdown of the number of lines in your project files. Perfect for analyzing and tracking the size of your codebase in an easy-to-read format.
|
|
25
25
|
|
|
@@ -37,7 +37,7 @@ Codetree is a Python tool that helps you count the lines of code in your project
|
|
|
37
37
|
Install Codetree directly from PyPI using pip:
|
|
38
38
|
|
|
39
39
|
```bash
|
|
40
|
-
pip install codetree
|
|
40
|
+
pip install codetree-cli
|
|
41
41
|
```
|
|
42
42
|
|
|
43
43
|
### Manual Installation
|
|
@@ -55,7 +55,7 @@ pip install .
|
|
|
55
55
|
Use Codetree via the command-line interface (CLI). Run the following command in your terminal:
|
|
56
56
|
|
|
57
57
|
```bash
|
|
58
|
-
codetree
|
|
58
|
+
codetree
|
|
59
59
|
```
|
|
60
60
|
|
|
61
61
|
This scans the specified directory (or current directory by default) and outputs the number of lines of code in each file, plus a summary of total lines.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|