Merge pull request #3969 from GauthamGoli/release-notes-args
release-notes: Use Parser to parse args
This commit is contained in:
commit
08b2add372
@ -5,10 +5,16 @@
|
|||||||
#:
|
#:
|
||||||
#: If `--markdown` is passed, output as a Markdown list.
|
#: If `--markdown` is passed, output as a Markdown list.
|
||||||
|
|
||||||
|
require "cli_parser"
|
||||||
|
|
||||||
module Homebrew
|
module Homebrew
|
||||||
module_function
|
module_function
|
||||||
|
|
||||||
def release_notes
|
def release_notes
|
||||||
|
args = Homebrew::CLI::Parser.new do
|
||||||
|
switch "--markdown"
|
||||||
|
end.parse
|
||||||
|
|
||||||
previous_tag = ARGV.named.first
|
previous_tag = ARGV.named.first
|
||||||
previous_tag ||= Utils.popen_read("git tag --list --sort=-version:refname")
|
previous_tag ||= Utils.popen_read("git tag --list --sort=-version:refname")
|
||||||
.lines.first.chomp
|
.lines.first.chomp
|
||||||
@ -28,7 +34,7 @@ module Homebrew
|
|||||||
s.gsub(%r{.*Merge pull request #(\d+) from ([^/]+)/[^>]*(>>)*},
|
s.gsub(%r{.*Merge pull request #(\d+) from ([^/]+)/[^>]*(>>)*},
|
||||||
"https://github.com/Homebrew/brew/pull/\\1 (@\\2)")
|
"https://github.com/Homebrew/brew/pull/\\1 (@\\2)")
|
||||||
end
|
end
|
||||||
if ARGV.include?("--markdown")
|
if args.markdown?
|
||||||
output.map! do |s|
|
output.map! do |s|
|
||||||
/(.*\d)+ \(@(.+)\) - (.*)/ =~ s
|
/(.*\d)+ \(@(.+)\) - (.*)/ =~ s
|
||||||
"- [#{Regexp.last_match(3)}](#{Regexp.last_match(1)}) (@#{Regexp.last_match(2)})"
|
"- [#{Regexp.last_match(3)}](#{Regexp.last_match(1)}) (@#{Regexp.last_match(2)})"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user