Class: MyPKI::Prompter::CommandLinePrompter

Inherits:
Object
  • Object
show all
Defined in:
lib/mypki/prompters/cli.rb

Direct Known Subclasses

JRubyPrompter

Instance Method Summary collapse

Instance Method Details

#file_prompt(prompt) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/mypki/prompters/cli.rb', line 4

def file_prompt prompt
  require 'readline'
  Readline.completion_append_character = ''
  
  Readline.completion_proc = proc do |key|
    path = File.expand_path key
    path += '/' if key.end_with? '/'
    Dir["#{path}*"]
  end
  
  Readline.readline(prompt, true)
end

#pass_prompt(prompt) ⇒ Object



17
18
19
20
# File 'lib/mypki/prompters/cli.rb', line 17

def pass_prompt prompt
  require 'highline/import'
  ask("#{prompt} ") {|q| q.echo = false}
end