#!/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__) gem "more_core_extensions" end require "more_core_extensions/core_ext/array/tableize" opts = Optimist.options do synopsis "Create a pull request on all repos." opt :base, "The target branch for the changes.", :type => :string, :required => true opt :head, "The name of the branch to create on your fork.", :type => :string, :required => true opt :script, "The path to the script that will update the desired files.", :type => :string, :required => true opt :message, "The commit message for this change.", :type => :string, :required => true opt :title, "The PR title for this change. (default is --message)", :type => :string MultiRepo::CLI.common_options(self) end results = {} begin MultiRepo::CLI.each_repo(**opts) do |repo| results[repo.name] = MultiRepo::Helpers::PullRequestBlasterOuter.new(repo, **opts).blast end ensure puts "Summary:" puts results.to_a.tableize(:header => false) unless results.empty? end