summaryrefslogtreecommitdiff
path: root/lib/http
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2017-05-04 00:30:59 -0700
committerOri Bernstein <ori@eigenstate.org>2017-05-04 00:30:59 -0700
commitb585eb744cebded7abbf014c3430f05b64122371 (patch)
treea76f3401deb9ca8cd4df26fa60f20d118a657423 /lib/http
parent63a2d3e2f8602665941b3b84560489a1566ca4d6 (diff)
downloadmc-b585eb744cebded7abbf014c3430f05b64122371.tar.gz
Srvdot has announcement strings now.
Diffstat (limited to 'lib/http')
-rw-r--r--lib/http/srvdot.myr18
1 files changed, 15 insertions, 3 deletions
diff --git a/lib/http/srvdot.myr b/lib/http/srvdot.myr
index d523270..636284e 100644
--- a/lib/http/srvdot.myr
+++ b/lib/http/srvdot.myr
@@ -1,10 +1,22 @@
use std
use http
-const main = {
- var srv //, router
+const main = {args
+ var srv, ann, cmd
- match http.announce("tcp!localhost!8080")
+ cmd = std.optparse(args, &[
+ .maxargs=0,
+ .opts = [[.opt='a', .arg="ann", .desc="announce on `ann`"]][:]
+ ])
+ ann = "tcp!localhost!8080"
+ for opt in cmd.opts
+ match opt
+ | ('a', a): ann = a
+ | _: std.die("unreachable")
+ ;;
+ ;;
+
+ match http.announce(ann)
| `std.Ok s: srv = s
| `std.Err e: std.fatal("unable to announce: {}\n", e)
;;