jeftadlvw / git-nest

Nest external repositories into your project without git being bothered.
https://github.com/jeftadlvw/git-nest
Apache License 2.0
1 stars 1 forks source link

✨ generic url representation #10

Open jeftadlvw opened 2 months ago

jeftadlvw commented 2 months ago

Currently, only http urls are supported. But many developers use shh to clone and manage their repositories. It may be better to have a generic representation of a url that can be converted into multiple supported protocols (the obvious being http/https and ssh). The problem is that they both share the same structure (hostname and path), but everything behind that is specific for that protocol.

Take port numbers for example. Http uses 80, Https 443. Ssh by default 22. All these ports can be changed by the hosting solution and the protocol specifications allow custom ports. Custom port numbers need to be stored for every supported url type.

A possible solution would be to use a basic structure like hostname$path and add every other customization as tags behind it: hostname$path[tag-1:foo | tag-2:bar | tag-3:baz].

Some practical tags could be:

Each tag has a documented default value.

The final configuration could look like this:

[config]
  # future configuration here

[[submodule]]
  path = "path-to-submodule"
  url = "hostname$path[http-secure: true | ssh-port:5000]"
  ref = "branch, tag or commit"

This also enables to clone new nested modules through the same url type as the repository's origin url.