From 93bea147ce430b7f4a4fe71190668c09853c1fa5 Mon Sep 17 00:00:00 2001 From: "Michael Bradley, Jr" Date: Tue, 24 Jul 2018 22:27:03 -0500 Subject: [PATCH] shortcuts --- README.md | 37 +++++++++++++++++++++++++++++++++---- run.sh | 13 ++++++++++--- 2 files changed, 43 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 9dd2516..7a4692d 100644 --- a/README.md +++ b/README.md @@ -5,9 +5,9 @@ In a Bash shell: ``` shell source <(curl 'https://raw.githubusercontent.com/embark-framework/embark-docker/master/run.sh') -run_embark_docker embark demo +run_embark demo cd embark_demo -run_embark_docker +run_embark ``` With overrides: @@ -28,13 +28,42 @@ docker build \ $EMBARK_DOCKERFILE source <(curl $RUNNER) -run_embark_docker embark demo +run_embark demo cd embark_demo -run_embark_docker +run_embark ``` Review the [Dockerfile](https://github.com/embark-framework/embark-docker/blob/master/Dockerfile) and [run.sh](https://github.com/embark-framework/embark-docker/blob/master/run.sh#L66-L70) for all possible overrides. +### Shortcuts + +The following are equivalent: + +``` shell +run_embark demo +``` +``` shell +run_embark embark demo +``` + +These are also equivlent: + +``` shell +run_embark +``` +``` shell +run_embark embark run +``` + +Other `embark` commands and non-embark commands should be indicated explicitly: + +``` shell +run_embark embark version +``` +``` shell +run_embark ps -ef +``` + ## Updating versions * Open `Dockerfile` diff --git a/run.sh b/run.sh index b53b09d..68e0816 100755 --- a/run.sh +++ b/run.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -run_embark_docker () { +run_embark () { local oldopts="" case $- in *e*) oldopts="set -e";; @@ -69,6 +69,13 @@ run_embark_docker () { local EMBARK_DOCKER_IMAGE=${EMBARK_DOCKER_IMAGE:-statusim/embark} local EMBARK_DOCKER_TAG=${EMBARK_DOCKER_TAG:-latest} + local -a cmd= + if [[ "$1" = "demo" ]]; then + cmd=( $(echo "embark $@") ) + else + cmd=( $(echo "$@") ) + fi + docker run \ -it \ -p 5001:5001 \ @@ -85,7 +92,7 @@ run_embark_docker () { -e TERM \ "${EMBARK_DOCKER_EXTRA_RUN_OPTS}" \ ${EMBARK_DOCKER_IMAGE}:${EMBARK_DOCKER_TAG} \ - "$@" + "${cmd[@]}" local docker_exit_status=$? @@ -103,5 +110,5 @@ run_embark_docker () { } if [[ "$0" = "$BASH_SOURCE" ]]; then - run_embark_docker "$@" + run_embark "$@" fi