summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLee Jarvis <ljjarvis@gmail.com>2015-06-20 17:38:19 +0100
committerLee Jarvis <ljjarvis@gmail.com>2015-06-20 17:43:33 +0100
commitb197bf93641525f84ef11417002d283f3f1702f7 (patch)
tree73cc4d4728d1ee083a1de02ceaa2e9a86d5f6d2c
parent6b511f36f92ace360d9d365d2a23906849a128f5 (diff)
downloadslop-b197bf93641525f84ef11417002d283f3f1702f7.tar.gz
Simplify checking for grouped short flags
-rw-r--r--lib/slop/parser.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/slop/parser.rb b/lib/slop/parser.rb
index 1bfa134..1e810d8 100644
--- a/lib/slop/parser.rb
+++ b/lib/slop/parser.rb
@@ -94,7 +94,7 @@ module Slop
process(option, arg)
elsif flag.start_with?("--no-") && option = matching_option(flag.sub("no-", ""))
process(option, false)
- elsif flag =~ /\A-[^-]/ && flag.size > 2
+ elsif flag =~ /\A-[^-]{2,}/
# try and process as a set of grouped short flags. drop(1) removes
# the prefixed -, then we add them back to each flag separately.
flags = flag.split("").drop(1).map { |f| "-#{f}" }