Automatic add
This commit is contained in:
parent
4eb338bc82
commit
f9ca2c81b7
82
.bashrc
82
.bashrc
|
@ -14,8 +14,56 @@ alias push='git push origin master ; git push gitea master'
|
||||||
alias francinette=/nfs/homes/tischmid/francinette/tester.sh
|
alias francinette=/nfs/homes/tischmid/francinette/tester.sh
|
||||||
alias paco=/nfs/homes/tischmid/francinette/tester.sh
|
alias paco=/nfs/homes/tischmid/francinette/tester.sh
|
||||||
alias norm='alacritty -e sh -c '\''git rev-parse --show-toplevel || { echo "Exiting in 5" ; sleep 1 ; echo "Exiting in 4" ; sleep 1 ; echo "Exiting in 3" ; sleep 1 ; echo "Exiting in 2" ; sleep 1 ; echo "Exiting in 1" ; sleep 1 ; } && cd "$(git rev-parse --show-toplevel)" && watch -cn.5 date \&\& norminette -R CheckForbiddenSourceHeader'\'' & disown'
|
alias norm='alacritty -e sh -c '\''git rev-parse --show-toplevel || { echo "Exiting in 5" ; sleep 1 ; echo "Exiting in 4" ; sleep 1 ; echo "Exiting in 3" ; sleep 1 ; echo "Exiting in 2" ; sleep 1 ; echo "Exiting in 1" ; sleep 1 ; } && cd "$(git rev-parse --show-toplevel)" && watch -cn.5 date \&\& norminette -R CheckForbiddenSourceHeader'\'' & disown'
|
||||||
# alias zellij='zellij options --disable-mouse-mode'
|
alias AH='cd /nfs/homes/tischmid/repos/42cursus/libft'
|
||||||
alias z='zellij'
|
alias z='\zellij options --disable-mouse-mode'
|
||||||
|
alias zellij='\zellij options --disable-mouse-mode'
|
||||||
|
|
||||||
|
__ftest_file () {
|
||||||
|
file="${1}"
|
||||||
|
tmp_dir="${2}"
|
||||||
|
|
||||||
|
test_file_name="$($(type -P basename) -- "${file%.c}_test.c")"
|
||||||
|
test_file="$(find "${tmp_dir}" -name "${test_file_name}" -type f)"
|
||||||
|
if [ -z "${test_file}" ]; then
|
||||||
|
printf '\033[31m%s\033[m\n' "No test file for file '${file}'"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
${test_file}
|
||||||
|
}
|
||||||
|
|
||||||
|
ftest () {
|
||||||
|
err="0"
|
||||||
|
if [ -z "${tmp_dir}" ]; then
|
||||||
|
tmp_dir="$(mktemp -dt -- '42tests-tischmid.XXXXXXXX')"
|
||||||
|
git clone --quiet 'https://git.timo.one/42berlin/42tests-tischmid.git' "${tmp_dir}"
|
||||||
|
fi
|
||||||
|
if [ -z "${@}" ]; then
|
||||||
|
for file in $(find . -mindepth 1 -type f -name '*.c'); do
|
||||||
|
__ftest_file "${file}" "${tmp_dir}" || err="1"
|
||||||
|
done
|
||||||
|
else
|
||||||
|
while [ -z "${1}" ]; do
|
||||||
|
if [ -f "${1}" ]; then
|
||||||
|
__ftest_file "${1}" "${tmp_dir}" || err="1"
|
||||||
|
else
|
||||||
|
printf '\033[31m%s\033[m\n' "File ${1} does not exist"
|
||||||
|
fi
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
rm -rf -- "/tmp/42tests-tischmid.*"
|
||||||
|
unset -v -- "tmp_dir"
|
||||||
|
return -- "${err}"
|
||||||
|
}
|
||||||
|
|
||||||
|
dapt () {
|
||||||
|
ACTION="${1}"
|
||||||
|
shift
|
||||||
|
CMD="RUN apt ${ACTION} -yy ${@}"
|
||||||
|
echo "${CMD}" >> ~/repos-other/docker/Dockerfile
|
||||||
|
docker build -t ubuntu-bloated ~/repos-other/docker/
|
||||||
|
docker rmi $(docker images -f "dangling=true" -q) 2>/dev/null
|
||||||
|
}
|
||||||
|
|
||||||
norminette () {
|
norminette () {
|
||||||
version="$($(type -P norminette) -v | cut -d" " -f2)"
|
version="$($(type -P norminette) -v | cut -d" " -f2)"
|
||||||
|
@ -83,27 +131,27 @@ fi
|
||||||
|
|
||||||
check () {
|
check () {
|
||||||
# Set params
|
# Set params
|
||||||
URL="${1}"
|
URL="${1}"
|
||||||
DIR="/tmp/tmp_repo_$(date +%s)"
|
DIR="/tmp/tmp_repo_$(date +%s)"
|
||||||
|
|
||||||
# If no URL, get it from current repo
|
# If no URL, get it from current repo
|
||||||
if [ -z "${URL}" ] ; then
|
if [ -z "${URL}" ] ; then
|
||||||
URL="$(git remote get-url origin)"
|
URL="$(git remote get-url origin)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Clone in temp folder
|
# Clone in temp folder
|
||||||
git clone --quiet "${URL}" "${DIR}"
|
git clone --quiet "${URL}" "${DIR}"
|
||||||
|
|
||||||
# Only proceed if clone success
|
# Only proceed if clone success
|
||||||
if [ -d "${DIR}" ] ; then
|
if [ -d "${DIR}" ] ; then
|
||||||
# Check the norm and print beautiful message
|
# Check the norm and print beautiful message
|
||||||
norminette -R CheckForbiddenSourceHeader "${DIR}" && printf '\033[30;102m%s\033[m\n' "Norminette success" || printf '\033[30;101m%s\033[m\n' "Norminette fail!!!"
|
norminette -R CheckForbiddenSourceHeader "${DIR}" && printf '\033[30;102m%s\033[m\n' "Norminette success" || printf '\033[30;101m%s\033[m\n' "Norminette fail!!!"
|
||||||
|
|
||||||
# Remove temp folder
|
# Remove temp folder
|
||||||
rm -rf "${DIR}"
|
rm -rf "${DIR}"
|
||||||
else
|
else
|
||||||
printf '\033[30;101m%s\033[m\n' "Could not clone the repo"
|
printf '\033[30;101m%s\033[m\n' "Could not clone the repo"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
safe_guard_name () {
|
safe_guard_name () {
|
||||||
|
@ -223,7 +271,7 @@ timoulinette () {
|
||||||
printf '%s\n' "Could not compile. Exiting"
|
printf '%s\n' "Could not compile. Exiting"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Delete testfile
|
# Delete testfile
|
||||||
if [ "$(printf '%s' "${extras}" | sed 's/keep-test//g')" = "${extras}" ] ; then
|
if [ "$(printf '%s' "${extras}" | sed 's/keep-test//g')" = "${extras}" ] ; then
|
||||||
rm -f -- "${download_file_name}"
|
rm -f -- "${download_file_name}"
|
||||||
|
@ -284,3 +332,5 @@ clone42 () {
|
||||||
printf '%s\n' "Could not clone repo!"
|
printf '%s\n' "Could not clone repo!"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export MAIL='timo42@proton.me'
|
||||||
|
|
Loading…
Reference in New Issue