lib/rbbt/util/simpleopt/parse.rb in rbbt-util-5.6.4 vs lib/rbbt/util/simpleopt/parse.rb in rbbt-util-5.6.5

- old
+ new

@@ -5,13 +5,21 @@ chars = long.chars.to_a current = [chars.shift] short = current * "" + if shortcuts.include? short and long.index "-" or long.index "_" + parts = long.split(/[_-]/) + acc = parts.collect{|s| s[0] } * "" + return acc unless shortcuts.include? acc + end + while shortcuts.include? short - next_letter = chars.shift - return nil if next_letter.nil? - current << next_letter + while shortcuts[short].index current * "" + next_letter = chars.shift + return nil if next_letter.nil? + current << next_letter + end short = current * "" end short end