Sha256: ec67c29adaa4fc19265b9bb722241abf87f9b496252ceb06485242f32e3f4e69

Contents?: true

Size: 293 Bytes

Versions: 7

Compression:

Stored size: 293 Bytes

Contents

# encoding: utf-8

require_relative "../lib/tty-prompt"

prompt = TTY::Prompt.new

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

7 entries across 7 versions & 1 rubygems

Version Path
tty-prompt-0.17.2 examples/ask_valid.rb
tty-prompt-0.17.1 examples/ask_valid.rb
tty-prompt-0.17.0 examples/ask_valid.rb
tty-prompt-0.16.1 examples/ask_valid.rb
tty-prompt-0.16.0 examples/ask_valid.rb
tty-prompt-0.15.0 examples/ask_valid.rb
tty-prompt-0.14.0 examples/ask_valid.rb