lib/review/textmaker.rb in review-4.0.0 vs lib/review/textmaker.rb in review-4.1.0
- old
+ new
@@ -1,6 +1,6 @@
-# Copyright (c) 2018-2019 Kenshi Muto
+# Copyright (c) 2018-2020 Kenshi Muto
#
# This program is free software.
# You can distribute or modify this program under the terms of
# the GNU LGPL, Lesser General Public License version 2.1.
# For details of the GNU LGPL, see the file "COPYING".
@@ -43,14 +43,16 @@
end
def parse_opts(args)
cmd_config = {}
opts = OptionParser.new
+ @buildonly = nil
opts.banner = 'Usage: review-textmaker [-n] configfile'
opts.version = ReVIEW::VERSION
opts.on('-n', 'No decoration.') { @plaintext = true }
+ opts.on('-y', '--only file1,file2,...', 'Build only specified files.') { |v| @buildonly = v.split(/\s*,\s*/).map { |m| m.strip.sub(/\.re\Z/, '') } }
opts.on('--help', 'Prints this message and quit.') do
puts opts.help
exit 0
end
@@ -152,9 +154,13 @@
filename = chap.path
else
filename = Pathname.new(chap.path).relative_path_from(base_path).to_s
end
id = File.basename(filename).sub(/\.re\Z/, '')
+ if @buildonly && !@buildonly.include?(id)
+ warn "skip #{id}.re"
+ return
+ end
textfile = "#{id}.txt"
begin
@converter.convert(filename, File.join(basetmpdir, textfile))