Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add deps tree functionality #4172

Merged
merged 6 commits into from
Jan 20, 2025
Merged

Add deps tree functionality #4172

merged 6 commits into from
Jan 20, 2025

Conversation

Ramkarthik
Copy link
Contributor

Related to #3267.

Modified it to gleam deps tree based on the conversation in #3408 to make it more inline with how cargo tree works.

Currently supports gleam deps tree, gleam deps tree --package PACKAGE_NAME, and gleam deps tree --invert PACKAGE_NAME

Sample output (project name: deps_list):

  1. gleam deps tree
deps_list v1.0.0
├── gleam_regexp v1.0.0
│   └── gleam_stdlib v0.52.0
├── gleam_stdlib v0.52.0
├── gleeunit v1.2.0
│   └── gleam_stdlib v0.52.0
└── pog v3.1.1
    ├── gleam_stdlib v0.52.0
    └── pgo v0.14.0
        ├── backoff v1.1.6
        ├── opentelemetry_api v1.4.0
        └── pg_types v0.4.0
  1. gleam deps tree --package pog
pog v3.1.1
├── gleam_stdlib v0.52.0
└── pgo v0.14.0
    ├── backoff v1.1.6
    ├── opentelemetry_api v1.4.0
    └── pg_types v0.4.0
  1. gleam deps tree --invert gleam_stdlib
gleam_stdlib v0.52.0
├── deps_list v1.0.0
├── gleam_regexp v1.0.0
│   └── deps_list v1.0.0
├── gleeunit v1.2.0
│   └── deps_list v1.0.0
└── pog v3.1.1
    └── deps_list v1.0.0

Please let me know if I should change anything.

Copy link
Member

@lpil lpil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow! Fantastic work! And the code looks really very good. Thank you.

I've left some very small notes inline

-p, --package <PACKAGE> Package to be used as the root of the tree
-i, --invert <PACKAGE> Invert the tree direction and focus on the given package
-h, --help Print help
```
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be nice to show the format of the output here!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added a sample output, not sure if this is what we're looking for. Please let me know.

help = "Package to be used as the root of the tree"
)]
package: Option<String>,
/// (optional) Name of the package to get the inverted dependency tree for
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the optional bit for these two comments please 🙏

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, removed this

Copy link
Member

@lpil lpil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect!!

@Ramkarthik
Copy link
Contributor Author

Thank you, @lpil. Appreciate the review and the feedback.

@lpil
Copy link
Member

lpil commented Jan 20, 2025

Oops I forgot to press the merge button

@lpil lpil enabled auto-merge (rebase) January 20, 2025 14:18
@lpil lpil merged commit d4046c8 into gleam-lang:main Jan 20, 2025
12 checks passed
@Ramkarthik Ramkarthik deleted the deps-tree branch January 25, 2025 15:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants