diff options
author | Lee Jarvis <leejarvis@fastmail.com> | 2016-04-15 10:24:10 +0100 |
---|---|---|
committer | Lee Jarvis <leejarvis@fastmail.com> | 2016-04-15 10:24:10 +0100 |
commit | 3658216bddda52c72e5027c8d5a530b8ac5d183c (patch) | |
tree | fa60001f11ebf47031341bde144071fc577dbc2e /lib | |
parent | 34af9a160fc1d234bb4b5954845ace84dd7e3057 (diff) | |
parent | 39e88d8be3138e856d85f65aa58243ecf9c1d772 (diff) | |
download | slop-3658216bddda52c72e5027c8d5a530b8ac5d183c.tar.gz |
Merge pull request #193 from kch/order-fix
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" |