Skip to content

Commit

Permalink
add date templates
Browse files Browse the repository at this point in the history
  • Loading branch information
pquerna committed Apr 10, 2024
1 parent ae7699c commit 14fb094
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/shared.bash
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ function expand_templates() {
TARGET="$(echo -e "${TEMPLATE_VALUE/"checksum"/""}" | tr -d \' | tr -d \" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')"
EXPANDED_VALUE=$(find "$TARGET" -type f -exec $HASHER_BIN {} \; | sort -k 2 | $HASHER_BIN | awk '{print $1}')
;;
"date "*)
DATE_FMT="$(echo -e "${TEMPLATE_VALUE/"date"/""}" | tr -d \' | tr -d \" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')"
EXPANDED_VALUE=$(date "${DATE_FMT}")
;;
"env."*)
ENV_VAR_NAME="$(echo -e "${TEMPLATE_VALUE/"env."/""}" | tr -d \' | tr -d \" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')"
EXPANDED_VALUE="${!ENV_VAR_NAME}"
Expand Down

0 comments on commit 14fb094

Please sign in to comment.