All patches and comments are welcome. Please squash your changes to logical
commits before using git-format-patch and git-send-email to
patches@git.madduck.net.
If you'd read over the Git project's submission guidelines and adhered to them,
I'd be especially grateful.
* Gets gh-action ready for marketplace release
* Updates documentation and removes redundant gh-action input argument
* Fixes gh-action bug
This commit fixes a bug which caused not all input arguments were forwarder to the black formatter.
* Update README.md
Co-authored-by: Cooper Lees <me@cooperlees.com>
Co-authored-by: Cooper Lees <me@cooperlees.com>
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: psf/black@stable
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: psf/black@stable
+ with:
+ black_args: ". --check"
+### Inputs
+
+#### `black_args`
+
+**optional**: Black input arguments. Defaults to `. --check --diff`.
+
## Ignoring unmodified files
_Black_ remembers files it has already formatted, unless the `--diff` flag is used or
## Ignoring unmodified files
_Black_ remembers files it has already formatted, unless the `--diff` flag is used or
name: "Black"
description: "The uncompromising Python code formatter."
author: "Łukasz Langa and contributors to Black"
name: "Black"
description: "The uncompromising Python code formatter."
author: "Łukasz Langa and contributors to Black"
+inputs:
+ black_args:
+ description: "Black input arguments."
+ required: false
+ default: ""
branding:
color: "black"
icon: "check-circle"
branding:
color: "black"
icon: "check-circle"
-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+=($*)
- # Custom args.
- sh -c "black $*"
+ # Default (if no args provided).
+ black_args+=("--check" "--diff")
+
+sh -c "black . ${black_args[*]}"