Add option: --compare-link
This commit is contained in:
		
							parent
							
								
									eb9bd59f26
								
							
						
					
					
						commit
						1fced7278e
					
				@ -328,8 +328,10 @@ module GitHubChangelogGenerator
 | 
			
		||||
      # Generate tag name and link
 | 
			
		||||
      log = "## [#{newer_tag_name}](#{project_url}/tree/#{newer_tag_name})\n"
 | 
			
		||||
 | 
			
		||||
      # Generate compare link
 | 
			
		||||
      log += "[Full Changelog](#{project_url}/compare/#{older_tag_name}...#{newer_tag_name})\n" if older_tag_name
 | 
			
		||||
      if @options[:compare_link] && older_tag_name
 | 
			
		||||
        # Generate compare link
 | 
			
		||||
        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]
 | 
			
		||||
 | 
			
		||||
@ -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
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user