shithub: mc

Download patch

ref: fca3ac4c15e4691e230c2f90f8af71313cddc0a5
parent: 26da0e6f98ac76f3930ed68649b5fbfe87c06ec4
author: Lucas Gabriel Vuotto <lvuotto92@gmail.com>
date: Tue Jun 13 16:43:37 EDT 2017

Fix std.optparse maxargs check

Signed-off-by: Lucas Gabriel Vuotto <lvuotto92@gmail.com>

--- a/lib/std/optparse.myr
+++ b/lib/std/optparse.myr
@@ -72,8 +72,8 @@
 		optusage(ctx.optargs[0], ctx.optdef)
 		exit(1)
 	;;
-	if def.maxargs > 0 && ctx.args.len < def.minargs
-		put("error: expected at most {} args, got {}\n", def.minargs, ctx.args.len)
+	if def.maxargs > 0 && ctx.args.len > def.maxargs
+		put("error: expected at most {} args, got {}\n", def.maxargs, ctx.args.len)
 		optusage(ctx.optargs[0], ctx.optdef)
 		exit(1)
 	;;