From 6170e5c928d45680718e023d21127cb035a6908e Mon Sep 17 00:00:00 2001 From: Joe Block Date: Fri, 6 May 2016 10:37:23 -0700 Subject: [PATCH] Add a helper function to preset a GUI password dialog. --- functions.md | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/functions.md b/functions.md index 2badd9d..4cfacca 100644 --- a/functions.md +++ b/functions.md @@ -21,7 +21,9 @@ ### App Icons #### Create App Icon + Function to quickly create an application icon from 1024px master file. + ```bash function mkicns() { if [[ -z "$@" ]]; then @@ -45,6 +47,33 @@ function mkicns() { } ``` +### Helper functions + +#### Ask user for a password + +This function will use AppleScript to present a password entry dialog to make +your scripts a little more user friendly. + +```bash +function gui_password { + if [[ -z $1 ]]; then + gui_prompt="Password:" + else + gui_prompt="$1" + fi + PW=$(osascript <