Sha256: 10b2a68c269d088c98144b264c8610bdf4a1fa26ddfb30c298775af1a5fe24d7

Contents?: true

Size: 627 Bytes

Versions: 9

Compression:

Stored size: 627 Bytes

Contents

require "thor"
require "society"

module Society

  class CLI < Thor

    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 [-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

9 entries across 9 versions & 1 rubygems

Version Path
society-1.4.0 lib/society/cli.rb
society-1.3.0 lib/society/cli.rb
society-1.2.3 lib/society/cli.rb
society-1.2.2 lib/society/cli.rb
society-1.2.1 lib/society/cli.rb
society-1.2.0 lib/society/cli.rb
society-1.1.1 lib/society/cli.rb
society-1.1.0 lib/society/cli.rb
society-1.0.0 lib/society/cli.rb