1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
//! # depth
//!
//! The `depth` crate provides a command-line tool for fetching and visualizing dependency trees
//! for Rust packages using the Crates.io API and the `petgraph` crate. With this tool, you can explore
//! the dependencies of a given Rust package and visualize the relationship between different packages
//! in a dependency graph.
//!
//! # Quick Start
//!
//! Get started with the `depth` crate by following these simple steps:
//!
//! 1. Install the `depth` tool using Cargo:
//!
//! ```bash
//! cargo install --locked depth
//! ```
//!
//! 2. Use the `depth` command to visualize dependency trees:
//!
//! ```bash
//! # Visualize dependencies at level 1
//! depth -c crate_name -l 1
//!
//! or simply:
//!
//! depth -c crate_name
//! ```
//!
//! # Key Features
//!
//! The `depth` crate offers the following key features:
//!
//! - **Fetch and Visualize Dependency Tree**: Fetch and visualize the dependency tree for a given Rust package using the Crates.io API.
//! - **Command-Line Tool**: Use the `depth` command-line tool to interactively explore and visualize dependencies.
//!
//! # GitHub Repository
//!
//! You can access the source code for this crate on [GitHub](https://github.com/wiseaidev/depth).
//!
//! # Contributing
//!
//! Contributions and feedback are welcome! If you'd like to contribute, report an issue, or suggest an enhancement,
//! please engage with the project on [GitHub](https://github.com/wiseaidev/depth).
//! Your contributions help improve this crate for the community.
use Error;
use DependencyGraph;
/// Visualizes the dependency tree for a given package.
///
/// # Arguments
///
/// * `package_name` - The name of the package to visualize.
/// * `depth` - The depth up to which dependencies should be visualized.
///
/// # Returns
///
/// A Result indicating success or an error if the visualization process fails.