X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/4d6a84a8294d035747404d00b88a925fc2640e1e..303a0b2c4d0c828ba6cd4ef6d480f1ff2b5a11c6:/action/entrypoint.sh?ds=inline 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[*]}"