Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions lib/pure/uri.nim
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@
## import uri
## let res = parseUri("sftp://127.0.0.1:4343")
## if isAbsolute(res):
## echo "Connect to port: " & res.port
## # --> Connect to port: 4343
## assert res.port == "4343"
## else:
## echo "Wrong format"

Expand Down Expand Up @@ -343,7 +342,7 @@ proc combine*(uris: varargs[Uri]): Uri =
## **See also:**
## * `/ proc <#/,Uri,string>`_ for building URIs
runnableExamples:
let foo = combine(parseUri("https://nim-lang.org/blog.html"), parseUri("/install.html"))
let foo = combine([parseUri("https://nim-lang.org/blog.html"), parseUri("/install.html")])
Copy link
Member

@narimiran narimiran Jan 27, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that the previous example was not showcasing the correct combine proc.

But if you want to show the behaviour of varargs, maybe something like this would be better:

let foo = combine(parseUri("https://"), parseUri("nim-lang.org/"), parseUri("install.html"))
#  or with even more args:
let foo = combine(parseUri("https://"), parseUri("nim-lang.org/"), parseUri("subdir/"), parseUri("about.html"))

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are totally right. Updated it with

let foo = combine(parseUri("https://nim-lang.org/"), parseUri("docs/"), parseUri("manual.html"))

assert foo.hostname == "nim-lang.org"
assert foo.path == "/install.html"
result = uris[0]
Expand Down