estimate: show duplicated modules import path and repository path, but dimmed #241
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
As a follow-up of #240 I am proposing this change, that allows to see how often a module is required in the dependency graph.
Show and indicate duplicate dependencies
Previously, when a dependency was seen multiple times, it was deduplicated. This helped seeing the exact number of modules that needed to be packaged, but it didn't help seeing the most used modules to package in priority.
Now, we show duplicate packages but in a dimmed color and with a count of occurences in parenthesis at the end. The colors allows to still quickly evaluate the effort by focusing the eyes on the deduplicated list, while the count helps detecting the most used module.
Only highlight unique repositories in estimate
Keep printing all needed modules recursively, but instead of only dimming the duplicated modules, we also dim the rest of the import path after the repo root, and modules whose repo root has already been printed. This allows to only highlight the repository names (the actual thing that we package in Debian) and only once, so it give a better appreciation of the work packaging work required.
Example
Here is an example, showing the result of
dh-make-golang estimate github.com/charmbracelet/vhs
, but hacked a little to make as ifgithub.com/charmbracelet/x
is not yet packaged in Debian.Before:
After:
We can see that:
/v11
is dimmed, as the repository root is in factgithub.com/caarlos0/env
(maybe it would be better not to dim it, I'm not sure)./conpty
is dimmed as well, as the module is in a subfolder of thegithub.com/charmbracelet/x
repositorygithub.com/charmbracelet/x
afterwards are completely dimmed, as they are part of a repository already printedThis allows to easily find the corresponding repositories (by copying only the highlighted parts) and to better estimate the packaging work needed.
In fact, If I'm not mistaken, the highlighted part of this picture is the exact output of the estimate command before #240, when it was still working.
I was thinking of adding an additionnal textual indication for packages with duplicated repository path, to be able to have this information even when only the test is copy-pasted. For example, an asterisk at the end, but I am not sure yet.