From cb4e4832a176b8edac14afdd99e57de312e562f9 Mon Sep 17 00:00:00 2001 From: Colby Gutierrez-Kraybill <colbygk@media.mit.edu> Date: Tue, 21 Aug 2018 11:46:18 -0400 Subject: [PATCH] Make docker_config.sh a little smarter about usage --- bin/docker_config.sh | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/bin/docker_config.sh b/bin/docker_config.sh index 2e3a5ad..a849904 100755 --- a/bin/docker_config.sh +++ b/bin/docker_config.sh @@ -1,5 +1,22 @@ +#!/bin/bash + NETWORK_NAME=scratchapi_scratch_network -if [ -z $(docker network ls --filter name=^${NETWORK_NAME}$ --format="{{ .Name }}") ] ; then - docker network create ${NETWORK_NAME} ; -fi +command=$1 +shift +arg=$1 +shift + +case "$command" in +network) + if [ -z $(docker network ls --filter name=^${NETWORK_NAME}$ --format="{{ .Name }}") ] ; then + docker network create ${NETWORK_NAME} ; + fi + ;; +*) + echo "usage:" + echo " docker_config.sh <command> <arg>" + echo "" + echo " Currently only performs 'docker_config.sh network create'" + ;; +esac