Add git deps with gleam add
#5619
seafoamteal
started this conversation in
Ideas & suggestions
Replies: 2 comments 9 replies
-
|
We also couldn't use |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
What do other package managers do? It would be useful to see the equivalent APIs in all others that we are aware of. |
Beta Was this translation helpful? Give feedback.
9 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Right now, to add a dependency from Git, you have to edit your
gleam.tomlfile. This will invariably involve having to look up the syntax either online or withgleam deps help😅 . Also, it's just less ergonomic than a simple command in the terminal. I think it would be better if you could usegleam addas usual. Some brief discussion on Discord seems to suggest that other people think so too.What would this look like?
The most familiar UX would be that
gleam addaccepts any URL you would normally pass togit clone, with an--ref/-rflag. This corresponds pretty directly to the currentgleam.tomlsyntax and the dependency resolution code in the Gleam build tool.We unfortunately wouldn't be able to use
@to separate the URL and the ref like we do for Hex packages, because@is a valid character in Git branches and tags. I considered using a:instead, like how Docker doesimage:tagbut having different separators for Hex and Git packages will probably cause confusion.We could potentially make the
--refflag optional and take it to mean that the user wants the tip of the default branch if left unspecified.Making this a discussion because it feels like it calls for more design work than a regular issue, but if/when this is approved, I'd be more than happy to work on it!
Beta Was this translation helpful? Give feedback.
All reactions