lib/rbbt/util/simpleopt/parse.rb in rbbt-util-5.22.3 vs lib/rbbt/util/simpleopt/parse.rb in rbbt-util-5.22.4

- old
+ new

@@ -9,13 +9,19 @@ chars = long.chars.to_a current = [chars.shift] short = current * "" - if (shortcuts.include?(short) and not shortcuts[short] == long) and long.index "-" or long.index "_" - parts = long.split(/[_-]/) - acc = parts.collect{|s| s[0] } * "" - return acc unless shortcuts.include? acc + if (shortcuts.include?(short) and not shortcuts[short] == long) + if long.index "-" or long.index "_" + parts = long.split(/[_-]/) + acc = parts.collect{|s| s[0] } * "" + return acc unless shortcuts.include? acc + elsif m = long.match(/(\d+)/) + n = m[0] + acc = long[0] + n + return acc unless shortcuts.include? acc + end end while shortcuts.include?(short) and not shortcuts[short] == long while shortcuts[short].index current * "" next_letter = chars.shift