lib/sample_cmdlet_patterns/commands/prompt_validation.rb
def execute(input: $stdin, output: $stdout)
        prompt = TTY::Prompt.new

        prompt.ask('What is your username (aaaa.bbbb)?') do |q|
          q.validate /^[^\.]+\.[^\.]+/
        end

        prompt.ask('What is your username (aaaa.bbbb)?') do |q|
          q.validate { |input| input =~ /^[^\.]+\.[^\.]+/ }
        end

        prompt.ask('What is your email?') { |q| q.validate :email }

        :gui
      end
# Execute PromptValidation subcommand taking input from
# a input stream and writing to output stream
#
# sample: output.puts 'OK'
Execute PromptValidation subcommand taking input from
a input stream and writing to output stream


Execute PromptValidation subcommand taking input from a input stream and writing to output stream
def execute(input: $stdin, output: $stdout)
        prompt = TTY::Prompt.new
        prompt.ask('What is your username (aaaa.bbbb)?') do |q|
          q.validate /^[^\.]+\.[^\.]+/
        end
        prompt.ask('What is your username (aaaa.bbbb)?') do |q|
          q.validate { |input| input =~ /^[^\.]+\.[^\.]+/ }
        end
        prompt.ask('What is your email?') { |q| q.validate :email }
        :gui
      end
def execute ( input : $stdin , output : $stdout ) prompt = TTY :: Prompt . new prompt . ask ( 'What is your username (aaaa.bbbb)?' ) do | q | q . validate / ^[^ \. ]+ \. [^ \. ]+ / end prompt . ask ( 'What is your username (aaaa.bbbb)?' ) do | q | q . validate { | input | input =~ / ^[^ \. ]+ \. [^ \. ]+ / } end prompt . ask ( 'What is your email?' ) { | q | q . validate :email } :gui end
Execute PromptValidation subcommand taking input from
a input stream and writing to output stream
Execute PromptValidation subcommand taking input from a input stream and writing to output stream
input
output