shards icon indicating copy to clipboard operation
shards copied to clipboard

Argument to version command - path or dependency name?

Open straight-shoota opened this issue 6 years ago • 6 comments

#148 introduced shards version command which prints the version specified in shard.yml. The command accepts an optional parameter path which can be used to specifiy to look for shard.yml in a different path.

@luislavena Was there a specific reason for this feature?

To me, it feels a little bit strange. I mean, it being able to specify a different directory is nice, but wouldn't that make sense for all commands? Similar to make -C path. I think it is better to use a named option. It is not intuitive that the first argument to version is interpreted as a path to look for a shard.yml.

I'd rather suggest shards version to have an argument to specify a dependency name and it would print the installed version of that dependency. For example, inside shards directory, shards version minitest would print 0.3.5.

straight-shoota avatar Sep 06 '18 11:09 straight-shoota

Hello @straight-shoota, the reasoning for the second argument is explained in the pull request, which is a response to the RFC #147.

See https://github.com/crystal-lang/shards/issues/147#issuecomment-276090449 for the specific use case.

luislavena avatar Sep 06 '18 11:09 luislavena

Ah, somehow I missed that. Thanks for pointing it out.

The example in the linked comment should also work with shards version -C __DIR__, for example. Or maybe just shards version wonderful which would resolve the location of the shard (wonderful in this example). In this use case, specifying the shard name has a little bit overhead because it resolves the location again which is already available in __DIR__. But considering that it needs to traverse the parent directory, this doesn't really matter.

straight-shoota avatar Sep 06 '18 12:09 straight-shoota

I suppose we could have shards version [-c <path>] [<dependency>]. It's a breaking change, but the command would feel a little more complete.

ysbaddaden avatar Sep 06 '18 13:09 ysbaddaden

For backwards compatibility, it could even treat <dependecy> as a path if no dependency with that name is specified (and the path exists, obviously).

straight-shoota avatar Sep 06 '18 13:09 straight-shoota

Since there has been no PR for this issue so far, I will remove it from the milestone v0.10.0

bcardiff avatar Mar 27 '20 20:03 bcardiff

I would suggest to close this issue in favour of a more general approach to querying information (including the version) of installed shards (see https://github.com/crystal-lang/shards/issues/86#issuecomment-588208805).

straight-shoota avatar Apr 03 '20 22:04 straight-shoota