Sha256: dbd7bcdfcfb27ab8693433f982236604fbef2f58ba9779341d8e4946f6035a03

Contents?: true

Size: 522 Bytes

Versions: 1

Compression:

Stored size: 522 Bytes

Contents

# frozen_string_literal: true

require_relative 'git_ls/parser'

# Entry point for gem.
# Usage:
#   GitLS.files -> Array of strings as files.
#   This will be identical output to git ls-files
module GitLS
  class Error < StandardError; end

  class << self
    def files(path = ::Dir.pwd)
      path = ::File.join(path, '.git/index') if ::File.directory?(path)
      ::GitLS::Parser.new(::File.new(path)).files
    rescue Errno::ENOENT => e
      raise GitLS::Error, "Not a git directory: #{e.message}"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
git_ls-0.2.0 lib/git_ls.rb