new colors and informative git commits
This commit is contained in:
20
src/main.sh
20
src/main.sh
@@ -596,8 +596,9 @@ __refresh_data() {
|
||||
}
|
||||
|
||||
###
|
||||
### UX helper functions
|
||||
### Helper functions
|
||||
### __datetime_human_machine
|
||||
### __summary_for_commit
|
||||
###
|
||||
|
||||
# __datetime_human_machine()
|
||||
@@ -614,6 +615,15 @@ __datetime_human_machine() {
|
||||
date -d "@$s" +"$dfmt"
|
||||
}
|
||||
|
||||
# __summary_for_commit()
|
||||
# Get summary string that can be used in for git-commit messages.
|
||||
#
|
||||
# @input $1: iCalendar file path
|
||||
# @req $AWK_GET: Awk script to extract fields from iCalendar file
|
||||
__summary_for_commit() {
|
||||
awk -v field="SUMMARY" "$AWK_GET" "$1" | tr -c -d "[:alnum:][:blank:]" | head -c 15
|
||||
}
|
||||
|
||||
###
|
||||
### iCalendar modification wrapper
|
||||
###
|
||||
@@ -661,7 +671,7 @@ __edit() {
|
||||
mv "$filenew" "$fpath"
|
||||
if [ -n "${GIT:-}" ]; then
|
||||
$GIT add "$fpath"
|
||||
$GIT commit -m "Modified event" -- "$fpath"
|
||||
$GIT commit -m "Modified event '$(__summary_for_commit "$fpath") ...'" -- "$fpath"
|
||||
fi
|
||||
__refresh_data
|
||||
else
|
||||
@@ -727,7 +737,7 @@ __new() {
|
||||
mv "$filenew" "$fpath"
|
||||
if [ -n "${GIT:-}" ]; then
|
||||
$GIT add "$fpath"
|
||||
$GIT commit -m "Added event" -- "$fpath"
|
||||
$GIT commit -m "Added event '$(__summary_for_commit "$fpath") ...'" -- "$fpath"
|
||||
fi
|
||||
start=$(awk -v field="DTSTART" "$AWK_GET" "$fpath" | grep -o '[0-9]\{8\}')
|
||||
else
|
||||
@@ -757,7 +767,7 @@ __delete() {
|
||||
rm -v "$fpath"
|
||||
if [ -n "${GIT:-}" ]; then
|
||||
$GIT add "$fpath"
|
||||
$GIT commit -m "Deleted event" -- "$fpath"
|
||||
$GIT commit -m "Deleted event '$(__summary_for_commit "$fpath") ...'" -- "$fpath"
|
||||
fi
|
||||
break
|
||||
;;
|
||||
@@ -793,7 +803,7 @@ __import_to_collection() {
|
||||
mv "$filetmp" "$fpath"
|
||||
if [ -n "${GIT:-}" ]; then
|
||||
$GIT add "$fpath"
|
||||
$GIT commit -m "Imported event" -- "$fpath"
|
||||
$GIT commit -m "Imported event '$(__summary_for_commit "$fpath") ...'" -- "$fpath"
|
||||
fi
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user