diff --git a/src/cligen/command_node.cr b/src/cligen/command_node.cr index 5cfb0a6..e250c14 100644 --- a/src/cligen/command_node.cr +++ b/src/cligen/command_node.cr @@ -217,7 +217,9 @@ module CliGen # error message if caught handle_flag_raises do if match.requires_arg? - match.process(args.reject(&.processed?).take_while{|v| find_match(v.value) == CliGen::MatchType::NoMatch}) + match.process(args.reject(&.processed?).take_while{|v| + find_match(v.value) == CliGen::MatchType::NoMatch || !!match.meta.options.try(&.includes?(v.value)) + }) else match.process end @@ -258,7 +260,9 @@ module CliGen ## If this is the last flag provided in the clump do the thing if index == chars.size - 1 if match.requires_arg? - match.process(args.reject(&.processed?).take_while{|v| find_match(v.value) == CliGen::MatchType::NoMatch}) + match.process(args.reject(&.processed?).take_while{|v| + find_match(v.value) == CliGen::MatchType::NoMatch || !! match.meta.options.try(&.includes?(v.value)) + }) else match.process end