Skip to content

Commit

Permalink
Enable frozen_string_literal for future-ruby support plus minimal edi…
Browse files Browse the repository at this point in the history
…ts to fix errors
  • Loading branch information
nanobowers committed Apr 27, 2024
1 parent 936e463 commit 871a23a
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions lib/optimist.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# lib/optimist.rb -- optimist command-line processing library
# Copyright (c) 2008-2014 William Morgan.
# Copyright (c) 2014 Red Hat, Inc.
Expand Down Expand Up @@ -483,7 +485,7 @@ def each_arg(args)
end
i += 1
when /^-(\S+)$/ # one or more short arguments
short_remaining = ""
short_remaining = []
shortargs = $1.split(//)
shortargs.each_with_index do |a, j|
if j == (shortargs.length - 1)
Expand All @@ -493,7 +495,7 @@ def each_arg(args)
unless num_params_taken
short_remaining << a
if @stop_on_unknown
remains << "-#{short_remaining}"
remains << "-#{short_remaining.join}"
return remains += args[i + 1..-1]
end
else
Expand All @@ -503,16 +505,16 @@ def each_arg(args)
unless yield "-#{a}", []
short_remaining << a
if @stop_on_unknown
short_remaining += shortargs[j + 1..-1].join
remains << "-#{short_remaining}"
short_remaining << shortargs[j + 1..-1].join
remains << "-#{short_remaining.join}"
return remains += args[i + 1..-1]
end
end
end
end

unless short_remaining.empty?
remains << "-#{short_remaining}"
remains << "-#{short_remaining.join}"
end
i += 1
else
Expand Down

0 comments on commit 871a23a

Please sign in to comment.