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