brew/Library/Homebrew/cask/lib/hbc/cli/abstract_command.rb

38 lines
651 B
Ruby
Raw Normal View History

2016-09-24 13:52:43 +02:00
module Hbc
class CLI
2017-05-20 19:08:03 +02:00
class AbstractCommand
2016-09-24 13:52:43 +02:00
def self.command_name
@command_name ||= name.sub(/^.*:/, "").gsub(/(.)([A-Z])/, '\1_\2').downcase
2016-09-24 13:52:43 +02:00
end
2016-08-18 22:11:42 +03:00
2017-05-20 19:08:03 +02:00
def self.abstract?
!(name.split("::").last !~ /^Abstract[^a-z]/)
end
2016-09-24 13:52:43 +02:00
def self.visible
true
end
2016-08-18 22:11:42 +03:00
2016-09-24 13:52:43 +02:00
def self.cask_tokens_from(args)
args.reject { |a| a.empty? || a.chars.first == "-" }
end
2016-08-18 22:11:42 +03:00
2016-09-24 13:52:43 +02:00
def self.help
2017-03-16 09:00:57 +01:00
nil
2016-09-24 13:52:43 +02:00
end
2016-08-18 22:11:42 +03:00
2016-09-24 13:52:43 +02:00
def self.needs_init?
false
end
2017-05-19 21:13:08 +02:00
2017-05-20 19:08:03 +02:00
def self.run(*args)
new(*args).run
end
2017-05-19 21:13:08 +02:00
def initialize(*args)
@args = args
end
2016-09-24 13:52:43 +02:00
end
2016-08-18 22:11:42 +03:00
end
end