Port Homebrew::Cmd::Caskroom
This commit is contained in:
parent
7bbf0a3206
commit
102051c35d
@ -1,12 +1,16 @@
|
||||
# typed: strict
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Homebrew
|
||||
module_function
|
||||
require "abstract_command"
|
||||
|
||||
sig { returns(CLI::Parser) }
|
||||
def __caskroom_args
|
||||
Homebrew::CLI::Parser.new do
|
||||
module Homebrew
|
||||
module Cmd
|
||||
class Caskroom < AbstractCommand
|
||||
|
||||
sig { override.returns(String) }
|
||||
def self.command_name = "--caskroom"
|
||||
|
||||
cmd_args do
|
||||
description <<~EOS
|
||||
Display Homebrew's Caskroom path.
|
||||
|
||||
@ -16,12 +20,9 @@ module Homebrew
|
||||
|
||||
named_args :cask
|
||||
end
|
||||
end
|
||||
|
||||
sig { void }
|
||||
def __caskroom
|
||||
args = __caskroom_args.parse
|
||||
|
||||
sig { override.void }
|
||||
def run
|
||||
if args.named.to_casks.blank?
|
||||
puts Cask::Caskroom.path
|
||||
else
|
||||
@ -31,3 +32,5 @@ module Homebrew
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -1,8 +1,9 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "cmd/--caskroom"
|
||||
require "cmd/shared_examples/args_parse"
|
||||
|
||||
RSpec.describe "brew --caskroom" do
|
||||
RSpec.describe Homebrew::Cmd::Caskroom do
|
||||
it_behaves_like "parseable arguments"
|
||||
|
||||
it "prints Homebrew's Caskroom", :integration_test do
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user