bin/region_edit in ruby_pager-0.1.2 vs bin/region_edit in ruby_pager-0.1.3

- old
+ new

@@ -1,14 +1,14 @@ #!/usr/bin/env ruby require "bundler/setup" require "ruby_pager" -require "trollop" +require "optimist" require "ap" -opts = Trollop::options do +opts = Optimist::options do version "region_edit 0.0.1 (c) 2018 Vicente Bosch Campos" banner <<-EOS region_edit is a command tool that allows the creation,edition or deletion of text regions in a Page XML file Usage: generate_htk_language_model [options] @@ -21,17 +21,17 @@ opt :coords, "coords to be used in the addition of edition of a text region. Format: \"x1,y1 x2,y2 x3,y3...\" (quotation marks required)" , :type => :string opt :new_label_id, "new label id of the region that is being edited", :type => :string end -Trollop::die :mode, "Operation mode was not selected" unless opts[:mode] -Trollop::die :mode, "Operation mode selected must be either mk (make), rm (remove) or ed (edit)" unless opts[:mode]=="mk" or opts[:mode]=="rm" or opts[:mode]=="ed" -Trollop::die :input_file, "Input page file name was not indicated" unless opts[:input_file] -Trollop::die :input_file, "Indicated input page file does not exist which is required" unless File.exist?(opts[:input_file]) -Trollop::die :output_file, "Output page file name was not indicated" unless opts[:output_file] -Trollop::die :output_file, "Indicated output page file exists which will cause the command to overwrite it" if File.exist?(opts[:output_file]) -Trollop::die :label_id, "Label id of region to be added/edited/deleted was not specified" unless opts[:label_id] -Trollop::die :coords, "Region was selected to be addedd but no coordinates for the contour were provided" if opts[:mode]=="mk" and not opts[:coords] +Optimist::die :mode, "Operation mode was not selected" unless opts[:mode] +Optimist::die :mode, "Operation mode selected must be either mk (make), rm (remove) or ed (edit)" unless opts[:mode]=="mk" or opts[:mode]=="rm" or opts[:mode]=="ed" +Optimist::die :input_file, "Input page file name was not indicated" unless opts[:input_file] +Optimist::die :input_file, "Indicated input page file does not exist which is required" unless File.exist?(opts[:input_file]) +Optimist::die :output_file, "Output page file name was not indicated" unless opts[:output_file] +Optimist::die :output_file, "Indicated output page file exists which will cause the command to overwrite it" if File.exist?(opts[:output_file]) +Optimist::die :label_id, "Label id of region to be added/edited/deleted was not specified" unless opts[:label_id] +Optimist::die :coords, "Region was selected to be addedd but no coordinates for the contour were provided" if opts[:mode]=="mk" and not opts[:coords] input_page = RubyPager::Page.load_from_xml(opts[:input_file]) if opts[:mode]=="mk" new_region=RubyPager::Text_Region.blank \ No newline at end of file