Sha256: 7ad3058669b516022b00b86ae5a405423636d1fc7ffebbafec05d4a32a73f0a8
Contents?: true
Size: 1.52 KB
Versions: 23
Compression:
Stored size: 1.52 KB
Contents
#!/usr/bin/env ruby require_relative "../lib/glossarist" class GlossaristCommand < Thor desc "generate_latex", "Convert Concepts to Latex format" option :concepts_path, aliases: :p, required: true, desc: "Path to yaml concepts directory" option :latex_concepts, aliases: :l, desc: "File path having list of concepts that should be converted to LATEX format. If not provided all the concepts will be converted to the latex format" option :output_file, aliases: :o, desc: "Output file path. By default the output will pe printed to the console" option :extra_attributes, aliases: :e, type: :array, desc: "List of extra attributes that are not in standard Glossarist Concept model" def generate_latex assets = [] latex_concepts_file = options[:latex_concepts] if options[:extra_attributes] Glossarist.configure do |config| config.register_extension_attributes(options[:extra_attributes]) end end concept_set = Glossarist::ConceptSet.new(options[:concepts_path], assets) latex_str = concept_set.to_latex(latex_concepts_file) output_file_path = options[:output_file] if output_file_path File.open(output_file_path, "w") do |file| file.puts latex_str end else puts latex_str end end def method_missing(*args) warn "No method found named: #{args[0]}" warn "Run with `--help` or `-h` to see available options" exit 1 end def respond_to_missing? true end def self.exit_on_failure? true end end GlossaristCommand.start(ARGV)
Version data entries
23 entries across 23 versions & 2 rubygems