Sha256: 8a231a9c5731cd9933bc9b4c6b6c9f88358ce8bbfb8c30e9facb3148316b7c62

Contents?: true

Size: 761 Bytes

Versions: 2

Compression:

Stored size: 761 Bytes

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 'pg_export'

begin
  config = PgExport::ConfigurationParser.parse
  pg_export = PgExport.new(config)
  result = pg_export.call
  result
    .on_success { |outcome| puts outcome if outcome }
    .on_failure { |outcome| warn outcome[:message]; exit 1 }
rescue PgExport::ConfigurationParser::Error => e
  warn e.message.capitalize

  if e.reason == 'missing argument'
    warn "\nHint for the #{e.args.first} option:"
    warn PgExport::ConfigurationParser.help.to_s.split("\n").grep(/ #{e.args.first}/).join("\n")
  end

  warn 'Type "pg_export -h" to print options.'
  exit 1
rescue Interrupt
  puts
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pg_export-1.0.0 bin/pg_export
pg_export-1.0.0.rc8 bin/pg_export