diff options
| author | Markus Reiter | 2017-03-08 15:49:37 +0100 | 
|---|---|---|
| committer | Markus Reiter | 2017-03-08 15:49:37 +0100 | 
| commit | b24dc2268ade6356e28d912c715c33f12727ef98 (patch) | |
| tree | 8840b9320ef9697a3b19c9fd8f446056684e76bf /Library/Homebrew/cask/lib/hbc/cli.rb | |
| parent | ef02414888ec332aa4220fe05428f24b9a4f035f (diff) | |
| download | brew-b24dc2268ade6356e28d912c715c33f12727ef98.tar.bz2 | |
Move `brew cask --version` into separate file.
Diffstat (limited to 'Library/Homebrew/cask/lib/hbc/cli.rb')
| -rw-r--r-- | Library/Homebrew/cask/lib/hbc/cli.rb | 21 | 
1 files changed, 10 insertions, 11 deletions
diff --git a/Library/Homebrew/cask/lib/hbc/cli.rb b/Library/Homebrew/cask/lib/hbc/cli.rb index 3176489cb..27bea06ef 100644 --- a/Library/Homebrew/cask/lib/hbc/cli.rb +++ b/Library/Homebrew/cask/lib/hbc/cli.rb @@ -19,6 +19,7 @@ require "hbc/cli/reinstall"  require "hbc/cli/search"  require "hbc/cli/style"  require "hbc/cli/uninstall" +require "hbc/cli/--version"  require "hbc/cli/zap"  require "hbc/cli/internal_use_base" @@ -116,7 +117,7 @@ module Hbc        elsif command.to_s.include?("/") && require?(command.to_s)          # external command as Ruby library with literal path, useful          # for development and troubleshooting -        sym = Pathname.new(command.to_s).basename(".rb").to_s.capitalize +        sym = File.basename(command.to_s, ".rb").capitalize          klass = begin                    const_get(sym)                  rescue NameError @@ -247,16 +248,14 @@ module Hbc          @attempted_verb = attempted_verb        end -      def run(*args) -        if args.include?("--version") || @attempted_verb == "--version" -          puts Hbc.full_version -        else -          purpose -          usage -          unless @attempted_verb.to_s.strip.empty? || @attempted_verb == "help" -            raise CaskError, "Unknown command: #{@attempted_verb}" -          end -        end +      def run(*_args) +        purpose +        usage + +        return if @attempted_verb.to_s.strip.empty? +        return if @attempted_verb == "help" + +        raise ArgumentError, "Unknown command: #{@attempted_verb}"        end        def purpose  | 
