shithub: mc

Download patch

ref: 45907dfb026557ab65bcff529384dbfb212e2347
parent: dfe28e0a978ca1acb738b2718a3ef2bd1617ed9a
author: Ori Bernstein <[email protected]>
date: Sat May 2 20:21:14 EDT 2015

Clean up option parsing a bit.

--- a/libstd/optparse.myr
+++ b/libstd/optparse.myr
@@ -58,7 +58,7 @@
 		parsed.opts = slpush(parsed.opts, optnext(&ctx))
 	;;
 	if ctx.args.len < def.minargs
-		put("error: expected at least %z args, got %z\n", def.minargs, ctx.args.len)
+		put("error: expected at least %z args, got %i\n", def.minargs, ctx.args.len)
 		optusage(ctx.optargs[0], ctx.optdef)
 		exit(1)
 	;;
@@ -158,7 +158,7 @@
 }
 
 const optusage = {prog, def
-	std.put("usage: %s [-h?]", prog)
+	std.put("usage: %s [-h?] ", prog)
 	for o in def.opts
 		std.put("[-%c%s%s] ", o.opt, sep(o.arg), o.arg)
 	;;