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

feat: abbreviated dependency tree printing #1814

Merged
merged 6 commits into from
Jan 9, 2025

Conversation

mosteo
Copy link
Member

@mosteo mosteo commented Jan 6, 2025

This declutters the output of --tree when dependencies start to repeat by replacing repeats with ..., e.g.:

$ alr show --tree libgpr2
Dependencies (tree):
   gnat=14.1.3 (gnat_native) (>=14)
   gnatcoll=25.0.0 (~25.0.0)
   ├── gnat=14.1.3 (gnat_native) (>=13)
   └── libgpr=25.0.0 (~25.0.0)
       ├── gnat=14.1.3 (gnat_native) (/=2020)
       └── xmlada=25.0.0 (~25.0.0)
           └── gnat=14.1.3 (gnat_native) (>=11)
   gnatcoll_gmp=25.0.0 (~25.0.0)
   ├── gnatcoll=25.0.0 (~25.0.0) ···
   └── libgmp=6.3.0 (*)
   gnatcoll_iconv=25.0.0 (~25.0.0)
   └── gnatcoll=25.0.0 (~25.0.0) ···

vs (previous default)

$ alr -v show --tree libgpr2
Dependencies (tree):                                                       
   gnat=14.1.3 (gnat_native) (>=14)
   gnatcoll=25.0.0 (~25.0.0)
   ├── gnat=14.1.3 (gnat_native) (>=13)
   └── libgpr=25.0.0 (~25.0.0)
       ├── gnat=14.1.3 (gnat_native) (/=2020)
       └── xmlada=25.0.0 (~25.0.0)
           └── gnat=14.1.3 (gnat_native) (>=11)
   gnatcoll_gmp=25.0.0 (~25.0.0)
   ├── gnatcoll=25.0.0 (~25.0.0)
   │   ├── gnat=14.1.3 (gnat_native) (>=13)
   │   └── libgpr=25.0.0 (~25.0.0)
   │       ├── gnat=14.1.3 (gnat_native) (/=2020)
   │       └── xmlada=25.0.0 (~25.0.0)
   │           └── gnat=14.1.3 (gnat_native) (>=11)
   └── libgmp=6.3.0 (*)
   gnatcoll_iconv=25.0.0 (~25.0.0)
   └── gnatcoll=25.0.0 (~25.0.0)
       ├── gnat=14.1.3 (gnat_native) (>=13)
       └── libgpr=25.0.0 (~25.0.0)
           ├── gnat=14.1.3 (gnat_native) (/=2020)
           └── xmlada=25.0.0 (~25.0.0)
               └── gnat=14.1.3 (gnat_native) (>=11)
PR creation checklist
  • A test is included, if required by the changes.
  • doc/user-changes.md has been updated, if applicable.

mosteo added 5 commits January 6, 2025 11:26
No point in having an extra line for one single elided dependency, which
happens often.
@mosteo mosteo marked this pull request as ready for review January 6, 2025 11:46
└── xmlada=25.0.0 (~25.0.0)
└── gnat=14.1.3 (gnat_native) (>=11)
gnatcoll_gmp=25.0.0 (~25.0.0)
├── gnatcoll=25.0.0 (~25.0.0) ···
Copy link
Member

Choose a reason for hiding this comment

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

I would suggest a small change. Make the suspension points on a new line like so:

   gnatcoll_gmp=25.0.0 (~25.0.0)
   ├── gnatcoll=25.0.0 (~25.0.0) 
       └── ...

This better shows that there are dependencies omitted in the output in my opinion.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fair point.

@mosteo
Copy link
Member Author

mosteo commented Jan 8, 2025

Now the output is:

Dependencies (tree):                                                       
   gnat=14.1.3 (gnat_native) (>=14)
   gnatcoll=25.0.0 (~25.0.0)
   ├── gnat=14.1.3 (gnat_native) (>=13)
   └── libgpr=25.0.0 (~25.0.0)
       ├── gnat=14.1.3 (gnat_native) (/=2020)
       └── xmlada=25.0.0 (~25.0.0)
           └── gnat=14.1.3 (gnat_native) (>=11)
   gnatcoll_gmp=25.0.0 (~25.0.0)
   ├── gnatcoll=25.0.0 (~25.0.0)
   │   └── ...
   └── libgmp=6.3.0 (*)
   gnatcoll_iconv=25.0.0 (~25.0.0)
   └── gnatcoll=25.0.0 (~25.0.0)
       └── ...

@mosteo mosteo requested a review from Fabien-Chouteau January 8, 2025 21:43
@mosteo mosteo merged commit 9d27d1d into alire-project:master Jan 9, 2025
25 checks passed
@mosteo mosteo deleted the feat/tree-short branch January 9, 2025 10:41
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