lib/chronicle/etl/cli/subcommand_base.rb in chronicle-etl-0.5.5 vs lib/chronicle/etl/cli/subcommand_base.rb in chronicle-etl-0.6.1
- old
+ new
@@ -9,28 +9,30 @@
::Thor::Util.thor_classes_in(self).each do |klass|
list += klass.printable_commands(false)
end
list.sort! { |a, b| a[0] <=> b[0] }
- shell.say "COMMANDS".bold
+ shell.say 'COMMANDS'.bold
shell.print_table(list, indent: 2, truncate: true)
shell.say
class_options_help(shell)
end
# Show docs with command:subcommand pattern.
# For `help` command, don't use colon
- def self.banner(command, namespace = nil, subcommand = false)
+ def self.banner(command, _namespace = nil, _subcommand = false)
if command.name == 'help'
"#{subcommand_prefix} #{command.usage}"
else
"#{subcommand_prefix}:#{command.usage}"
end
end
# Use subcommand classname to derive display name for subcommand
def self.subcommand_prefix
- self.name.gsub(%r{.*::}, '').gsub(%r{^[A-Z]}) { |match| match[0].downcase }.gsub(%r{[A-Z]}) { |match| "-#{match[0].downcase}" }
+ name.gsub(/.*::/, '').gsub(/^[A-Z]/) do |match|
+ match[0].downcase
+ end.gsub(/[A-Z]/) { |match| "-#{match[0].downcase}" }
end
end
end
end
end