Sha256: c6eb1bcd9f85a17aeb6a6dfc7e5a0aa512599a9d82aa6c25b0c05884ea9d3603

Contents?: true

Size: 605 Bytes

Versions: 3

Compression:

Stored size: 605 Bytes

Contents

module CouchDocs
  class CommandLine
    def self.run(*args)
      CommandLine.new(*args).run
    end

    attr_accessor :command, :options

    def initialize(args)
      @command = args.shift
      @options = args
    end

    def run
      case command
      when "dump"
        CouchDocs.dump(*options)
      when "load"
        CouchDocs.put_document_dir(*options.reverse)
      when "help", "--help", "-h"
        puts "#{$0} load dir         couchdb_uri"
        puts "#{$0} dump couchdb_uri dir"
      else
        raise ArgumentError.new("Unknown command #{command}")
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
eee-c-couch_docs-0.9.0 lib/couch_docs/command_line.rb
eee-c-couch_docs-1.0.0 lib/couch_docs/command_line.rb
couch_docs-1.0.0 lib/couch_docs/command_line.rb