ref: b585eb744cebded7abbf014c3430f05b64122371
parent: 63a2d3e2f8602665941b3b84560489a1566ca4d6
author: Ori Bernstein <ori@eigenstate.org>
date: Wed May 3 20:30:59 EDT 2017
Srvdot has announcement strings now.
--- 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)
;;