Sha256: eac1a31b33ca36325cd4d76b78b95bcf475d36e30df41dd5b96a4c00a2fd8ba3

Contents?: true

Size: 1.49 KB

Versions: 4

Compression:

Stored size: 1.49 KB

Contents

#!/usr/bin/env ruby
# frozen_string_literal: true

lib = File.expand_path('../lib', __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)

require 'table_saw'
require 'table_saw/create_dump_file'
require 'table_saw/version'
require 'thor'

class CLI < Thor
  def self.exit_on_failure?
    true
  end

  desc 'dump', 'Create a postgres dump file'
  method_option :url, aliases: '-u', default: ENV['DATABASE_URL'],
                      desc: 'This option overrides all other connection properties.'
  method_option :dbname, aliases: '-d', default: ENV['PGDATABASE']
  method_option :host, aliases: '-h', default: ENV['PGHOST']
  method_option :port, aliases: '-p', default: ENV['PGPORT']
  method_option :user, aliases: '-U', default: ENV['PGUSER']
  method_option :password, default: ENV['PGPASSWORD']
  method_option :manifest, aliases: '-m', required: true
  method_option :output, aliases: '-o', default: 'output.dump'
  method_option :format, type: :hash, default: { 'type' => 'copy' }
  method_option :variables, aliases: '-v', type: :hash, default: {},
                            desc: 'This option takes a hash to override variables provided in the manifest'
  def dump
    TableSaw.configure(options.to_hash)
    records = TableSaw::DependencyGraph::Build.new(TableSaw::Manifest.instance).call
    TableSaw::CreateDumpFile.new(records, output: options[:output], format: options[:format]).call
  end

  desc 'version', 'Print version of table-saw'
  def version
    puts TableSaw::VERSION
  end
end

CLI.start

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
table_saw-3.1.0 exe/table-saw
table_saw-3.0.0 exe/table-saw
table_saw-2.10.0 exe/table-saw
table_saw-2.9.0 exe/table-saw