filter-tags - Added capability to exclude tags with a regular expression by filtering names.
This commit is contained in:
parent
4f932fda1a
commit
40dec5346b
|
@ -68,11 +68,25 @@ module GitHubChangelogGenerator
|
||||||
response = @github.repos.tags @options[:user], @options[:project]
|
response = @github.repos.tags @options[:user], @options[:project]
|
||||||
page_i = 0
|
page_i = 0
|
||||||
count_pages = response.count_pages
|
count_pages = response.count_pages
|
||||||
|
|
||||||
response.each_page do |page|
|
response.each_page do |page|
|
||||||
|
|
||||||
|
if @options[:filter_tags]
|
||||||
|
body_new = []
|
||||||
|
reg = Regexp.new @options[:filter_tags]
|
||||||
|
page.body.each_with_index do |tag,index|
|
||||||
|
if !(tag.name =~ reg)
|
||||||
|
body_new << tag
|
||||||
|
end
|
||||||
|
end
|
||||||
|
page.body = body_new
|
||||||
|
end
|
||||||
|
|
||||||
page_i += PER_PAGE_NUMBER
|
page_i += PER_PAGE_NUMBER
|
||||||
print_in_same_line("Fetching tags... #{page_i}/#{count_pages * PER_PAGE_NUMBER}")
|
print_in_same_line("Fetching tags... #{page_i}/#{count_pages * PER_PAGE_NUMBER}")
|
||||||
tags.concat(page)
|
tags.concat(page)
|
||||||
end
|
end
|
||||||
|
|
||||||
print_empty_line
|
print_empty_line
|
||||||
|
|
||||||
if tags.count == 0
|
if tags.count == 0
|
||||||
|
|
|
@ -116,6 +116,9 @@ module GitHubChangelogGenerator
|
||||||
opts.on("--between-tags x,y,z", Array, "Change log will be filled only between specified tags") do |list|
|
opts.on("--between-tags x,y,z", Array, "Change log will be filled only between specified tags") do |list|
|
||||||
options[:between_tags] = list
|
options[:between_tags] = list
|
||||||
end
|
end
|
||||||
|
opts.on("--filter-tags [REGEX]", "Apply a regular expression on tag names so that they can be excluded, for example: --filter-tags \".*\+\d{1,}\" ") do |last|
|
||||||
|
options[:filter_tags] = last
|
||||||
|
end
|
||||||
opts.on("--exclude-tags x,y,z", Array, "Change log will exclude specified tags") do |list|
|
opts.on("--exclude-tags x,y,z", Array, "Change log will exclude specified tags") do |list|
|
||||||
options[:exclude_tags] = list
|
options[:exclude_tags] = list
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue
Block a user