Module: Hashira::CLI::Only

Defined in:
lib/hashira/cli/only.rb

Class Method Summary collapse

Class Method Details

.parse(value) ⇒ Object



6
7
8
9
# File 'lib/hashira/cli/only.rb', line 6

def parse(value)
  return [] if value.empty?
  value.split(",").map { vet(it.strip) }
end

.vet(path) ⇒ Object

Raises:



11
12
13
14
15
# File 'lib/hashira/cli/only.rb', line 11

def vet(path)
  here = path.delete_prefix("#{Dir.pwd}/").delete_prefix("./")
  raise(Hashira::Error, "--only #{path.inspect} is not a file here") unless File.file?(here)
  here
end