Skip to content

Commit 471ab57

Browse files
committed
Added service and port options to url command
1 parent 93cf4f7 commit 471ab57

File tree

1 file changed

+25
-5
lines changed

1 file changed

+25
-5
lines changed

scripts/itkdev-docker-compose

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,10 @@ Usage: itkdev-docker-compose command [command arguments]
113113
114114
Commands:
115115
116-
url
117-
Print url to site
116+
url [service [port]]
117+
Print url to site or a service
118118
119-
open
119+
open [service [port]]
120120
Open url in default browser
121121
122122
drush
@@ -289,11 +289,31 @@ shift
289289

290290
case "$cmd" in
291291
url)
292-
echo http://${COMPOSE_DOMAIN}
292+
domain=${COMPOSE_DOMAIN}
293+
if [ "$#" -gt 0 ]; then
294+
service="$1"
295+
port=80
296+
297+
shift
298+
if [ "$#" -gt 0 ]; then
299+
port="$1"
300+
shift
301+
fi
302+
303+
domain=$(docker_compose port $service $port)
304+
if [ $? -ne 0 ]; then
305+
exit 1
306+
elif [ -z "$domain" ]; then
307+
(>&2 echo "Cannot find domain for service $service (port: $port)")
308+
exit 1
309+
fi
310+
fi
311+
312+
echo http://$domain
293313
;;
294314

295315
open)
296-
open $($script_path url)
316+
open $($script_path url "$@")
297317
;;
298318

299319
sync)

0 commit comments

Comments
 (0)