Sha256: 51aee31c3cd0c12b07a947089d18bc4f429d66ce1848e3d777ee9c285368c1e2

Contents?: true

Size: 1.29 KB

Versions: 1

Compression:

Stored size: 1.29 KB

Contents

#!/usr/bin/env ruby -w

require "git_fame"
require "trollop"

sort = ["name", "commits", "loc", "files"]
opts = Trollop::options do
  version "git-fame #{GitFame::VERSION} (c) 2012 Linus Oleander"
  opt :repository, "What git repository should be used?", default: "."
  opt :sort, "What should the printed table be sorted by? #{sort.join(", ")}", default: "loc", type: String
  opt :progressbar, "Show progressbar during calculation", default: 1, type: Integer
  opt :whitespace, "Ignore whitespace changes", default: false
  opt :bytype, "Group line counts by file extension (i.e. .rb, .erb, .yml)", default: false
  opt :include, "Paths to include in git ls-files", default: "", type: String
  opt :exclude, "Paths to exclude (comma separated)", default: "", type: String
  opt :branch, "Branch to run on", default: "master", type: String
end

Trollop::die :repository, "is not a git repository" unless GitFame::Base.git_repository?(opts[:repository])
Trollop::die :sort, "must be one of the following; #{sort.join(", ")}" unless sort.include?(opts[:sort])
GitFame::Base.new({
  repository: opts[:repository],
  progressbar: opts[:progressbar] == 1,
  sort: opts[:sort],
  whitespace: opts[:whitespace],
  bytype: opts[:bytype],
  include: opts[:include],
  exclude: opts[:exclude],
  branch: opts[:branch]
}).pretty_puts

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
git_fame-1.4.2 bin/git-fame