crystal-lang / shards

Dependency manager for the Crystal language
Other
758 stars 99 forks source link

Add debug information about tags #633

Open beta-ziliani opened 1 month ago

beta-ziliani commented 1 month ago

This PR introduces two minor changes as a palliative to #521 :

Output with `--verbose`: ``` ➜ shard-test git:(main) ✗ shards --verbose Resolving dependencies git ls-remote --get-url origin Fetching https://github.com/spider-gazelle/priority-queue.git git fetch --all --quiet git tag --list --column=never Tags: v1.0.1, v1.1.0 Version tags (vX.Y): 1.0.1, 1.1.0 Unable to satisfy the following requirements: - `priority-queue (0.2.0)` required by `shard.yml` Failed to resolve dependencies ```
straight-shoota commented 1 month ago

Having this additional information is certainly helpful. However, I'm wondering if this is the best way to make it available.

The initial error message could already contain some diagnostic information to help the user directly, instead of just guiding to run again with --verbose. IMO "run again with --verbose" is a UX anti-pattern and should be avoided if possible. It requires manual interaction which is at best annoying in an interactive shell session, but can be really hard to deal with in automated environments (such as CI). If we have the ability and knowledge to provide some helpful information directly, let's try to do that without another round trip.

We know which shard failed to install, so we could show some basic information such as available versions. Maybe filter/highlight ones that are similar to the missing version, to help against typos?

I expect the verbose tag output with --verbose could be quite polluted when you have a couple of dependencies with hundreds of tags (wether they are releases or not). And I'm not sure it would be that helpful to have this expansive information about all dependencies, when you're probably only interesting in one (the one which failed to resolve). So perhaps a better way might be listing available versions per shard? This would fit well with a shards info command (#86).