brew/Library/Homebrew/cask/cmd/internal_help.rb

30 lines
701 B
Ruby
Raw Normal View History

# frozen_string_literal: true
2018-09-06 08:29:14 +02:00
module Cask
2018-09-04 08:45:48 +01:00
class Cmd
2017-05-20 19:08:03 +02:00
class InternalHelp < AbstractInternalCommand
2017-05-21 00:15:56 +02:00
def initialize(*)
super
return if args.empty?
2018-09-17 02:45:00 +02:00
2017-05-21 00:15:56 +02:00
raise ArgumentError, "#{self.class.command_name} does not take arguments."
end
2017-05-20 03:07:37 +02:00
def run
2018-09-04 08:45:48 +01:00
max_command_len = Cmd.commands.map(&:length).max
2016-09-24 13:52:43 +02:00
puts "Unstable Internal-use Commands:\n\n"
2018-09-04 08:45:48 +01:00
Cmd.command_classes.each do |klass|
2020-04-07 08:32:30 +02:00
next if klass.visible?
2018-09-17 02:45:00 +02:00
2020-04-07 08:32:30 +02:00
puts " #{klass.command_name.ljust(max_command_len)} #{klass.help}"
2016-09-24 13:52:43 +02:00
end
puts "\n"
end
2016-08-18 22:11:42 +03:00
2016-09-24 13:52:43 +02:00
def self.help
"print help strings for unstable internal-use commands"
2016-09-24 13:52:43 +02:00
end
end
2016-08-18 22:11:42 +03:00
end
end