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