From fd510469ac94ce5d42d088e1d07b7198b8258824 Mon Sep 17 00:00:00 2001 From: Tristan Ancelet Date: Fri, 14 Aug 2026 14:14:53 -0500 Subject: [PATCH] Added allow_no_verification for users to bypass the 'must have options or validation' check. However, not doing so can cause unexpected failures where flags will begin consuming preceeding arguments --- src/cligen/command/argument.cr | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cligen/command/argument.cr b/src/cligen/command/argument.cr index 8203c92..c374712 100644 --- a/src/cligen/command/argument.cr +++ b/src/cligen/command/argument.cr @@ -1,6 +1,6 @@ module CliGen class Command - macro argument(variable, description, long = nil, short = nil, validation = nil, on_match = nil, def_setter = false, def_getter = false, options = nil, delimiter = ",", format = nil) + macro argument(variable, description, long = nil, short = nil, validation = nil, on_match = nil, def_setter = false, def_getter = false, options = nil, delimiter = ",", format = nil, allow_no_verification = false) {% raise "ERROR : CliGen::Command.argument : def_setter must be a Bool" unless def_setter.is_a? BoolLiteral %} {% raise "ERROR : CliGen::Command.argument : First argument (#{variable}) must be a TypeDeclaration (ex: ' : [= val]')" unless variable.is_a? TypeDeclaration %} {% name = variable.var %} @@ -45,7 +45,7 @@ module CliGen {% format = format.resolve if format.is_a? Path %} {% raise "ERROR : CliGen::Command.argument(#{name}) : Provided format must be a RegexLiteral" unless format.is_a? RegexLiteral %} {% end %} - {% if type.resolve <= Array %} + {% if type.resolve <= Array && ! allow_no_verification %} {% elem = type.type_vars.first %} {% unless elem == Int32 %} {% if format.nil? && options.nil? %}