switch to python3 + support fichier destination
This commit is contained in:
+15
-28
@@ -1,31 +1,18 @@
|
|||||||
#!/bin/bash
|
#!/usr/bin/python3
|
||||||
BOLD=`tput bold`
|
import subprocess
|
||||||
RED=`tput setaf 1`
|
import sys
|
||||||
GREEN=`tput setaf 2`
|
|
||||||
GREENBOLD=$BOLD$GREEN
|
|
||||||
REDBOLD=$BOLD$RED
|
|
||||||
RESET=`tput init`
|
|
||||||
|
|
||||||
|
banned=["console.log", "<<<< HEAD"]
|
||||||
|
|
||||||
git diff --staged | grep -v ^- | grep "console.log" 2> /dev/null 1> /dev/null
|
triggred=0
|
||||||
if [ $? = 0 ]
|
result = subprocess.run(['git', 'diff', '--staged'], stdout=subprocess.PIPE)
|
||||||
then
|
diff = result.stdout.decode("utf-8")
|
||||||
echo "${REDBOLD}/!\\Console.log detected /!\\"
|
files = diff.split("diff --git a/")
|
||||||
echo "${REDBOLD}aborting..."
|
for file in files:
|
||||||
exit 1
|
for check in banned:
|
||||||
else
|
if check in file:
|
||||||
echo "${GREENBOLD} No console.log"
|
print(check + " detected in:")
|
||||||
fi
|
print(file.split("\n")[0].split(" b/")[0])
|
||||||
|
triggred=1
|
||||||
|
|
||||||
git diff --staged | grep -v ^- | grep "<<<<<<< HEAD" 2> /dev/null 1> /dev/null
|
sys.exit(triggred)
|
||||||
if [ $? = 0 ]
|
|
||||||
then
|
|
||||||
echo "${REDBOLD}/!\\ UNRESOLVED MERGE DETECTED /!\\"
|
|
||||||
echo "${REDBOLD}aborting..."
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
echo "${GREENBOLD} No unresolved merge"
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
echo $RESET
|
|
||||||
|
|||||||
Reference in New Issue
Block a user