Skip to content

Commit

Permalink
Support installing packages from git@github.com:Xxx/Xxx (#1152)
Browse files Browse the repository at this point in the history
  • Loading branch information
haoyu234 authored Mar 28, 2024
1 parent b118e25 commit 6dfe82d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/nimblepkg/download.nim
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ proc getUrlData*(url: string): (string, Table[string, string]) =
return ($uri, {"subdir": subdir}.toTable())

proc isURL*(name: string): bool =
name.startsWith(peg" @'://' ")
name.startsWith(peg" @'://' ") or name.startsWith(peg"\ident+'@'@':'.+")

proc cloneSpecificRevision(downloadMethod: DownloadMethod,
url, downloadDir: string,
Expand Down
7 changes: 4 additions & 3 deletions src/nimblepkg/options.nim
Original file line number Diff line number Diff line change
Expand Up @@ -469,9 +469,10 @@ proc parseArgument*(key: string, result: var Options) =
of actionNil:
assert false
of actionInstall, actionPath, actionDevelop, actionUninstall, actionUpgrade:
# Parse pkg@verRange
if '@' in key:
let i = find(key, '@')
# Parse pkg@verRange or git@github.com:nim-lang/nimble.git
let i = rfind(key, '@')
let maybeUrl = rfind(key, {'/', ':'})
if i > maybeUrl:
let (pkgName, pkgVer) = (key[0 .. i-1], key[i+1 .. key.len-1])
if pkgVer.len == 0:
raise nimbleError("Version range expected after '@'.")
Expand Down

0 comments on commit 6dfe82d

Please sign in to comment.