actually I do make as few assumptions as possible and parse as few as possible. No way of being generic or complete in terms of what a URI can be. So I wouldn't generalise or encourage re-use but rather KISS.

E.g. I don't care about the port. And scheme only to verify it's either sftp or ftp. Which could be dropped and left to lftp - why shouldn't we accept e.g. http? If lftp knows about webdav, nice, if not it will produce it's own error message.

P.S.: I won't use it in my https://github.com/mro/cocoaheads-muc.de/tree/develop/nanoc anyway, because I found I don't want to see usernames in the nanoc.yaml which seems mandatory for lftp with sftp. So I deploy with a separate shell script not being part of the public git repo.