Sha256: 20d2cfc80b0b3c3247b496e82e7bc4cc5b55bb14d0154c95e5720227b2874f61

Contents?: true

Size: 334 Bytes

Versions: 10

Compression:

Stored size: 334 Bytes

Contents

# encoding: utf-8

require 'tty-prompt'

prompt = TTY::Prompt.new

prompt.ask('What is your name?', default: ENV['USER'])

prompt.ask('Folder name?') do |q|
  q.required(true)
  q.validate ->(v) { return !Dir.exist?(v) }
  q.messages[:valid?] = 'Folder already exists?'
  q.messages[:required?] = 'Folder name must not be empty'
end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
tty-prompt-0.13.2 examples/ask.rb
tty-prompt-0.13.1 examples/ask.rb
tty-prompt-0.13.0 examples/ask.rb
austb-tty-prompt-0.13.0 examples/ask.rb
tty-prompt-0.12.0 examples/ask.rb
tty-prompt-0.11.0 examples/ask.rb
tty-prompt-0.10.1 examples/ask.rb
tty-prompt-0.10.0 examples/ask.rb
tty-prompt-0.9.0 examples/ask.rb
tty-prompt-0.8.0 examples/ask.rb