Summary Files Commits Branches @commit @diff @stats
diff options
context:
space:
mode:
Commit9f6222ac1bf8c2d7ddeb45bf61dcc2a87f7143ee (patch)
Author
 Syndamia <kamen@syndamia.com>
2023-10-23 14:58:17 +0300
Committer
 Syndamia <kamen@syndamia.com>
2023-10-23 14:59:52 +0300
Files923caaf4d63eb2e463825337062d0dde403a5eb1
csg-9f6222ac1bf8c2d7ddeb45bf61dcc2a87f7143ee.tar
csg-9f6222ac1bf8c2d7ddeb45bf61dcc2a87f7143ee.tar.gz
csg-9f6222ac1bf8c2d7ddeb45bf61dcc2a87f7143ee.zip
Parent3477a5795c29226dd4c7ec6b46178bde698d24db (diff)
[s0] Reworked timestamp.txt generation to use while heredoc and an awk script for creation
Faster and more portable
1 files changed, 8 insertions, 5 deletions
-rwxr-xr-xcsg13
diff --git a/csg b/csg
index 53a6f70..c145ca2 100755
--- a/csg
+++ b/csg
@@ -131,12 +131,15 @@ endTimer() {
if [ -n "$CSG_TIMESTAMP_FILE" ] && isCommand 'git'
then
timestamps_writeDates() {
- for file in $(find . -type f -name '*.md')
+ while read -r file
do
- dates=($(git log --follow --pretty=format:%ad --date="format:%d %B %Y" -- "$file"))
- line="$DESTINATION${file:1:-2}html\t${dates[@]: -3:3} ${dates[@]:0:3}"
- echo -e "$line" >> "$CSG_TIMESTAMP_FILE"
- done
+ git log --follow --pretty=format:%ad --date="format:%d %B %Y" -- "$file" | $CSG_AWK -v dest="$DESTINATION" -v file="$file" '
+ BEGIN { file = dest substr(file, 2, length(file) - 3) "html" }
+ NR == 1 { later = $0 }
+ END { print file "\t" $0 "\t" later }' >> "$CSG_TIMESTAMP_FILE"
+ done << EOF
+$(find . -type f -name '*.md')
+EOF
}
headc="$(git rev-parse HEAD)"