Sha256: 7484beb65d1b4733e11a3611efc0cb382aef1e6d94f919f525db1d6bd356cc44

Contents?: true

Size: 635 Bytes

Versions: 3

Compression:

Stored size: 635 Bytes

Contents

require "thor"
require "society"

module Society

  class CLI < Thor

    desc_text = "Formats are html (default), json, and csv."
    desc_text << "Example: society from foo/ -f json -o ./society_data.json"

    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 format
      options['format'] && options['format'].to_sym
    end

  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
society-2.0.1 lib/society/cli.rb
society-2.0 lib/society/cli.rb
society-1.7 lib/society/cli.rb