mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-10-14 12:05:03 +00:00
contrib: better autotect python files to format for "nm-python-black-format.sh" script
This commit is contained in:
parent
4e28bd5a94
commit
f3be419719
|
@ -29,13 +29,6 @@ fi
|
||||||
|
|
||||||
OLD_IFS="$IFS"
|
OLD_IFS="$IFS"
|
||||||
|
|
||||||
IFS=$'\n'
|
|
||||||
FILES=( $(git ls-tree --name-only -r HEAD | grep '\.py$') )
|
|
||||||
IFS="$OLD_IFS"
|
|
||||||
FILES+=(
|
|
||||||
"examples/python/gi/nm-wg-set"
|
|
||||||
)
|
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
printf "Usage: %s [OPTION]...\n" "$(basename "$0")"
|
printf "Usage: %s [OPTION]...\n" "$(basename "$0")"
|
||||||
printf "Reformat python source files using python black.\n\n"
|
printf "Reformat python source files using python black.\n\n"
|
||||||
|
@ -77,6 +70,13 @@ while (( $# )); do
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
IFS=$'\n'
|
||||||
|
FILES=()
|
||||||
|
FILES+=( $(git ls-tree --name-only -r HEAD | grep '\.py$') )
|
||||||
|
FILES+=( $(git grep -l '#!.*\<p[y]thon3\?\>') )
|
||||||
|
FILES=( $(printf "%s\n" "${FILES[@]}" | sort -u) )
|
||||||
|
IFS="$OLD_IFS"
|
||||||
|
|
||||||
if [ $SHOW_FILENAMES = 1 ]; then
|
if [ $SHOW_FILENAMES = 1 ]; then
|
||||||
printf '%s\n' "${FILES[@]}"
|
printf '%s\n' "${FILES[@]}"
|
||||||
exit 0
|
exit 0
|
||||||
|
|
Loading…
Reference in a new issue