#!/bin/bash

# Run a command in terminal.
# See also: RunInTerminal
#
# This one supports these options:
# - Give a prompt for the user
#       --prompt <prompt-string>
# - Give terminal options
#       --term <terminal-options-string>
# - Don't require user to press ENTER key to close the terminal window
#       --no-enter-wait
# - Stop parsing more parameters
#       --
#
# Examples:
# - Simple command
#       RunInTerminalOpt pwd
# - If command has options, use -- to stop parsing
#       RunInTerminalOpt -- ls -la
# - Run multiple commands
#       RunInTerminalOpt -- bash -c "pwd ; ls -la"
# - If file name has spaces, use baskslash (\) to quote space
#       RunInTerminalOpt -- bash -c "pwd ; ls -la foo\ bar"      # needs file "foo bar" to exist!
# - Use an option
#       RunInTerminalOpt --prompt="Here you are:" -- bash -c "pwd ; ls -la"
# - Redirection
#       RunInTerminalOpt -E "echo '$(date)' > /tmp/foobar"

source /usr/share/endeavouros/scripts/eos-script-lib-yad || {
    echo "Error: cannot source eos-script-lib-yad" >&2
    exit 1
}

export -f eos_yad_terminal
export -f eos_yad_RunCmdTermBashOpt
export -f eos_yad

Main()
{
    eos_yad_RunCmdTermBashOpt "$@"
}

Main "$@"
