Sha256: e4d9064362a82e68d378b7913e056afaa8becd1bae0e39fcde4dba28576d2fc1

Contents?: true

Size: 705 Bytes

Versions: 4

Compression:

Stored size: 705 Bytes

Contents

#!/usr/bin/env ruby

SCRIPT_DIR = File.expand_path("../scripts", __dir__)

def usage
  puts "Usage: multi_repo <script> [args]"
  puts "  script      Script to run"
  puts "  args        Arguments to pass to the script"
  puts "  -h, --help  Show this help message"

  available_scripts = Dir.children(SCRIPT_DIR).sort.map { |f| "  #{f}"}
  puts
  puts "Available scripts:"
  puts available_scripts
end

script, args = ARGV[0], ARGV[1..]

if script.nil? || script.empty? || script == "--help" || script == "-h"
  usage
  exit
end

fq_script = File.join(SCRIPT_DIR, script)
unless File.exist?(fq_script)
  puts "ERROR: script #{script.inspect} not found"
  puts
  usage
  exit 1
end

exec fq_script, *args

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
multi_repo-0.2.1 exe/multi_repo
multi_repo-0.2.0 exe/multi_repo
multi_repo-0.1.2 exe/multi_repo
multi_repo-0.1.1 exe/multi_repo