diff --git a/sync.sh b/sync.sh index c88a600..c452eb1 100755 --- a/sync.sh +++ b/sync.sh @@ -1,27 +1,39 @@ #!/bin/bash if [[ $# -eq 0 ]] ; then - echo "Missing arguments. Please specify 'up' or 'down'."; + printf "Available commands:\n"; + printf " install\t\t Installs docker-sync gem on the host machine.\n"; + printf " up \t Starts docker-sync and runs docker compose.\n"; + printf " down \t\t Stops containers and docker-sync.\n"; + printf " trigger \t\t Manually triggers the synchronization of files.\n"; + printf " clean \t\t Removes all synched files from docker-sync container.\n"; exit 1 fi if [ "$1" == "up" ] ; then - echo "Initializing Docker Sync (may take several minutes the first time)"; + printf "Initializing Docker Sync (may take several minutes the first time)"; docker-sync start; - echo "Initializing Docker Compose"; + printf "Initializing Docker Compose"; shift; # removing first argument docker-compose -f docker-compose.yml -f docker-compose.sync.yml up -d ${@}; + elif [ "$1" == "down" ]; then - echo "Stopping Docker Compose"; + printf "Stopping Docker Compose"; docker-compose down; - echo "Stopping Docker Sync"; + printf "Stopping Docker Sync"; docker-sync stop; + elif [ "$1" == "install" ]; then - echo "Installing docker-sync"; + printf "Installing docker-sync"; gem install docker-sync; -elif [ "$1" == "sync" ]; then + +elif [ "$1" == "trigger" ]; then + printf "Manually triggering sync between host and docker-sync container."; docker-sync sync; + elif [ "$1" == "clean" ]; then + printf "Removing and cleaning up files from the docker-sync container."; docker-sync clean; + else - echo "Invalid argument. Use 'up','down','install','sync' or 'clean' "; + printf "Invalid argument. Use 'up','down','install','trigger' or 'clean' "; fi