diff options
author | Caio Chassot <dev@caiochassot.com> | 2016-04-14 23:32:24 +0200 |
---|---|---|
committer | Caio Chassot <dev@caiochassot.com> | 2016-04-14 23:32:24 +0200 |
commit | 39e88d8be3138e856d85f65aa58243ecf9c1d772 (patch) | |
tree | 6084b61fa44fce402abb9c9ff8a65b19fdacc70a /lib | |
parent | c77f3c3d0ce9fcda28f3df3a789c166c622d16ee (diff) | |
download | slop-39e88d8be3138e856d85f65aa58243ecf9c1d772.tar.gz |
inside tail sort, retain original sort order
Diffstat (limited to 'lib')
-rw-r--r-- | lib/slop/options.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/slop/options.rb b/lib/slop/options.rb index c1873d0..b739c5e 100644 --- a/lib/slop/options.rb +++ b/lib/slop/options.rb @@ -101,7 +101,7 @@ module Slop str = config[:banner] ? "#{banner}\n" : "" len = longest_flag_length - options.select(&:help?).sort_by(&:tail).each_with_index do |opt, i| + options.select(&:help?).each_with_index.sort_by{ |o,i| [o.tail, i] }.each do |opt, i| # use the index to fetch an associated separator if sep = separators[i] str << "#{sep}\n" |