ref: 56df36161464f68b5139ddb11b4f6677ba241eea
parent: 14f83aa44b1ed886605125ca07e7317a516d8d32
author: Ori Bernstein <ori@eigenstate.org>
date: Thu Nov 23 15:29:20 EST 2017
Add an option to point to a different config file.
--- a/irc.myr
+++ b/irc.myr
@@ -61,11 +61,23 @@
`Status byte[:]
;;
-const main = {+var opt_rcfile = ".ircrc"
+
+const main = {argsvar irc : irc#
var c
var fd
+ var cmd
+ cmd = std.optparse(args, &[
+ .maxargs=-1,
+ .opts=[
+ [.opt='c', .arg="cfg",
+ .desc="use config file cfg",
+ .dest=`std.Some &opt_rcfile],
+ ][:]
+ ])
+
irc = mkirc()
while true
redraw(irc)
@@ -333,7 +345,7 @@
])
irc.self = mkchan(irc, "status", "status", "status")
- path = std.pathcat(home, ".ircrc")
+ path = std.pathcat(home, opt_rcfile)
match bio.open(path, bio.Rd)
| `std.Ok cfg:
for ln : bio.byline(cfg)
--
⑨