aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cask/lib/hbc/cli/abstract_command.rb
diff options
context:
space:
mode:
Diffstat (limited to 'Library/Homebrew/cask/lib/hbc/cli/abstract_command.rb')
-rw-r--r--Library/Homebrew/cask/lib/hbc/cli/abstract_command.rb37
1 files changed, 37 insertions, 0 deletions
diff --git a/Library/Homebrew/cask/lib/hbc/cli/abstract_command.rb b/Library/Homebrew/cask/lib/hbc/cli/abstract_command.rb
new file mode 100644
index 000000000..0f9f05f94
--- /dev/null
+++ b/Library/Homebrew/cask/lib/hbc/cli/abstract_command.rb
@@ -0,0 +1,37 @@
+module Hbc
+ class CLI
+ class AbstractCommand
+ def self.command_name
+ @command_name ||= name.sub(/^.*:/, "").gsub(/(.)([A-Z])/, '\1_\2').downcase
+ end
+
+ def self.abstract?
+ !(name.split("::").last !~ /^Abstract[^a-z]/)
+ end
+
+ def self.visible
+ true
+ end
+
+ def self.cask_tokens_from(args)
+ args.reject { |a| a.empty? || a.chars.first == "-" }
+ end
+
+ def self.help
+ nil
+ end
+
+ def self.needs_init?
+ false
+ end
+
+ def self.run(*args)
+ new(*args).run
+ end
+
+ def initialize(*args)
+ @args = args
+ end
+ end
+ end
+end