Add option: --compare-link

This commit is contained in:
sue445 2015-01-26 21:30:27 +09:00 committed by Petr Korolev
parent 90c455ada4
commit 8dc50cf483
2 changed files with 8 additions and 3 deletions

View File

@ -328,8 +328,10 @@ module GitHubChangelogGenerator
# Generate tag name and link
log = "## [#{newer_tag_name}](#{project_url}/tree/#{newer_tag_name})\n"
if @options[:compare_link] && older_tag_name
# Generate compare link
log += "[Full Changelog](#{project_url}/compare/#{older_tag_name}...#{newer_tag_name})\n" if older_tag_name
log += "[Full Changelog](#{project_url}/compare/#{older_tag_name}...#{newer_tag_name})\n"
end
#Generate date string:
time_string = newer_tag_time.strftime @options[:format]

View File

@ -6,7 +6,7 @@ require_relative 'version'
module GitHubChangelogGenerator
class Parser
def self.parse_options
options = {:tag1 => nil, :tag2 => nil, :format => '%d/%m/%y', :output => 'CHANGELOG.md', :labels => %w(bug enhancement), :pulls => true, :issues => true, :verbose => true, :add_issues_wo_labels => true, :merge_prefix => '*Merged pull-request:* ', :author => true, :pull_request_labels => nil, :filter_issues_by_milestone => true}
options = {:tag1 => nil, :tag2 => nil, :format => '%d/%m/%y', :output => 'CHANGELOG.md', :labels => %w(bug enhancement), :pulls => true, :issues => true, :verbose => true, :add_issues_wo_labels => true, :merge_prefix => '*Merged pull-request:* ', :author => true, :pull_request_labels => nil, :filter_issues_by_milestone => true, :compare_link => true}
parser = OptionParser.new { |opts|
opts.banner = 'Usage: changelog_generator [options]'
@ -43,6 +43,9 @@ module GitHubChangelogGenerator
opts.on('--[no-]author', 'Add author of pull-request in the end. Default is true') do |author|
options[:last] = author
end
opts.on('--[no-]compare-link', 'Include compare link between older version and newer version. Default is true') do |v|
options[:compare_link] = v
end
opts.on('--labels x,y,z', Array, 'Issues with that labels will be included to changelog. Default is \'bug,enhancement\'') do |list|
options[:labels] = list
end