nim-lang / nimble

Package manager for the Nim programming language.
Other
1.24k stars 174 forks source link

Add `nimble add` command #1191

Closed xTrayambak closed 3 months ago

xTrayambak commented 3 months ago

This PR adds the nimble add command, similar to cargo add. \ It verifies that the package does actually exist in the Nimble package index, unless it is a URL. \ It also verifies that the package isn't already a dependency to the current working directory's Nimble file.

arnetheduck commented 3 months ago

Something this command should likely do is add a minimum version dependency on the current version of the package, ie if chronos 4.0 is available at the time of add, the added dependency should be chronos >= 4.0.0 (or possibly its semver equivalent, ie ~4.0)

xTrayambak commented 3 months ago

Unfortunately ~/.nimble/packages_<xyz>.json's schema does not contain the current version, so we'll have to clone the package, install it, and then fetch the version. I'll look into that later. The problem is that it'll require us to modify the package install procs to return a string which contains the place where the package was cloned (generally in /tmp) and then read the Nimble file from there.

xTrayambak commented 3 months ago

Nevermind, I found an easy way to do this.