Sha256: f6d41c794969398cdb47d93413180038f01376c32f4f9dd65083fe9ac8902a08

Contents?: true

Size: 1.22 KB

Versions: 1

Compression:

Stored size: 1.22 KB

Contents

#!/usr/bin/env ruby

lib = File.expand_path('../lib', __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'git/superproject'

if (command = ARGV.shift)&.start_with? '++'
  name = command[2..-1]
  command = nil
end

# TODO: acquire flock on "~/.git/multi/superprojects.config"

case (command ||= ARGV.shift)
when /\A--/
  case command
  when '--version' then Git::Superproject::Commands.version
  when '--help'    then Git::Superproject::Commands.help
  else
    config = Git::Superproject::Config.from(Git::SUPERPROJECTS_CONFIG)
    case command
    when '--config' then puts config.to_json
    else
      unless name
        warn 'No superproject specified... aborting!'
        exit(-1)
      end
      case command
      when '--list'   then config.list(name)
      when '--add'    then config.add(name, *ARGV)
      when '--remove' then config.remove(name, *ARGV)
      else
        abort \
          "Unknown 'git superproject' command: #{command}\n\n" \
          '(use --help/-h to list all available commands)'
      end
      config.save(Git::SUPERPROJECTS_CONFIG)
    end
  end
when nil, '', '-h'
  Git::Superproject::Commands.help
end

# TODO: release flock on "~/.git/multi/superprojects.config"

# That's all Folks!

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
git-superproject-0.2.2 exe/git-superproject