Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 44833e29 authored by Jonathan Riddell's avatar Jonathan Riddell 🏄

fix it up

parent e3936c27
...@@ -24,7 +24,7 @@ require 'optparse' ...@@ -24,7 +24,7 @@ require 'optparse'
require_relative 'lib/appstream-metainfo-release-update' require_relative 'lib/appstream-metainfo-release-update'
@date = "today" @date = "today"
@release_to_show = 0 @releases_to_show = 0
parser = OptionParser.new do |opts| parser = OptionParser.new do |opts|
opts.banner = <<-EOS opts.banner = <<-EOS
...@@ -32,15 +32,15 @@ Usage: appstream-metainfo-release-update 'org.foo.metainfo.xml' ...@@ -32,15 +32,15 @@ Usage: appstream-metainfo-release-update 'org.foo.metainfo.xml'
EOS EOS
opts.on("-v", "--version VERSION", opts.on("-v", "--version VERSION",
"version to add e.g. 1.0") do |vers| "version to add e.g. 1.0") do |vers|
@version << vers @version = vers
end end
opts.on("-d", "--datestring DATE_STRING", opts.on("-d", "--datestring DATE_STRING",
"date to use 'today' 'next Thursday' '2018-01-01' etc") do |date_string| "date to use 'today' 'next Thursday' '2018-01-01' etc") do |date_string|
@date << date_string @date = date_string || "today"
end end
opts.on("-r", "--releases_to_show RELEASES_TO_SHOW", opts.on("-r", "--releases_to_show RELEASES_TO_SHOW",
"how many releases to include in file (default infinite)") do |releases_to_show| "how many releases to include in file (default infinite)") do |releases_to_show|
@releases_to_show = releases_to_show || 0 @releases_to_show = releases_to_show.to_i || 0
end end
end end
parser.parse! parser.parse!
......
...@@ -52,7 +52,7 @@ class MetaInfoUpdater ...@@ -52,7 +52,7 @@ class MetaInfoUpdater
else else
component.add_child("<releases><release version='#{@version}' date='#{date}'/></releases>") component.add_child("<releases><release version='#{@version}' date='#{date}'/></releases>")
end end
if @releases_to_show > 0 if releases and @releases_to_show > 0
if releases.children.length > @releases_to_show if releases.children.length > @releases_to_show
releases.children = releases.children[-@releases_to_show,@releases_to_show] releases.children = releases.children[-@releases_to_show,@releases_to_show]
end end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment