Merge pull request #20623 from Homebrew/livecheck/support-trailing-comments-in-watchlist
livecheck: support trailing comments in watchlist
This commit is contained in:
commit
4343324468
@ -78,9 +78,15 @@ module Homebrew
|
|||||||
formulae + casks
|
formulae + casks
|
||||||
elsif File.exist?(watchlist_path)
|
elsif File.exist?(watchlist_path)
|
||||||
begin
|
begin
|
||||||
|
# This removes blank lines, comment lines, and trailing comments
|
||||||
names = Pathname.new(watchlist_path).read.lines
|
names = Pathname.new(watchlist_path).read.lines
|
||||||
.reject { |line| line.start_with?("#") || line.blank? }
|
.filter_map do |line|
|
||||||
.map(&:strip)
|
comment_index = line.index("#")
|
||||||
|
next if comment_index&.zero?
|
||||||
|
|
||||||
|
line = line[0...comment_index] if comment_index
|
||||||
|
line&.strip.presence
|
||||||
|
end
|
||||||
|
|
||||||
named_args = CLI::NamedArgs.new(*names, parent: args)
|
named_args = CLI::NamedArgs.new(*names, parent: args)
|
||||||
named_args.to_formulae_and_casks(ignore_unavailable: true)
|
named_args.to_formulae_and_casks(ignore_unavailable: true)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user