#!/usr/bin/env sh # # This script is generated by omni to allow for a better handling # of password requests during omni operations. It is not meant to be # run directly by the user. {% if not INTERACTIVE and not ENABLE_GUI -%} exit 1 {%- endif %} {% if ENABLE_GUI and (not INTERACTIVE or PREFER_GUI) -%} get_password_gui() { if [[ -z "$OMNI_SUBCOMMAND" ]]; then echo "This was not called from omni" >&2 exit 1 fi local show_details=false local triggering_command omni_command local prompt prompt_base prompt_details triggering_command=$(ps -p $PPID -o command= | sed 's/"/\\"/g') omni_command="omni ${OMNI_SUBCOMMAND}" prompt_base="'${omni_command}' wants to run '${triggering_command}'.\\n\\nTo allow this, enter your \\\"{{ TOOL }}\\\" password." prompt_details="'${omni_command}' wants to run '${triggering_command}' as part of:\\n\\n{{ COMMAND | escape_multiline_command(times=2) }}\\n\\nTo allow this, enter your \\\"{{ TOOL }}\\\" password." {% if TOOL == "ssh" -%} {% set prompt = "${*:-$prompt}" -%} {% else -%} {% set prompt = "$prompt" -%} {% endif -%} if command -v osascript >/dev/null; then use_osascript() { local output exit_code buttons if [ "$show_details" = true ]{% if TOOL == "ssh" %} || [ -n "$*" ]{% endif %}; then buttons='{"Cancel", "Ok"}' prompt="$prompt_details" else buttons='{"Details", "Cancel", "Ok"}' prompt="$prompt_base" fi output=$(osascript <