Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
In this case it pulls from stat. Bad idea. But, it's just an example.
- Loading branch information
1 parent
f39eb81
commit feac05e
Showing
1 changed file
with
18 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,24 @@ | ||
|
||
# This is meant to use metadata from git, or hg, or the filesystem, or whatever to augment the user-given metadata | ||
# It's meant to fill in all the auto-generatable blanks | ||
# Here we're reading fake data from the file metadata | ||
|
||
redo-ifchange "$1.mime" | ||
echo "ID: blah" | ||
echo "Date-Created: YYYY-MM-DD" | ||
echo "Date-Modified: YYYY-MM-DD" | ||
|
||
# I don't know how standard the -c option is | ||
modify_time="$(stat -c "%Y" "$1.mime")" | ||
# I can't get creation time from the system reliably | ||
create_time="$modify_time" | ||
|
||
# Since create time is arbitrary, this is not a good idea... | ||
# But, this is mostly an example for testing | ||
id="$create_time" | ||
|
||
# This is the date format (iso8601) | ||
date_format="%Y-%m-%dT%H:%M:%SZ" | ||
|
||
echo "ID: $id" | ||
# I don't know how standard the '@' to set based on epoch time is, but I know the -d isn't super standard | ||
echo "Date-Created: $(date -ud "@$create_time" "+$date_format")" | ||
echo "Date-Modified: $(date -ud "@$modify_time" "+$date_format")" | ||
cat "$1.mime" |