diff options
| author | Markus Reiter | 2017-05-19 21:13:08 +0200 |
|---|---|---|
| committer | Markus Reiter | 2017-05-22 02:51:16 +0200 |
| commit | 58db95c1d23b8269dffd654afb0b8b12b46a51ce (patch) | |
| tree | 720ef642b522d573f68f2144f1b961817d882796 | |
| parent | 1714c73b497b44358fa9fc17d05c767996ac6b7f (diff) | |
| download | brew-58db95c1d23b8269dffd654afb0b8b12b46a51ce.tar.bz2 | |
Refactor `CLI::Cat`.
| -rw-r--r-- | Library/Homebrew/cask/lib/hbc/cli/base.rb | 4 | ||||
| -rw-r--r-- | Library/Homebrew/cask/lib/hbc/cli/cat.rb | 6 |
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, "") |
