shards icon indicating copy to clipboard operation
shards copied to clipboard

New command: info

Open ysbaddaden opened this issue 9 years ago • 7 comments

The info command asks the registry for informations about a package (repository url, last version, etc).

$ shards info minitest
    name: minitest
     url: https://github.com/ysbaddaden/minitest.cr.git
 version: 0.3.0
released: 2016-01-11T15:08:19.000Z

ysbaddaden avatar Jan 21 '16 09:01 ysbaddaden

Additional to the original intent, I think this tool would be useful without querying any remote registry, just presenting information about locally available shards. Both are viable use cases.

Currently, we can query the installed shards using shards list, which presents a list of shard names and their installed versions. But it would also be interesting to query more information about these (installed) shards. For example properties from shard.yml like description, license or crystal. Or all available versions. Or properties at a specific version.

The CLI interface could look like this: shards info [<name> | <ref>] [<version>] [<property>...]

The first argument can be the name of a shard, a URL or omitted. A name is resolved against the dependencies defined in local shard.yml. It can also be a remote reference like (github:crystal-lang/shards) to show information about a shard that's not assigned a name in the local context. Integration with a remote index like shardbox.org would also be possible. When omitted, the command applies to the shard in the current directory (like the current behaviour of shards version).

The second argument specifies the version and can be omitted. By default it resolves to the installed version for locally installed shards or latest for remote.

Following arguments specify which properties to show. shards info --version prints the version, shards info --name the name, --repo the repository URL, --versions lists available versions, --dependencies the dependencies etc. When omitted, a human readable summary is shown, like the sample in the original comment.

An optional --format flag could switch output to JSON or other formats.

straight-shoota avatar Feb 19 '20 12:02 straight-shoota

@ysbaddaden and @straight-shoota do you guys think it's possible to add charge licenses as well?

MatheusRich avatar Mar 08 '20 03:03 MatheusRich

@MatheusRich What do you mean with "charge license"?

straight-shoota avatar Mar 09 '20 14:03 straight-shoota

Whoops, that was a mistake, my bad. I meant "shard licenses"

MatheusRich avatar Mar 09 '20 14:03 MatheusRich

I'm sorry, but this still doesn't clarify, what you mean. Where and how do you want to add what kind of license?

straight-shoota avatar Mar 09 '20 15:03 straight-shoota

I'm asking if the command info could include the shard license, like MIT, GPL, etc. I think that would be nice and useful.

MatheusRich avatar Mar 09 '20 16:03 MatheusRich

Yes, of course. The license is already mentioned as an example in https://github.com/crystal-lang/shards/issues/86#issuecomment-588208805

straight-shoota avatar Mar 09 '20 21:03 straight-shoota