Created
February 27, 2009 21:28
-
-
Save jschairb/71709 to your computer and use it in GitHub Desktop.
Grab Password from 1Password
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Grab a password out of the 1Password keychain...finding it by "name" | |
| def password_for_hostname(name) | |
| password_info = `security 2>&1 >/dev/null find-generic-password -gs passwords.Password:#{name} 1Password.keychain` | |
| password = password_info.match(/\"\:\"(.+)\"\}\"/)[1] rescue nil | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment