summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaio Chassot <dev@caiochassot.com>2016-04-14 23:32:24 +0200
committerCaio Chassot <dev@caiochassot.com>2016-04-14 23:32:24 +0200
commit39e88d8be3138e856d85f65aa58243ecf9c1d772 (patch)
tree6084b61fa44fce402abb9c9ff8a65b19fdacc70a
parentc77f3c3d0ce9fcda28f3df3a789c166c622d16ee (diff)
downloadslop-39e88d8be3138e856d85f65aa58243ecf9c1d772.tar.gz
inside tail sort, retain original sort order
-rw-r--r--lib/slop/options.rb2
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"