X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/4d6a84a8294d035747404d00b88a925fc2640e1e..9eb29a6d4733c0e467ba5c1c54361f097cc1c305:/action/entrypoint.sh diff --git a/action/entrypoint.sh b/action/entrypoint.sh index dc86fa1..50f9472 100755 --- a/action/entrypoint.sh +++ b/action/entrypoint.sh @@ -1,10 +1,17 @@ -#!/bin/sh +#!/bin/bash set -e -if [ $# -eq 0 ]; then - # Default (if no args provided). - sh -c "black . --check --diff" +# If no arguments are given use current working directory +black_args=(".") +if [ "$#" -eq 0 ] && [ "${INPUT_BLACK_ARGS}" != "" ]; then + black_args+=(${INPUT_BLACK_ARGS}) +elif [ "$#" -ne 0 ] && [ "${INPUT_BLACK_ARGS}" != "" ]; then + black_args+=($* ${INPUT_BLACK_ARGS}) +elif [ "$#" -ne 0 ] && [ "${INPUT_BLACK_ARGS}" == "" ]; then + black_args+=($*) else - # Custom args. - sh -c "black $*" + # Default (if no args provided). + black_args+=("--check" "--diff") fi + +sh -c "black . ${black_args[*]}"