diff --git a/bin/dev b/bin/dev index 2058ecd..9534471 100755 --- a/bin/dev +++ b/bin/dev @@ -17,6 +17,11 @@ init() { DEV_PHP='php70'; + DEV_INTERACTIVE=false; + if [ -t "0" ] && [ -t "1" ]; then + DEV_INTERACTIVE=true; + fi + DEV_SUDO=''; if [ -z "`groups | grep docker`" ]; then DEV_SUDO='sudo'; diff --git a/bin/dev_command/blackfire b/bin/dev_command/blackfire index 4da64bc..50a29f9 100644 --- a/bin/dev_command/blackfire +++ b/bin/dev_command/blackfire @@ -6,7 +6,9 @@ if [ $? -ne 0 ]; then fi dc service blackfireclient; -dc opt '-T'; +if [ ! ${DEV_INTERACTIVE} ]; then + dc opt '-T'; +fi dc opt "--no-deps"; dc cmd blackfire "$@"; diff --git a/bin/dev_command/composer b/bin/dev_command/composer index 29a2042..592218d 100644 --- a/bin/dev_command/composer +++ b/bin/dev_command/composer @@ -1,7 +1,9 @@ dc service ${DEV_PHP}; -dc opt '-T'; dc opt '--no-deps'; +if [ ! ${DEV_INTERACTIVE} ]; then + dc opt '-T'; +fi dc opt "-u $(id -u):$(id -g)" if [ -n "${DEV_PROJECTPATH}" ]; then diff --git a/bin/dev_command/console b/bin/dev_command/console index 4fff54c..0d96c5d 100644 --- a/bin/dev_command/console +++ b/bin/dev_command/console @@ -7,10 +7,13 @@ if [ -n "${DEV_PROJECTPATH}" ]; then dc opt "-w /data/${DEV_PROJECTPATH}" fi -if [ -z "$*" ]; then - # Interactive mode +dc cmd "$@"; +if [ $# -lt 1 ]; then dc cmd bash -l; -else +fi + +if [ ! ${DEV_INTERACTIVE} ]; then dc opt '-T'; - dc cmd "$@"; fi + + diff --git a/bin/dev_command/custom b/bin/dev_command/custom index 528e8b6..d1a6698 100644 --- a/bin/dev_command/custom +++ b/bin/dev_command/custom @@ -2,6 +2,9 @@ dc service ${DEV_PHP}; dc opt "-u $(id -u):$(id -g)" dc opt "--no-deps"; +if [ ! ${DEV_INTERACTIVE} ]; then + dc opt '-T'; +fi if [ -n "${DEV_PROJECTPATH}" ]; then dc opt "-w /data/${DEV_PROJECTPATH}" diff --git a/bin/dev_command/exec b/bin/dev_command/exec index dcb18e1..f413b77 100644 --- a/bin/dev_command/exec +++ b/bin/dev_command/exec @@ -1,5 +1,8 @@ dc mode exec; +if [ ! ${DEV_INTERACTIVE} ]; then + dc opt '-T'; +fi if [ "$1" == "php" ]; then dc service ${DEV_PHP}; diff --git a/bin/dev_command/git b/bin/dev_command/git index 363bd6a..12f537c 100644 --- a/bin/dev_command/git +++ b/bin/dev_command/git @@ -2,6 +2,9 @@ dc service ${DEV_PHP}; dc opt "-u $(id -u):$(id -g)" dc opt '--no-deps'; +if [ ! ${DEV_INTERACTIVE} ]; then + dc opt '-T'; +fi if [ -n "${DEV_PROJECTPATH}" ]; then dc opt "-w /data/${DEV_PROJECTPATH}" diff --git a/bin/dev_command/logs b/bin/dev_command/logs index 3aa8fbf..60ff0ad 100644 --- a/bin/dev_command/logs +++ b/bin/dev_command/logs @@ -1,4 +1,7 @@ dc mode logs; +if [ ! ${DEV_INTERACTIVE} ]; then + dc opt '-T'; +fi dc cmd "$@"; diff --git a/bin/dev_command/magerun b/bin/dev_command/magerun index e9d3889..cf50329 100644 --- a/bin/dev_command/magerun +++ b/bin/dev_command/magerun @@ -2,6 +2,9 @@ dc service ${DEV_PHP}; dc opt "-u $(id -u):$(id -g)" dc opt '--no-deps'; +if [ ! ${DEV_INTERACTIVE} ]; then + dc opt '-T'; +fi if [ -n "${DEV_PROJECTPATH}" ]; then dc opt "-w /data/${DEV_PROJECTPATH}" diff --git a/bin/dev_command/magerun2 b/bin/dev_command/magerun2 index b2d6165..2f82c6d 100644 --- a/bin/dev_command/magerun2 +++ b/bin/dev_command/magerun2 @@ -2,6 +2,9 @@ dc service ${DEV_PHP}; dc opt "-u $(id -u):$(id -g)" dc opt '--no-deps'; +if [ ! ${DEV_INTERACTIVE} ]; then + dc opt '-T'; +fi if [ -n "${DEV_PROJECTPATH}" ]; then dc opt "-w /data/${DEV_PROJECTPATH}" diff --git a/bin/dev_command/myroot b/bin/dev_command/myroot index ce64cde..2728a6c 100644 --- a/bin/dev_command/myroot +++ b/bin/dev_command/myroot @@ -2,6 +2,9 @@ dc yml build/dist/docker-compose-dbclient.yml; dc service dbclient; dc opt '--no-deps'; +if [ ! ${DEV_INTERACTIVE} ]; then + dc opt '-T'; +fi dc cmd mysql "-h db -uroot -p${MYSQL_ROOT_PASSWORD} $@"; diff --git a/bin/dev_command/mysql b/bin/dev_command/mysql index 58a542f..c1ef105 100644 --- a/bin/dev_command/mysql +++ b/bin/dev_command/mysql @@ -2,6 +2,9 @@ dc yml build/dist/docker-compose-dbclient.yml; dc service dbclient; dc opt '--no-deps'; +if [ ! ${DEV_INTERACTIVE} ]; then + dc opt '-T'; +fi dc cmd mysql "-h db -u ${USER} $@"; diff --git a/bin/dev_command/mysqldump b/bin/dev_command/mysqldump index 77b0ae7..3b8c6b9 100644 --- a/bin/dev_command/mysqldump +++ b/bin/dev_command/mysqldump @@ -1,7 +1,9 @@ dc yml build/dist/docker-compose-dbclient.yml; -dc opt '-T'; dc opt '--no-deps'; +if [ ! ${DEV_INTERACTIVE} ]; then + dc opt '-T'; +fi dc service 'dbclient'; dc cmd mysqldump "-h db -u ${USER} $@"; diff --git a/bin/dev_command/mytop b/bin/dev_command/mytop index 1a501f1..00c8b62 100644 --- a/bin/dev_command/mytop +++ b/bin/dev_command/mytop @@ -2,6 +2,9 @@ dc yml build/dist/docker-compose-mytop.yml; dc service mytop; dc opt '--no-deps'; +if [ ! ${DEV_INTERACTIVE} ]; then + dc opt '-T'; +fi dc cmd "-h db -u ${USER} -dinformation_schema $@"; diff --git a/bin/dev_command/php b/bin/dev_command/php index 5f7a23c..7d216a9 100644 --- a/bin/dev_command/php +++ b/bin/dev_command/php @@ -1,7 +1,10 @@ dc service ${DEV_PHP}; -dc opt "-u $(id -u):$(id -g)" dc opt "--no-deps"; +dc opt "-u $(id -u):$(id -g)" +if [ ! ${DEV_INTERACTIVE} ]; then + dc opt '-T'; +fi if [ -n "${DEV_PROJECTPATH}" ]; then dc opt "-w /data/${DEV_PROJECTPATH}" diff --git a/bin/dev_command/run b/bin/dev_command/run index 10e89b7..35463a5 100644 --- a/bin/dev_command/run +++ b/bin/dev_command/run @@ -2,6 +2,9 @@ dc service $1; shift; dc opt '--no-deps'; +if [ ! ${DEV_INTERACTIVE} ]; then + dc opt '-T'; +fi if [ -n "${DEV_PROJECTPATH}" ]; then dc opt "-w /data/${DEV_PROJECTPATH}" diff --git a/bin/dev_command/top b/bin/dev_command/top index cfbe8ea..7ddfbd1 100644 --- a/bin/dev_command/top +++ b/bin/dev_command/top @@ -1,6 +1,9 @@ dc yml build/dist/docker-compose-ctop.yml dc opt '--no-deps'; +if [ ! ${DEV_INTERACTIVE} ]; then + dc opt '-T'; +fi dc service ctop dc cmd -s cpu -f ${DEV_PROJECT}