Sha256: ef212eccbc5b6e50659a05b2e06a29b079097bac65b217cb9d61045beb59e3ea

Contents?: true

Size: 602 Bytes

Versions: 1

Compression:

Stored size: 602 Bytes

Contents

require 'git-utils/command'

class Sync < Command

  def parser
    OptionParser.new do |opts|
      opts.banner = "Usage: git sync"
      opts.on("-b", "--branch", "sync with given branch") do |opt|
        self.options.branch = opt
      end
      opts.on_tail("-h", "--help", "this usage guide") do
        puts opts.to_s; exit 0
      end
    end
  end

  # Returns a command appropriate for executing at the command line.
  def cmd
    branch = options[:branch] || 'master'
    c = ["git checkout #{branch}"]
    c << "git pull"
    c << "git checkout #{current_branch}"
    c.join("\n")
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
git-utils-0.6.3 lib/git-utils/sync.rb