Compare commits

...

2 commits

Author SHA1 Message Date
5f217de747 bash: move ghist to scripts
Signed-off-by: Michael Grote <michael.grote@posteo.de>
2024-06-05 20:11:16 +02:00
4578a05a00 ci: remove ci
Signed-off-by: Michael Grote <michael.grote@posteo.de>
2024-06-05 20:07:18 +02:00
4 changed files with 43 additions and 70 deletions

View file

@ -104,49 +104,3 @@ function gp {
function mdtoc {
grep --recursive --include="*.md" ^# | sort --version-sort --field-separator=":" | awk 'BEGIN {FS=":"}{print $2 "&&" $1}' | column --table --separator "&&" --table-truncate 1,2
}
# "scrolle" durch die commit-history
ghist() {
# shellcheck disable=2155
local total_commits=$(git rev-list HEAD --count)
local current_commit=$total_commits
show_commit_diff() {
if [ "$current_commit" -le "$total_commits" ] && [ "$current_commit" -ge 1 ]; then
# shellcheck disable=2155
local commit_hash=$(git rev-list --reverse HEAD | sed -n "${current_commit}p")
git --no-pager show "$commit_hash"
fi
}
while true; do
clear # Clear the terminal
show_commit_diff
# Display navigation options
echo "-----------------------------------------------------------"
echo "Navigation: N - Next Commit, P - Previous Commit, Q - Quit"
echo "-----------------------------------------------------------"
read -r -n1 -s option
case $option in
p|P)
# shellcheck disable=2086
if [ $current_commit -gt 1 ]; then
((current_commit--))
fi
;;
n|N)
# shellcheck disable=2086
if [ $current_commit -lt $total_commits ]; then
((current_commit++))
fi
;;
q|Q)
break
;;
*)
echo "Invalid option"
;;
esac
done
}

View file

@ -1,24 +0,0 @@
---
steps:
gitleaks:
image: zricethezav/gitleaks:v8.18.2
commands:
- gitleaks detect --no-git --verbose --source $CI_WORKSPACE
when:
- event: [push, pull_request]
evaluate: 'CI_COMMIT_AUTHOR_EMAIL != "renovate@mgrote.net"'
shellcheck:
image: "koalaman/shellcheck-alpine:v0.10.0"
commands:
- |
find . -type f -not -path './.git/*' -exec file {} \; | while IFS= read -r line; do
if echo "$line" | grep -q "shell script"; then
file_path=$(echo "$line" | awk -F':' '{print $1}')
shellcheck "$file_path"
fi
done
when:
- event: [push, pull_request]
evaluate: 'CI_COMMIT_AUTHOR_EMAIL != "renovate@mgrote.net"'
...

42
scripts/ghist Executable file
View file

@ -0,0 +1,42 @@
#!/bin/bash
total_commits=$(git rev-list HEAD --count)
current_commit=$total_commits
show_commit_diff() {
if [ "$current_commit" -le "$total_commits" ] && [ "$current_commit" -ge 1 ]; then
commit_hash=$(git rev-list --reverse HEAD | sed -n "${current_commit}p")
git --no-pager show "$commit_hash"
fi
}
while true; do
clear # Clear the terminal
show_commit_diff
# Display navigation options
echo "-----------------------------------------------------------"
echo "Navigation: N - Next Commit, P - Previous Commit, Q - Quit"
echo "-----------------------------------------------------------"
read -r -n1 -s option
case $option in
p|P)
# shellcheck disable=2086
if [ $current_commit -gt 1 ]; then
((current_commit--))
fi
;;
n|N)
# shellcheck disable=2086
if [ $current_commit -lt $total_commits ]; then
((current_commit++))
fi
;;
q|Q)
break
;;
*)
echo "Invalid option"
;;
esac
done

1
scripts/git_history Symbolic link
View file

@ -0,0 +1 @@
ghist