Sha256: 498c9217822e478e94cdf546c0a9c29b620036df7e981c11723dea3ad600556a

Contents?: true

Size: 788 Bytes

Versions: 3

Compression:

Stored size: 788 Bytes

Contents

require 'highline/import'

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

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

  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
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
setec_astronomy-0.2.1 lib/setec_astronomy/prompt.rb
setec_astronomy-0.2.0 lib/setec_astronomy/prompt.rb
setec_astronomy-0.1.0 lib/setec_astronomy/prompt.rb