mirror of
https://github.com/frappe/frappe_docker.git
synced 2025-01-25 16:18:32 +00:00
33cc4ff3a0
- Added missing shebang - Fixed malformed multi line variables - Removed unnecessary su (which is not working in this way anyway) - Added missing error handling (unsupported options as well as missing argument) - Simplified the whole script (without the removal of features, hopefully?)
34 lines
691 B
Bash
Executable File
34 lines
691 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
display_usage() {
|
|
echo "$(basename "$0") [-h] [-c \"<command to be executed inside container>\"]"
|
|
echo ''
|
|
echo 'where:'
|
|
echo ' -h show this help text'
|
|
echo ' -c execute a command inside docker using docker exec'
|
|
}
|
|
|
|
if [[ $# -eq 0 ]]; then
|
|
docker exec -it frappe bash
|
|
else
|
|
while getopts ':hc:' option; do
|
|
case "$option" in
|
|
h)
|
|
display_usage
|
|
exit
|
|
;;
|
|
c)
|
|
docker exec frappe bash -c "bench $OPTARG"
|
|
;;
|
|
\?)
|
|
echo "Invalid option: -$OPTARG" >&2
|
|
exit 1
|
|
;;
|
|
:)
|
|
echo "Option -$OPTARG requires an argument." >&2
|
|
exit 1
|
|
;;
|
|
esac
|
|
done
|
|
fi
|