summaryrefslogtreecommitdiff
path: root/lib/bundler/vendor/thor/lib/thor/parser
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2023-05-13 09:53:03 +0900
committergit <svn-admin@ruby-lang.org>2023-05-13 02:21:33 +0000
commit5f411b9b3e45a40df788f85156d4337206686deb (patch)
tree05b9fc847678974ecc7fed20e6230177fdc38d17 /lib/bundler/vendor/thor/lib/thor/parser
parent30326844c7e0957bf85ac1befd3755cff2848e9f (diff)
[rubygems/rubygems] Bump up thor-1.2.2
https://github.com/rubygems/rubygems/commit/d9a003b4e7
Diffstat (limited to 'lib/bundler/vendor/thor/lib/thor/parser')
-rw-r--r--lib/bundler/vendor/thor/lib/thor/parser/arguments.rb2
-rw-r--r--lib/bundler/vendor/thor/lib/thor/parser/option.rb10
-rw-r--r--lib/bundler/vendor/thor/lib/thor/parser/options.rb8
3 files changed, 12 insertions, 8 deletions
diff --git a/lib/bundler/vendor/thor/lib/thor/parser/arguments.rb b/lib/bundler/vendor/thor/lib/thor/parser/arguments.rb
index 3a5d82cf29..af395a0346 100644
--- a/lib/bundler/vendor/thor/lib/thor/parser/arguments.rb
+++ b/lib/bundler/vendor/thor/lib/thor/parser/arguments.rb
@@ -1,5 +1,5 @@
class Bundler::Thor
- class Arguments #:nodoc: # rubocop:disable ClassLength
+ class Arguments #:nodoc:
NUMERIC = /[-+]?(\d*\.\d+|\d+)/
# Receives an array of args and returns two arrays, one with arguments
diff --git a/lib/bundler/vendor/thor/lib/thor/parser/option.rb b/lib/bundler/vendor/thor/lib/thor/parser/option.rb
index 5a5af6f888..393955f107 100644
--- a/lib/bundler/vendor/thor/lib/thor/parser/option.rb
+++ b/lib/bundler/vendor/thor/lib/thor/parser/option.rb
@@ -58,7 +58,7 @@ class Bundler::Thor
default = nil
if VALID_TYPES.include?(value)
value
- elsif required = (value == :required) # rubocop:disable AssignmentInCondition
+ elsif required = (value == :required) # rubocop:disable Lint/AssignmentInCondition
:string
end
when TrueClass, FalseClass
@@ -93,10 +93,14 @@ class Bundler::Thor
sample << ", [#{dasherize('no-' + human_name)}]" unless (name == "force") || name.start_with?("no-")
end
+ aliases_for_usage.ljust(padding) + sample
+ end
+
+ def aliases_for_usage
if aliases.empty?
- (" " * padding) << sample
+ ""
else
- "#{aliases.join(', ')}, #{sample}"
+ "#{aliases.join(', ')}, "
end
end
diff --git a/lib/bundler/vendor/thor/lib/thor/parser/options.rb b/lib/bundler/vendor/thor/lib/thor/parser/options.rb
index 5bd97aba6f..499ce15339 100644
--- a/lib/bundler/vendor/thor/lib/thor/parser/options.rb
+++ b/lib/bundler/vendor/thor/lib/thor/parser/options.rb
@@ -1,5 +1,5 @@
class Bundler::Thor
- class Options < Arguments #:nodoc: # rubocop:disable ClassLength
+ class Options < Arguments #:nodoc:
LONG_RE = /^(--\w+(?:-\w+)*)$/
SHORT_RE = /^(-[a-z])$/i
EQ_RE = /^(--\w+(?:-\w+)*|-[a-z])=(.*)$/i
@@ -85,7 +85,7 @@ class Bundler::Thor
super(arg)
end
- def parse(args) # rubocop:disable MethodLength
+ def parse(args) # rubocop:disable Metrics/MethodLength
@pile = args.dup
@is_treated_as_value = false
@parsing_options = true
@@ -101,7 +101,7 @@ class Bundler::Thor
unshift($1.split("").map { |f| "-#{f}" })
next
when EQ_RE
- unshift($2, is_value: true)
+ unshift($2, :is_value => true)
switch = $1
when SHORT_NUM
unshift($2)
@@ -194,7 +194,7 @@ class Bundler::Thor
end
def switch_option(arg)
- if match = no_or_skip?(arg) # rubocop:disable AssignmentInCondition
+ if match = no_or_skip?(arg) # rubocop:disable Lint/AssignmentInCondition
@switches[arg] || @switches["--#{match}"]
else
@switches[arg]