Skip to content

Commit 9d036e7

Browse files
committed
Set screen size in docker-compose
1 parent 97aa530 commit 9d036e7

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

scripts/itkdev-docker-compose

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -284,16 +284,21 @@ fi
284284
docker_compose () {
285285
local command="$1"
286286
shift
287-
local command_options=""
287+
local command_options=()
288288

289289
# We must pass "-T" to docker-compose exec when piping input
290290
if [ "$command" = "exec" ] && [ ! -t 0 ]; then
291-
command_options="-T"
291+
command_options+=(-T)
292+
fi
293+
294+
# Set screen size
295+
if [[ "$command" =~ exec|run ]]; then
296+
command_options+=(-e COLUMNS=$(tput cols) -e LINES=$(tput lines))
292297
fi
293298

294299
# Note: Apparently, using --project-directory or --file options for `docker-compose` will break use of `$PWD` in
295300
# docker-compose.yml. Therefore, we `cd` before running `docker-compose` command.
296-
(cd "$docker_compose_dir" && COMPOSE_DOMAIN=${COMPOSE_DOMAIN} docker-compose "$command" $command_options "$@")
301+
(cd "$docker_compose_dir" && COMPOSE_DOMAIN=${COMPOSE_DOMAIN} docker-compose "$command" ${command_options[@]:+${command_options[@]}} "$@")
297302
}
298303

299304
cmd="$1"

0 commit comments

Comments
 (0)