diff --git a/Dockerfile b/Dockerfile index 667a610..3988012 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,11 +15,11 @@ ENTRYPOINT ["/python/entrypoint.sh"] # Add convenient aliases # Install python packages -RUN echo "#!/bin/bash\n/python/entrypoint.sh startapp" >> /bin/startapp && chmod a+x /bin/startapp \ - && echo "#!/bin/bash\n/python/entrypoint.sh developapp" >> /bin/developapp && chmod a+x /bin/developapp \ - && echo "#!/bin/bash\n/python/entrypoint.sh validatecode" >> /bin/validatecode && chmod a+x /bin/validatecode \ - && echo "#!/bin/bash\n/python/entrypoint.sh validatecodeonce" >> /bin/validatecodeonce && chmod a+x /bin/validatecodeonce \ - && echo "#!/bin/bash\n/python/entrypoint.sh runtests" >> /bin/runtests && chmod a+x /bin/runtests +RUN echo "#!/bin/bash\n/python/entrypoint.sh startapp \$@" >> /bin/startapp && chmod a+x /bin/startapp \ + && echo "#!/bin/bash\n/python/entrypoint.sh developapp \$@" >> /bin/developapp && chmod a+x /bin/developapp \ + && echo "#!/bin/bash\n/python/entrypoint.sh validatecode \$@" >> /bin/validatecode && chmod a+x /bin/validatecode \ + && echo "#!/bin/bash\n/python/entrypoint.sh validatecodeonce \$@" >> /bin/validatecodeonce && chmod a+x /bin/validatecodeonce \ + && echo "#!/bin/bash\n/python/entrypoint.sh runtests \$@" >> /bin/runtests && chmod a+x /bin/runtests # Change users USER python diff --git a/README.md b/README.md index c3d2392..2f4c937 100644 --- a/README.md +++ b/README.md @@ -116,6 +116,16 @@ plugin. This code validation command executes the `/python/test_suite.sh` script which can be overwritten with custom code validation. +Options:\ +`-h` Print help menu. +``` +validatecode -h +``` +`-k` Invoke Pytest option `-k` to run specific tests based on a substring match to the test name. +``` +validatecode -k test_get_products +``` + ### `validatecodeonce` Same as `validatecode` but executed once rather than continously running on diff --git a/entrypoint.sh b/entrypoint.sh index f879636..71e2af0 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -45,10 +45,29 @@ developapp() { validatecode() { + help() { + echo + echo "Usage: validatecode [-h|k]" + echo + echo "Automatically run code validation whenever the code changes." + echo + echo "Options:" + echo "h Print this help menu." + echo "k Invoke Pytest option -k to run specific tests based on a substring match to the test name." + echo + } + + while getopts ":h" option; do + case $option in + h) + help + exit;; + esac + done + echo -e "\nREADY TO RUN THE CODE VALIDATION SUITE\nSave a python file to trigger the checks." - loadconfig - watchmedo shell-command --patterns="*.py;*.txt" --recursive --command="/python/test_suite.sh" --drop . + watchmedo shell-command --patterns="*.py;*.txt" --recursive --command="/python/test_suite.sh \$@" --drop . } validatecodeonce() {