Sha256: bf0bc35160ec0db549407201185aba166da749096b4e167aca1a4695e3646f55

Contents?: true

Size: 779 Bytes

Versions: 16

Compression:

Stored size: 779 Bytes

Contents

# frozen_string_literal: true

require 'tty-prompt'

class PgExport
  module Ui
    module Interactive
      class Input
        def select_dump(dumps)
          idx = prompt.select('Select dump to import:') do |menu|
            menu.enum '.'
            dumps.each_with_index do |d, i|
              menu.choice(d.to_s, i)
            end
          end

          dumps[idx]
        end

        def enter_database_name(default = nil)
          puts 'To which database would you like to restore the downloaded dump?'
          prompt.ask('Enter a local database name:') do |q|
            q.required(true)
            q.default(default) if default
          end
        end

        private

        def prompt
          TTY::Prompt.new
        end
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
pg_export-1.0.0 lib/pg_export/ui/interactive/input.rb
pg_export-1.0.0.rc8 lib/pg_export/ui/interactive/input.rb
pg_export-1.0.0.rc6 lib/pg_export/lib/pg_export/ui/interactive/input.rb
pg_export-1.0.0.rc5 lib/pg_export/lib/pg_export/ui/interactive/input.rb
pg_export-1.0.0.rc4 lib/pg_export/lib/pg_export/ui/interactive/input.rb
pg_export-1.0.0.rc3 lib/pg_export/lib/pg_export/ui/interactive/input.rb
pg_export-1.0.0.rc2 lib/pg_export/lib/pg_export/ui/interactive/input.rb
pg_export-1.0.0.rc1 lib/pg_export/lib/pg_export/ui/interactive/input.rb
pg_export-0.7.7 lib/pg_export/lib/pg_export/ui/interactive/input.rb
pg_export-0.7.6 lib/pg_export/lib/pg_export/ui/interactive/input.rb
pg_export-0.7.5 lib/pg_export/lib/pg_export/ui/interactive/input.rb
pg_export-0.7.4 lib/pg_export/lib/pg_export/ui/interactive/input.rb
pg_export-0.7.3 lib/pg_export/lib/pg_export/ui/interactive/input.rb
pg_export-0.7.2 lib/pg_export/lib/pg_export/ui/interactive/input.rb
pg_export-0.7.1 lib/pg_export/lib/pg_export/ui/interactive/input.rb
pg_export-0.7.0 lib/pg_export/lib/pg_export/ui/interactive/input.rb