|
|
|
|
@@ -102,6 +102,23 @@ function optionPicked() {
|
|
|
|
|
echo -e "${msg}\n"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
################################################################################
|
|
|
|
|
# DESC: Format date string
|
|
|
|
|
# ARGS: $* (required): String
|
|
|
|
|
# OUTS: String
|
|
|
|
|
################################################################################
|
|
|
|
|
format_date() {
|
|
|
|
|
local date="${1}"
|
|
|
|
|
local outf="${2}"
|
|
|
|
|
local datef="${3:-"%b %d %H:%M:%S %Y %Z"}" # Tue Oct 24 13:34:22 2023 +0300
|
|
|
|
|
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
|
|
|
|
local resp="$(date -d "${date}" "+${outf}")"
|
|
|
|
|
elif [[ "$OSTYPE" == "darwin"* ]]; then
|
|
|
|
|
local resp="$(date -j -f "${datef}" "${date}" "+${outf}")"
|
|
|
|
|
fi
|
|
|
|
|
printf "%s" "${resp}"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
################################################################################
|
|
|
|
|
# DESC: Help information printed to stdout during non-interactive mode
|
|
|
|
|
# ARGS: None
|
|
|
|
|
@@ -158,6 +175,8 @@ LIST OPTIONS
|
|
|
|
|
displays a list of commits per year
|
|
|
|
|
-w, --commits-by-weekday
|
|
|
|
|
displays a list of commits per weekday
|
|
|
|
|
-W, --commits-by-author-by-weekday
|
|
|
|
|
displays a list of commits per weekday by author
|
|
|
|
|
-o, --commits-by-hour
|
|
|
|
|
displays a list of commits per hour
|
|
|
|
|
-A, --commits-by-author-by-hour
|
|
|
|
|
@@ -243,12 +262,13 @@ function showMenu() {
|
|
|
|
|
printf %b "${NUMS} 13)${TEXT} Git commits per month\\n"
|
|
|
|
|
printf %b "${NUMS} 14)${TEXT} Git commits per year\\n"
|
|
|
|
|
printf %b "${NUMS} 15)${TEXT} Git commits per weekday\\n"
|
|
|
|
|
printf %b "${NUMS} 16)${TEXT} Git commits per hour\\n"
|
|
|
|
|
printf %b "${NUMS} 17)${TEXT} Git commits per hour by author\\n"
|
|
|
|
|
printf %b "${NUMS} 18)${TEXT} Git commits per timezone\\n"
|
|
|
|
|
printf %b "${NUMS} 19)${TEXT} Git commits per timezone by author\\n"
|
|
|
|
|
printf %b "${NUMS} 16)${TEXT} Git commits per weekday by author\\n"
|
|
|
|
|
printf %b "${NUMS} 17)${TEXT} Git commits per hour\\n"
|
|
|
|
|
printf %b "${NUMS} 18)${TEXT} Git commits per hour by author\\n"
|
|
|
|
|
printf %b "${NUMS} 19)${TEXT} Git commits per timezone\\n"
|
|
|
|
|
printf %b "${NUMS} 20)${TEXT} Git commits per timezone by author\\n"
|
|
|
|
|
printf %b "\\n${TITLES} Suggest:\\n"
|
|
|
|
|
printf %b "${NUMS} 20)${TEXT} Code reviewers (based on git history)\\n"
|
|
|
|
|
printf %b "${NUMS} 21)${TEXT} Code reviewers (based on git history)\\n"
|
|
|
|
|
printf %b "\\n${HELP_TXT}Please enter a menu option or ${EXIT_TXT}press Enter to exit.\\n"
|
|
|
|
|
printf %b "${TEXT}> ${NORMAL}"
|
|
|
|
|
read -r opt
|
|
|
|
|
@@ -391,7 +411,8 @@ function changelogs() {
|
|
|
|
|
--date=short "${_author}" "$_since" "$_until" $_log_options $_pathspec \
|
|
|
|
|
| sort -u -r | head -n $_limit \
|
|
|
|
|
| while read DATE; do
|
|
|
|
|
echo -e "\n[$DATE]"
|
|
|
|
|
day=$(format_date "$DATE" "%A" "%Y-%m-%d")
|
|
|
|
|
echo -e "\n[$DATE - $day]"
|
|
|
|
|
GIT_PAGER=cat git -c log.showSignature=false log \
|
|
|
|
|
--use-mailmap $_merges \
|
|
|
|
|
--format=" * %s (%aN)" "${_author}" \
|
|
|
|
|
@@ -781,14 +802,24 @@ function commitsByMonth() {
|
|
|
|
|
# OUTS: None
|
|
|
|
|
################################################################################
|
|
|
|
|
function commitsByWeekday() {
|
|
|
|
|
optionPicked "Git commits by weekday:"
|
|
|
|
|
local author="${1:-}"
|
|
|
|
|
local _author=""
|
|
|
|
|
|
|
|
|
|
if [[ -z "${author}" ]]; then
|
|
|
|
|
optionPicked "Git commits by weekday:"
|
|
|
|
|
_author="--author=**"
|
|
|
|
|
else
|
|
|
|
|
optionPicked "Git commits by weekday for author '${author}':"
|
|
|
|
|
_author="--author=${author}"
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
echo -e "\tday\tsum"
|
|
|
|
|
local i counter=1
|
|
|
|
|
for i in Mon Tue Wed Thu Fri Sat Sun
|
|
|
|
|
do
|
|
|
|
|
echo -en "\t$counter\t$i\t"
|
|
|
|
|
git -c log.showSignature=false shortlog -n $_merges --format='%ad %s' \
|
|
|
|
|
"$_since" "$_until" $_log_options |
|
|
|
|
|
"${_author}" "$_since" "$_until" $_log_options |
|
|
|
|
|
grep -cE "^ * $i \w\w\w [0-9]{1,2} " || continue
|
|
|
|
|
counter=$((counter+1))
|
|
|
|
|
done | awk '{
|
|
|
|
|
@@ -961,6 +992,12 @@ if [[ "$#" -eq 1 ]]; then
|
|
|
|
|
-Y|--commits-by-year ) commitsByYear;;
|
|
|
|
|
-m|--commits-by-month) commitsByMonth;;
|
|
|
|
|
-w|--commits-by-weekday) commitsByWeekday;;
|
|
|
|
|
-W|--commits-by-author-by-weekday)
|
|
|
|
|
author="${_GIT_AUTHOR:-}"
|
|
|
|
|
while [[ -z "${author}" ]]; do
|
|
|
|
|
read -r -p "Which author? " author
|
|
|
|
|
done
|
|
|
|
|
commitsByWeekday "${author}";;
|
|
|
|
|
-o|--commits-by-hour) commitsByHour;;
|
|
|
|
|
-A|--commits-by-author-by-hour)
|
|
|
|
|
author="${_GIT_AUTHOR:-}"
|
|
|
|
|
@@ -1034,19 +1071,24 @@ while [[ "${opt}" != "" ]]; do
|
|
|
|
|
13) commitsByMonth; showMenu;;
|
|
|
|
|
14) commitsByYear; showMenu;;
|
|
|
|
|
15) commitsByWeekday; showMenu;;
|
|
|
|
|
16) commitsByHour; showMenu;;
|
|
|
|
|
17) author=""
|
|
|
|
|
16) author=""
|
|
|
|
|
while [[ -z "${author}" ]]; do
|
|
|
|
|
read -r -p "Which author? " author
|
|
|
|
|
done
|
|
|
|
|
commitsByWeekday "${author}"; showMenu;;
|
|
|
|
|
17) commitsByHour; showMenu;;
|
|
|
|
|
18) author=""
|
|
|
|
|
while [[ -z "${author}" ]]; do
|
|
|
|
|
read -r -p "Which author? " author
|
|
|
|
|
done
|
|
|
|
|
commitsByHour "${author}"; showMenu;;
|
|
|
|
|
18) commitsByTimezone; showMenu;;
|
|
|
|
|
19) author=""
|
|
|
|
|
19) commitsByTimezone; showMenu;;
|
|
|
|
|
20) author=""
|
|
|
|
|
while [[ -z "${author}" ]]; do
|
|
|
|
|
read -r -p "Which author? " author
|
|
|
|
|
done
|
|
|
|
|
commitsByTimezone "${author}"; showMenu;;
|
|
|
|
|
20) suggestReviewers; showMenu;;
|
|
|
|
|
21) suggestReviewers; showMenu;;
|
|
|
|
|
q|"\n") exit;;
|
|
|
|
|
*) clear; optionPicked "Pick an option from the menu"; showMenu;;
|
|
|
|
|
esac
|
|
|
|
|
|