timo_moulinette

This commit is contained in:
Timo Schmidt 2023-03-28 14:22:38 +02:00
parent 34224276c6
commit 3b4068fac9
1 changed files with 4 additions and 4 deletions

View File

@ -12,9 +12,9 @@ alias watch='watch -cn.1'
alias push='git push origin master; git push gitea master' alias push='git push origin master; git push gitea master'
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'
jmp () { jmp () {
cd "$(find . -name "${1}" -print -quit)" cd "$(find . -name "${1}" -not -wholename "*mouli*" -print -quit)"
if [ "${?}" = "0" ]; then if [ "${?}" = "0" ]; then
cd "$(find .. -name "${1}" -print -quit)" cd "$(find .. -name "${1}" -not -wholename "*mouli*" -print -quit)"
fi fi
} }
@ -124,7 +124,7 @@ timo_moulinette () {
git_base="https://git.timo.one/42berlin/piscine-timo-moulinette/raw/branch/master" git_base="https://git.timo.one/42berlin/piscine-timo-moulinette/raw/branch/master"
# Find the first C file # Find the first C file
file_name="$(find . -mindepth 1 -maxdepth 1 -name '*.c' ! -name '*moulinette*' -type f -exec basename {} \; -quit)" file_name="$(find . -mindepth 1 -maxdepth 1 -name '*.c' -not -name '*mouli*' -type f -exec basename {} \; -quit)"
# If no C files found, exit # If no C files found, exit
if [ -z "${file_name}" ]; then if [ -z "${file_name}" ]; then
@ -148,7 +148,7 @@ timo_moulinette () {
${CC} -dD -E -o "${file_name}.nocomments" -- "${file_name}" ${CC} -dD -E -o "${file_name}.nocomments" -- "${file_name}"
# Extract function definitions from preprocessed file and append semicolon # Extract function definitions from preprocessed file and append semicolon
prototypes="$(cat -- "${file_name}.nocomments" | grep -v '#' | grep ')$' | grep '[a-zA-Z0-9](' | grep -v 'int[[:space:]]\+main(' | sed 's/$/;/')" prototypes="$(cat -- "${file_name}.nocomments" | grep -v '#' | grep ')$' | grep -v ' (' | grep -v ' ' | grep '[a-zA-Z0-9](' | grep -v 'int[[:space:]]\+main(' | sed 's/$/;/')"
# Extract macros from file (ignore the ones with line continuations) # Extract macros from file (ignore the ones with line continuations)
macros="$(cat -- "${file_name}" | grep '^#' | grep -v '\\$')" macros="$(cat -- "${file_name}" | grep '^#' | grep -v '\\$')"