mvn-tree-visualizer 1.7.0__py3-none-any.whl → 1.8.0__py3-none-any.whl
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.
- mvn_tree_visualizer/cli.py +31 -2
- mvn_tree_visualizer/utils.py +29 -0
- {mvn_tree_visualizer-1.7.0.dist-info → mvn_tree_visualizer-1.8.0.dist-info}/METADATA +19 -2
- {mvn_tree_visualizer-1.7.0.dist-info → mvn_tree_visualizer-1.8.0.dist-info}/RECORD +7 -6
- {mvn_tree_visualizer-1.7.0.dist-info → mvn_tree_visualizer-1.8.0.dist-info}/WHEEL +0 -0
- {mvn_tree_visualizer-1.7.0.dist-info → mvn_tree_visualizer-1.8.0.dist-info}/entry_points.txt +0 -0
- {mvn_tree_visualizer-1.7.0.dist-info → mvn_tree_visualizer-1.8.0.dist-info}/licenses/LICENSE +0 -0
mvn_tree_visualizer/cli.py
CHANGED
|
@@ -2,6 +2,7 @@ import argparse
|
|
|
2
2
|
import sys
|
|
3
3
|
import time
|
|
4
4
|
import traceback
|
|
5
|
+
import webbrowser
|
|
5
6
|
from importlib import metadata
|
|
6
7
|
from pathlib import Path
|
|
7
8
|
from typing import NoReturn
|
|
@@ -12,6 +13,7 @@ from .file_watcher import FileWatcher
|
|
|
12
13
|
from .get_dependencies_in_one_file import merge_files
|
|
13
14
|
from .outputs.html_output import create_html_diagram
|
|
14
15
|
from .outputs.json_output import create_json_output
|
|
16
|
+
from .utils import add_timestamp_to_filename
|
|
15
17
|
from .validation import find_dependency_files, validate_dependency_files, validate_output_directory
|
|
16
18
|
|
|
17
19
|
|
|
@@ -32,6 +34,7 @@ def generate_diagram(
|
|
|
32
34
|
show_versions: bool,
|
|
33
35
|
theme: str = "minimal",
|
|
34
36
|
quiet: bool = False,
|
|
37
|
+
open_browser: bool = False,
|
|
35
38
|
) -> None:
|
|
36
39
|
"""Generate the dependency diagram with comprehensive error handling."""
|
|
37
40
|
timestamp = time.strftime("%H:%M:%S")
|
|
@@ -118,6 +121,14 @@ def generate_diagram(
|
|
|
118
121
|
if not quiet:
|
|
119
122
|
print(f"[{timestamp}] SUCCESS: Diagram generated and saved to {output_file}")
|
|
120
123
|
|
|
124
|
+
# Open in browser if requested and format is HTML
|
|
125
|
+
if open_browser and output_format == "html" and not quiet:
|
|
126
|
+
try:
|
|
127
|
+
webbrowser.open(Path(output_file).resolve().as_uri())
|
|
128
|
+
print(f"[{timestamp}] Opening diagram in your default browser...")
|
|
129
|
+
except Exception as e:
|
|
130
|
+
print(f"[{timestamp}] WARNING: Could not open browser: {e}", file=sys.stderr)
|
|
131
|
+
|
|
121
132
|
except MvnTreeVisualizerError as e:
|
|
122
133
|
# Our custom errors already have helpful messages
|
|
123
134
|
print(f"[{timestamp}] ERROR: {e}", file=sys.stderr)
|
|
@@ -216,6 +227,18 @@ def cli() -> NoReturn:
|
|
|
216
227
|
help="Suppress all console output except errors. Perfect for CI/CD pipelines and scripted usage.",
|
|
217
228
|
)
|
|
218
229
|
|
|
230
|
+
parser.add_argument(
|
|
231
|
+
"--open",
|
|
232
|
+
action="store_true",
|
|
233
|
+
help="Automatically open the generated HTML diagram in your default browser. Only works with HTML output format.",
|
|
234
|
+
)
|
|
235
|
+
|
|
236
|
+
parser.add_argument(
|
|
237
|
+
"--timestamp-output",
|
|
238
|
+
action="store_true",
|
|
239
|
+
help="Append timestamp to output filename (e.g., diagram-2025-08-13-203045.html). Useful for version tracking and CI/CD.",
|
|
240
|
+
)
|
|
241
|
+
|
|
219
242
|
args = parser.parse_args()
|
|
220
243
|
directory: str = args.directory
|
|
221
244
|
output_file: str = args.output
|
|
@@ -226,6 +249,12 @@ def cli() -> NoReturn:
|
|
|
226
249
|
watch_mode: bool = args.watch
|
|
227
250
|
theme: str = args.theme
|
|
228
251
|
quiet: bool = args.quiet
|
|
252
|
+
open_browser: bool = args.open
|
|
253
|
+
timestamp_output: bool = args.timestamp_output
|
|
254
|
+
|
|
255
|
+
# Apply timestamp to output filename if requested
|
|
256
|
+
if timestamp_output:
|
|
257
|
+
output_file = add_timestamp_to_filename(output_file)
|
|
229
258
|
|
|
230
259
|
# Generate initial diagram
|
|
231
260
|
if not quiet:
|
|
@@ -233,7 +262,7 @@ def cli() -> NoReturn:
|
|
|
233
262
|
print(f"[{timestamp}] Generating initial diagram...")
|
|
234
263
|
|
|
235
264
|
try:
|
|
236
|
-
generate_diagram(directory, output_file, filename, keep_tree, output_format, show_versions, theme, quiet)
|
|
265
|
+
generate_diagram(directory, output_file, filename, keep_tree, output_format, show_versions, theme, quiet, open_browser)
|
|
237
266
|
except MvnTreeVisualizerError:
|
|
238
267
|
sys.exit(1)
|
|
239
268
|
except KeyboardInterrupt:
|
|
@@ -251,7 +280,7 @@ def cli() -> NoReturn:
|
|
|
251
280
|
def regenerate_callback():
|
|
252
281
|
"""Callback function for file watcher."""
|
|
253
282
|
try:
|
|
254
|
-
generate_diagram(directory, output_file, filename, keep_tree, output_format, show_versions, theme, quiet)
|
|
283
|
+
generate_diagram(directory, output_file, filename, keep_tree, output_format, show_versions, theme, quiet, open_browser)
|
|
255
284
|
except Exception:
|
|
256
285
|
# In watch mode, we don't want to exit on errors, just log them
|
|
257
286
|
print("Error during diagram regeneration:", file=sys.stderr)
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import time
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
def add_timestamp_to_filename(filename: str) -> str:
|
|
6
|
+
"""Add timestamp to filename before the extension.
|
|
7
|
+
|
|
8
|
+
Args:
|
|
9
|
+
filename: Original filename (e.g., 'diagram.html', 'output.json', 'folder/diagram.html')
|
|
10
|
+
|
|
11
|
+
Returns:
|
|
12
|
+
Timestamped filename (e.g., 'diagram-2025-08-13-203045.html')
|
|
13
|
+
"""
|
|
14
|
+
timestamp = time.strftime("%Y-%m-%d-%H%M%S")
|
|
15
|
+
path = Path(filename)
|
|
16
|
+
|
|
17
|
+
# Handle paths by preserving directory and only modifying the filename
|
|
18
|
+
if path.parent != Path("."):
|
|
19
|
+
# Has a directory component
|
|
20
|
+
directory = path.parent
|
|
21
|
+
stem = path.stem
|
|
22
|
+
suffix = path.suffix
|
|
23
|
+
timestamped_name = f"{stem}-{timestamp}{suffix}"
|
|
24
|
+
return str(directory / timestamped_name)
|
|
25
|
+
else:
|
|
26
|
+
# No directory component
|
|
27
|
+
stem = path.stem
|
|
28
|
+
suffix = path.suffix
|
|
29
|
+
return f"{stem}-{timestamp}{suffix}"
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: mvn-tree-visualizer
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.8.0
|
|
4
4
|
Summary: A simple command line tool to visualize the dependency tree of a Maven project in a graphical format.
|
|
5
5
|
Project-URL: source, https://github.com/dyka3773/mvn-tree-visualizer
|
|
6
6
|
Author-email: Iraklis Konsoulas <dyka3773@gmail.com>
|
|
7
7
|
License-Expression: MIT
|
|
8
8
|
License-File: LICENSE
|
|
9
9
|
Keywords: cli,command-line,dependency,graph,maven,mermaid,tool,tree,visualization
|
|
10
|
-
Classifier: Development Status ::
|
|
10
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
11
11
|
Classifier: Intended Audience :: Developers
|
|
12
12
|
Classifier: Programming Language :: Python :: 3
|
|
13
13
|
Classifier: Programming Language :: Python :: 3.10
|
|
@@ -124,6 +124,21 @@ mvn-tree-visualizer --filename "maven_dependency_file" --output "diagram.html" -
|
|
|
124
124
|
mvn-tree-visualizer --filename "maven_dependency_file" --output "diagram.html" -q
|
|
125
125
|
```
|
|
126
126
|
|
|
127
|
+
#### Auto-Open in Browser
|
|
128
|
+
```bash
|
|
129
|
+
# Automatically open the generated HTML diagram in your default browser
|
|
130
|
+
mvn-tree-visualizer --filename "maven_dependency_file" --output "diagram.html" --open
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
#### Timestamped Output Files
|
|
134
|
+
```bash
|
|
135
|
+
# Generate files with timestamps (e.g., diagram_20250813_143022.html)
|
|
136
|
+
mvn-tree-visualizer --filename "maven_dependency_file" --output "diagram.html" --timestamp-output
|
|
137
|
+
|
|
138
|
+
# Combine with auto-open for immediate viewing
|
|
139
|
+
mvn-tree-visualizer --filename "maven_dependency_file" --output "diagram.html" --timestamp-output --open
|
|
140
|
+
```
|
|
141
|
+
|
|
127
142
|
> **💡 Tip:** In watch mode, the tool will monitor for changes to your Maven dependency files and automatically regenerate the diagram. Perfect for development workflows! Press `Ctrl+C` to stop watching.
|
|
128
143
|
|
|
129
144
|
### Step 3: View the output
|
|
@@ -156,6 +171,8 @@ Each example includes:
|
|
|
156
171
|
| `--directory` | The directory to scan for the Maven dependency file(s) | current directory |
|
|
157
172
|
| `--keep-tree` | Keep the intermediate `dependency_tree.txt` file | `False` |
|
|
158
173
|
| `--quiet`, `-q` | Suppress all console output except errors | `False` |
|
|
174
|
+
| `--open` | Automatically open generated HTML files in default browser | `False` |
|
|
175
|
+
| `--timestamp-output` | Add timestamp to output filename (e.g., `diagram-2025-08-13-203045.html`) | `False` |
|
|
159
176
|
| `--version`, `-v` | Show the current version and exit | - |
|
|
160
177
|
| `--help` | Show the help message and exit | - |
|
|
161
178
|
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
mvn_tree_visualizer/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
2
|
mvn_tree_visualizer/__main__.py,sha256=yIQFAdWjthKAFbSzzRuz5_YGlK0c6BnR2ypjNRDq180,82
|
|
3
|
-
mvn_tree_visualizer/cli.py,sha256=
|
|
3
|
+
mvn_tree_visualizer/cli.py,sha256=1qrrcrLdJRM-GHYJsm0I9R1arOQ2XZxdZllazj-yME0,11134
|
|
4
4
|
mvn_tree_visualizer/diagram.py,sha256=UfvP_J4Im4JQLe3EWlY3TsP4tua3oYk5NiCGbZNQwoA,933
|
|
5
5
|
mvn_tree_visualizer/enhanced_template.py,sha256=AwK4gw5U8Ag-RmeD8Y11LXLRSnVzMFZhWja__c2iF4M,9813
|
|
6
6
|
mvn_tree_visualizer/exceptions.py,sha256=R4nnJ0xrOpd84GfPD9rFSDk40etDLoph7iZpj1CCR0c,543
|
|
7
7
|
mvn_tree_visualizer/file_watcher.py,sha256=JtmV1KW08_Az-XqpKhcd342WpxV1vUW-Dge9lodjjJY,2284
|
|
8
8
|
mvn_tree_visualizer/get_dependencies_in_one_file.py,sha256=nXhEhU-dI7tXa3TpoW1pv2t86t1K0yppSw8FYDtmTlQ,1973
|
|
9
9
|
mvn_tree_visualizer/themes.py,sha256=T7vdNVTHPtYYkh4HusGG1MUWk1mJcqFBjCc5IK5l6Dc,6338
|
|
10
|
+
mvn_tree_visualizer/utils.py,sha256=Ws6Yo-I4tioBndZ7BLES8QwoMOcHE0XiRP8CSOTx8tg,901
|
|
10
11
|
mvn_tree_visualizer/validation.py,sha256=UR_v6Jt7IGsgozE3aK0pB-t2-n1ivvS4YKxEa7p4VLQ,3206
|
|
11
12
|
mvn_tree_visualizer/outputs/html_output.py,sha256=Y0IY-UF0UMTa5w8mVFoLidgcW6BUBTxASO0iRo26hH4,5531
|
|
12
13
|
mvn_tree_visualizer/outputs/json_output.py,sha256=cXntw9ndE_BcrmFnuV61cEwZaRMp9Ev0SxaK1SUedlw,2037
|
|
13
|
-
mvn_tree_visualizer-1.
|
|
14
|
-
mvn_tree_visualizer-1.
|
|
15
|
-
mvn_tree_visualizer-1.
|
|
16
|
-
mvn_tree_visualizer-1.
|
|
17
|
-
mvn_tree_visualizer-1.
|
|
14
|
+
mvn_tree_visualizer-1.8.0.dist-info/METADATA,sha256=HtU1JoVK5jN4itRM6RhrdiRxMW0Gu4dyEOE-IepHr6I,9865
|
|
15
|
+
mvn_tree_visualizer-1.8.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
16
|
+
mvn_tree_visualizer-1.8.0.dist-info/entry_points.txt,sha256=Mu3QZhrlvbYuCxqmluVGi2efgKjkQY6T8Opf-vdb7hU,68
|
|
17
|
+
mvn_tree_visualizer-1.8.0.dist-info/licenses/LICENSE,sha256=4zi6unpe17RUDMBu7ebh14jdbyvyeT-UA3n8Zl7aW74,1075
|
|
18
|
+
mvn_tree_visualizer-1.8.0.dist-info/RECORD,,
|
|
File without changes
|
{mvn_tree_visualizer-1.7.0.dist-info → mvn_tree_visualizer-1.8.0.dist-info}/entry_points.txt
RENAMED
|
File without changes
|
{mvn_tree_visualizer-1.7.0.dist-info → mvn_tree_visualizer-1.8.0.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|