diff --git a/.atom-build.yml b/.atom-build.yml new file mode 100644 index 0000000..d20a211 --- /dev/null +++ b/.atom-build.yml @@ -0,0 +1,5 @@ +cmd: './podmanRun -o "--name=bash_{FILE_ACTIVE_NAME_BASE} -v={FILE_ACTIVE_PATH}:{FILE_ACTIVE_PATH}:z -w={FILE_ACTIVE_PATH} ubuntu:latest" test.sh "hello world!"' +name: 'Test podmanRun' +targets: + Test podmanRun w/ debug: + cmd: './podmanRun --debug -o "--name=bash_{FILE_ACTIVE_NAME_BASE} -v={FILE_ACTIVE_PATH}:{FILE_ACTIVE_PATH}:z -w={FILE_ACTIVE_PATH} ubuntu:latest" test.sh "hello world!"' diff --git a/README.md b/README.md new file mode 100644 index 0000000..2cf4b57 --- /dev/null +++ b/README.md @@ -0,0 +1,41 @@ +``` +USAGE + podmanRun [-m MODE] [-o OPTIONS] [COMMANDS [ARGS]...] [--help] [--debug] + +COMMANDS + COMMANDS to run in the container + +OPTIONS + --mode, -m MODE + 1. recreate (remove container if it already exists and create a new one) + 2. persistent (reuse existing container if it exists) + --options, -o OPTIONS + OPTIONS to pass to podman run/exec + Can be passed multiple times to concatenate + Will be split on whitespace + Final option should be the name of the container image + --debug, -d + Print debugging + --help, -h + Print this help message and exit + +EXAMPLES + Note: IDE examples are using Atom Build package placeholders. + + Run an ephemeral PHP webserver container using the current directory as webroot: + podmanRun -o "-p=8000:80 --name=php_script -v=$PWD:/var/www/html:z php:7.3-apache" + + Run an ephemeral PHP webserver container using the current directory as webroot using IDE: + podmanRun -o "-p=8000:80 --name=php_{FILE_ACTIVE_NAME_BASE} \ + -v={FILE_ACTIVE_PATH}:/var/www/html:z php:7.3-apache" + + Run an ephemeral bash script: + podmanRun -o "--name=bash_script -v=$PWD:$PWD:z -w=$PWD debian:testing" ./script.sh + + Run an ephemeral bash script using IDE: + podmanRun -o "--name=bash_{FILE_ACTIVE_NAME_BASE}" \ + -o "-v={FILE_ACTIVE_PATH}:{FILE_ACTIVE_PATH}:z" + -o "-w={FILE_ACTIVE_PATH}" \ + -o "debian:testing" \ + {FILE_ACTIVE} arg1 arg2 +``` diff --git a/podmanRun b/podmanRun index e31ce52..9eb246d 100755 --- a/podmanRun +++ b/podmanRun @@ -31,7 +31,7 @@ podmanRun() { if [[ -z $_debug ]]; then cat <<-'EOF' USAGE - podmanRun -m MODE -o OPTIONS [COMMANDS [ARGS]...] [--help] [--debug] + podmanRun [-m MODE] [-o OPTIONS] [COMMANDS [ARGS]...] [--help] [--debug] COMMANDS COMMANDS to run in the container @@ -43,6 +43,7 @@ OPTIONS --options, -o OPTIONS OPTIONS to pass to podman run/exec Can be passed multiple times to concatenate + Will be split on whitespace Final option should be the name of the container image --debug, -d Print debugging @@ -54,11 +55,14 @@ EXAMPLES Run an ephemeral PHP webserver container using the current directory as webroot: podmanRun -o "-p=8000:80 --name=php_script -v=$PWD:/var/www/html:z php:7.3-apache" + Run an ephemeral PHP webserver container using the current directory as webroot using IDE: podmanRun -o "-p=8000:80 --name=php_{FILE_ACTIVE_NAME_BASE} \ -v={FILE_ACTIVE_PATH}:/var/www/html:z php:7.3-apache" + Run an ephemeral bash script: podmanRun -o "--name=bash_script -v=$PWD:$PWD:z -w=$PWD debian:testing" ./script.sh + Run an ephemeral bash script using IDE: podmanRun -o "--name=bash_{FILE_ACTIVE_NAME_BASE}" \ -o "-v={FILE_ACTIVE_PATH}:{FILE_ACTIVE_PATH}:z" diff --git a/test.sh b/test.sh new file mode 100755 index 0000000..8629c24 --- /dev/null +++ b/test.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +echo "$@"