Compare commits
4 Commits
304e5d2f87
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a033dfbfee | ||
|
|
44b129951e | ||
|
|
d1e6e953d1 | ||
|
|
bbcd4449f2 |
41
_reformat-common.bash
Normal file
41
_reformat-common.bash
Normal file
@@ -0,0 +1,41 @@
|
||||
function root() {
|
||||
echo "$(git rev-parse --show-toplevel)"
|
||||
}
|
||||
|
||||
function sniff_file_type() {
|
||||
ff=$1
|
||||
shift
|
||||
file_type=
|
||||
|
||||
if [[ $ff == *.py ]]; then
|
||||
file_type="python"
|
||||
elif [[ $ff == *.js ]]; then
|
||||
file_type="javascript"
|
||||
elif [[ $ff == *.ts ]]; then
|
||||
file_type="typescript"
|
||||
elif [[ $ff == *.vue ]]; then
|
||||
file_type="vue"
|
||||
elif [[ $ff == *.css ]]; then
|
||||
file_type="css"
|
||||
elif [[ $ff == *.php ]]; then
|
||||
file_type="php"
|
||||
elif [[ $ff == *.html ]]; then
|
||||
file_type="html"
|
||||
elif [[ $ff == *.jsx ]]; then
|
||||
file_type="jsx"
|
||||
elif [[ $ff == *.tsx ]]; then
|
||||
file_type="tsx"
|
||||
elif [[ $ff == *.css ]] ; then
|
||||
file_type="css"
|
||||
elif [[ $ff == *.scss ]] ; then
|
||||
file_type="scss"
|
||||
elif [[ $ff = *.sh ]]; then
|
||||
file_type="sh"
|
||||
elif [[ $ff = *.go ]] ; then
|
||||
file_type="golang"
|
||||
elif [[ $ff = *.dart ]] ; then
|
||||
file_type="dart"
|
||||
fi
|
||||
|
||||
echo $file_type
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
function sniff_file_type() {
|
||||
ff=$1
|
||||
shift
|
||||
file_type=
|
||||
|
||||
if [[ $ff == *.py ]]; then
|
||||
file_type="python"
|
||||
elif [[ $ff == *.js ]]; then
|
||||
file_type="javascript"
|
||||
elif [[ $ff == *.ts ]]; then
|
||||
file_type="typescript"
|
||||
elif [[ $ff == *.vue ]]; then
|
||||
file_type="vue"
|
||||
elif [[ $ff == *.css ]]; then
|
||||
file_type="css"
|
||||
elif [[ $ff == *.php ]]; then
|
||||
file_type="php"
|
||||
elif [[ $ff == *.html ]]; then
|
||||
file_type="html"
|
||||
elif [[ $ff == *.jsx ]]; then
|
||||
file_type="jsx"
|
||||
elif [[ $ff == *.tsx ]]; then
|
||||
file_type="tsx"
|
||||
elif [[ $ff == *.css ]] ; then
|
||||
file_type="css"
|
||||
elif [[ $ff == *.scss ]] ; then
|
||||
file_type="scss"
|
||||
elif [[ $ff = *.sh ]]; then
|
||||
file_type="sh"
|
||||
elif [[ $ff = *.go ]] ; then
|
||||
file_type="golang"
|
||||
elif [[ $ff = *.dart ]] ; then
|
||||
file_type="dart"
|
||||
fi
|
||||
|
||||
echo $file_type
|
||||
}
|
||||
1
_reformat-common.sh
Symbolic link
1
_reformat-common.sh
Symbolic link
@@ -0,0 +1 @@
|
||||
_reformat-common.bash
|
||||
@@ -26,7 +26,7 @@ if [[ $file_type == "javascript" || \
|
||||
retval="$?"
|
||||
success_retval=0
|
||||
elif [[ $file_type == "python" ]]; then
|
||||
out=$(pipx run black $file 2>/dev/null && pipx run isort $file 2>/dev/null)
|
||||
out=$(pipx run black $file 2>/dev/null && pipx run isort --profile black $file 2>/dev/null)
|
||||
retval="$?"
|
||||
success_retval=0
|
||||
elif [[ $file_type == "golang" ]] ; then
|
||||
|
||||
@@ -29,7 +29,7 @@ if [[ $file_type = "javascript" || \
|
||||
syntax_error_retval=2
|
||||
elif [[ $file_type == "python" ]]; then
|
||||
|
||||
out=$(pipx run isort --check $file 2>/dev/null)
|
||||
out=$(pipx run isort --profile black --check $file 2>/dev/null)
|
||||
isort_retval="$?"
|
||||
|
||||
success_retval=0
|
||||
|
||||
Reference in New Issue
Block a user