lib/society/cli.rb in society-0.13.2 vs lib/society/cli.rb in society-1.0.0

- old
+ new

@@ -1,26 +1,29 @@ require "thor" +require "society" module Society class CLI < Thor - desc_text = "" + desc_text = "Formats are html (default) and json." + desc_text << "Example: society from foo/ -f json -o ./society_data.json" - desc "from PATH_TO_FILE", desc_text - def from(path="./") - parser = Society::Parser.new(path) - parser.parse_files - parser.report + desc "from PATH_TO_FILE [-f FORMAT] [-o OUTPUT_PATH]", desc_text + method_option :format, :type => :string, :default => 'html', :aliases => "-f" + method_option :output, :type => :string, :aliases => "-o" + + def from(path) + Society.new(path).report(format, options['output']) end default_task :from private - def formatter - Formatters::Text + def format + options['format'] && options['format'].to_sym end end -end \ No newline at end of file +end