Sha256: 2b456f6a6357fb15b1d07f39dc4a011be999e25bf2aa86530a0cf644c3f1c9af

Contents?: true

Size: 1.35 KB

Versions: 14

Compression:

Stored size: 1.35 KB

Contents

#!/usr/bin/env ruby
# encoding: UTF-8
#
# git-outstanding-features --
#
# List merged pull requests.
#
require 'rubygems'
require 'optparse'
require 'term/ansicolor'
require 'git-whistles/app'

class App < Git::Whistles::App

  def initialize
    super
  end

  def main(args)
    super
    parse_args!(args)

    merges = `git log --merges --oneline #{options.from} ^#{options.to} | grep 'Merge pull request'`
    return if merges.nil?

    output = []
    merges.lines.each do |merge|
      merge.match /(#\d+).*from (.*)/ 
      output << $1.strip + ' ' + $2.strip
    end

    puts options.oneline ? output.join(', ') : output
  end

  def defaults
    {
      :from    => 'origin/master',
      :to      => 'origin/production',
      :oneline => false
    }
  end

  def option_parser
    @option_parser ||= OptionParser.new do |op|
      op.banner = "Usage: git outstanding-features --from [FROM-BRANCH] --to [TO-BRANCH]"

      op.on("-f", "--from [BRANCH]", "From branch") do |from|
        options.from = from
      end

      op.on("-t", "--to [BRANCH]", "To branch") do |to|
        options.to = to
      end

      op.on("-o", "--oneline", "Output features in one line separated by spaces") do |oneline|
        options.oneline = true
      end

      op.on_tail("-h", "--help", "Show this message") do
        puts op
        exit
      end
    end
  end
end

App.run!

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
git-whistles-1.4.2 bin/git-outstanding-features
git-whistles-1.4 bin/git-outstanding-features
git-whistles-1.3 bin/git-outstanding-features
git-whistles-1.2.1 bin/git-outstanding-features
git-whistles-1.2.0 bin/git-outstanding-features
git-whistles-1.1.3 bin/git-outstanding-features
git-whistles-1.1.2 bin/git-outstanding-features
git-whistles-1.1.1 bin/git-outstanding-features
git-whistles-1.1.0 bin/git-outstanding-features
git-whistles-1.0.2 bin/git-outstanding-features
git-whistles-1.0.1 bin/git-outstanding-features
git-whistles-0.12.0 bin/git-outstanding-features
git-whistles-0.10.0 bin/git-outstanding-features
git-whistles-0.9.1 bin/git-outstanding-features