Skip to content

Instantly share code, notes, and snippets.

@nhtzr
Created March 20, 2020 01:01
Show Gist options
  • Save nhtzr/cb2399bdf9bca3f6f88dce01b4c877a1 to your computer and use it in GitHub Desktop.
Save nhtzr/cb2399bdf9bca3f6f88dce01b4c877a1 to your computer and use it in GitHub Desktop.
askpass for osx
#!/usr/bin/env sh
osascript -e "
on GetCurrentApp()
tell application \"System Events\"
set _app to item 1 of (every process whose frontmost is true)
return name of _app
end tell
end GetCurrentApp
set _app to GetCurrentApp()
tell application _app
text returned of (display dialog \"Please enter your password:\" ¬
with title \"Password\" ¬
with icon caution ¬
default answer \"\" ¬
buttons {\"Cancel\", \"OK\"} default button 2 ¬
giving up after 295 ¬
with hidden answer)
end tell
"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment