Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable frozen_string_literal for future-ruby support #149

Merged
merged 1 commit into from
May 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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