Module: Prompt

Defined in:
lib/setec_astronomy/prompt.rb

Class Method Summary collapse

Class Method Details

._password_dialog_actionscriptObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/setec_astronomy/prompt.rb', line 12

def self._password_dialog_actionscript
  <<-APPLESCRIPT.gsub(/^ */, '')
    /usr/bin/osascript <<EOT
    tell application "Finder"
        activate
        set output to text returned of ( \
          display dialog "Enter your master password:" \
          with title "KeePass Database Master Password" \
          default answer "" \
          with hidden answer \
          with icon (path to "apps") as Unicode text & "Utilities:Keychain Access.app:Contents:Resources:Keychain.icns" as alias \
        )
    end tell
    EOT
  APPLESCRIPT
end

.ask_password_consoleObject



4
5
6
# File 'lib/setec_astronomy/prompt.rb', line 4

def self.ask_password_console
  ask("Password: ") { |q| q.echo = false }
end

.ask_password_guiObject



8
9
10
# File 'lib/setec_astronomy/prompt.rb', line 8

def self.ask_password_gui
  `#{_password_dialog_actionscript}`.chomp
end