Port Homebrew::Cmd::Caskroom
This commit is contained in:
		
							parent
							
								
									7bbf0a3206
								
							
						
					
					
						commit
						102051c35d
					
				@ -1,32 +1,35 @@
 | 
				
			|||||||
# typed: strict
 | 
					# typed: strict
 | 
				
			||||||
# frozen_string_literal: true
 | 
					# frozen_string_literal: true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					require "abstract_command"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
module Homebrew
 | 
					module Homebrew
 | 
				
			||||||
  module_function
 | 
					  module Cmd
 | 
				
			||||||
 | 
					    class Caskroom < AbstractCommand
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  sig { returns(CLI::Parser) }
 | 
					      sig { override.returns(String) }
 | 
				
			||||||
  def __caskroom_args
 | 
					      def self.command_name = "--caskroom"
 | 
				
			||||||
    Homebrew::CLI::Parser.new do
 | 
					 | 
				
			||||||
      description <<~EOS
 | 
					 | 
				
			||||||
        Display Homebrew's Caskroom path.
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        If <cask> is provided, display the location in the Caskroom where <cask>
 | 
					      cmd_args do
 | 
				
			||||||
        would be installed, without any sort of versioned directory as the last path.
 | 
					        description <<~EOS
 | 
				
			||||||
      EOS
 | 
					          Display Homebrew's Caskroom path.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      named_args :cask
 | 
					          If <cask> is provided, display the location in the Caskroom where <cask>
 | 
				
			||||||
    end
 | 
					          would be installed, without any sort of versioned directory as the last path.
 | 
				
			||||||
  end
 | 
					        EOS
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  sig { void }
 | 
					        named_args :cask
 | 
				
			||||||
  def __caskroom
 | 
					      end
 | 
				
			||||||
    args = __caskroom_args.parse
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if args.named.to_casks.blank?
 | 
					      sig { override.void }
 | 
				
			||||||
      puts Cask::Caskroom.path
 | 
					      def run
 | 
				
			||||||
    else
 | 
					        if args.named.to_casks.blank?
 | 
				
			||||||
      args.named.to_casks.each do |cask|
 | 
					          puts Cask::Caskroom.path
 | 
				
			||||||
        puts "#{Cask::Caskroom.path}/#{cask.token}"
 | 
					        else
 | 
				
			||||||
 | 
					          args.named.to_casks.each do |cask|
 | 
				
			||||||
 | 
					            puts "#{Cask::Caskroom.path}/#{cask.token}"
 | 
				
			||||||
 | 
					          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