Sha256: 21f2f7ff78b8b09a61e051804f1c8fb6b5e21bda2b6733564e3027353c83c330

Contents?: true

Size: 935 Bytes

Versions: 5

Compression:

Stored size: 935 Bytes

Contents

#!/usr/bin/env ruby

require "bundler/inline"
gemfile do
  source "https://rubygems.org"
  gem "multi_repo", require: "multi_repo/cli", path: File.expand_path("..", __dir__)
end
require 'more_core_extensions/core_ext/array/tableize'

opts = Optimist.options do
  opt :tag, "The tag name.", :type => :string, :required => true

  MultiRepo::CLI.common_options(self, :except => :dry_run, :repo_set_default => nil)
end
opts[:repo_set] = opts[:tag].split("-").first unless opts[:repo] || opts[:repo_set]

HEADER = %w(Repo SHA Message).freeze

def show_tag(repo, tag)
  line =
    begin
      repo.git.client.capturing.show({:summary => true, :oneline => true}, tag)
    rescue MiniGit::GitError => err
      ""
    end

  sha, message = line.split(" ", 2)
  [repo.name, sha, message]
end

repos = MultiRepo::CLI.repos_for(**opts)
table = [HEADER] + repos.collect { |repo| show_tag(repo, opts[:tag]) }
puts table.tableize(:max_width => 75)

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
multi_repo-0.2.1 scripts/show_tag
multi_repo-0.2.0 scripts/show_tag
multi_repo-0.1.2 scripts/show_tag
multi_repo-0.1.1 scripts/show_tag
multi_repo-0.1.0 scripts/show_tag