Skip to content

feat: abbreviated dependency tree printing#1814

Merged
mosteo merged 6 commits into
alire-project:masterfrom
mosteo:feat/tree-short
Jan 9, 2025
Merged

feat: abbreviated dependency tree printing#1814
mosteo merged 6 commits into
alire-project:masterfrom
mosteo:feat/tree-short

Conversation

@mosteo
Copy link
Copy Markdown
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
Comment thread doc/user-changes.md Outdated
└── 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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
@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