2017-08-28 10:11:09 +00:00
|
|
|
#!/usr/bin/env bash
|
2017-10-02 04:02:03 +00:00
|
|
|
|
2017-08-28 10:11:09 +00:00
|
|
|
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'
|
|
|
|
}
|
2017-10-02 04:02:03 +00:00
|
|
|
|
|
|
|
if [[ $# -eq 0 ]]; then
|
2017-08-28 10:11:09 +00:00
|
|
|
docker exec -it frappe bash
|
2017-10-02 04:02:03 +00:00
|
|
|
else
|
|
|
|
while getopts ':hc:' option; do
|
|
|
|
case "$option" in
|
2017-08-28 10:11:09 +00:00
|
|
|
h)
|
|
|
|
display_usage
|
2017-10-02 04:02:03 +00:00
|
|
|
exit
|
|
|
|
;;
|
2017-08-28 10:11:09 +00:00
|
|
|
c)
|
|
|
|
docker exec frappe bash -c "bench $OPTARG"
|
2017-10-02 04:02:03 +00:00
|
|
|
;;
|
2017-08-28 10:11:09 +00:00
|
|
|
\?)
|
|
|
|
echo "Invalid option: -$OPTARG" >&2
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
:)
|
|
|
|
echo "Option -$OPTARG requires an argument." >&2
|
|
|
|
exit 1
|
|
|
|
;;
|
2017-10-02 04:02:03 +00:00
|
|
|
esac
|
|
|
|
done
|
|
|
|
fi
|