aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Reiter2017-05-19 21:13:08 +0200
committerMarkus Reiter2017-05-22 02:51:16 +0200
commit58db95c1d23b8269dffd654afb0b8b12b46a51ce (patch)
tree720ef642b522d573f68f2144f1b961817d882796
parent1714c73b497b44358fa9fc17d05c767996ac6b7f (diff)
downloadbrew-58db95c1d23b8269dffd654afb0b8b12b46a51ce.tar.bz2
Refactor `CLI::Cat`.
-rw-r--r--Library/Homebrew/cask/lib/hbc/cli/base.rb4
-rw-r--r--Library/Homebrew/cask/lib/hbc/cli/cat.rb6
2 files changed, 9 insertions, 1 deletions
diff --git a/Library/Homebrew/cask/lib/hbc/cli/base.rb b/Library/Homebrew/cask/lib/hbc/cli/base.rb
index 3301cad91..1ad347de3 100644
--- a/Library/Homebrew/cask/lib/hbc/cli/base.rb
+++ b/Library/Homebrew/cask/lib/hbc/cli/base.rb
@@ -20,6 +20,10 @@ module Hbc
def self.needs_init?
false
end
+
+ def initialize(*args)
+ @args = args
+ end
end
end
end
diff --git a/Library/Homebrew/cask/lib/hbc/cli/cat.rb b/Library/Homebrew/cask/lib/hbc/cli/cat.rb
index 52f6e0eab..774b96e89 100644
--- a/Library/Homebrew/cask/lib/hbc/cli/cat.rb
+++ b/Library/Homebrew/cask/lib/hbc/cli/cat.rb
@@ -2,7 +2,11 @@ module Hbc
class CLI
class Cat < Base
def self.run(*args)
- cask_tokens = cask_tokens_from(args)
+ new(*args).run
+ end
+
+ def run
+ cask_tokens = self.class.cask_tokens_from(@args)
raise CaskUnspecifiedError if cask_tokens.empty?
# only respects the first argument
cask_token = cask_tokens.first.sub(/\.rb$/i, "")