Use .sh file extension in src/
* Re-write timestamp in sh instead of tcl
This commit is contained in:
parent
207a824e75
commit
c28f163394
8
build.sh
8
build.sh
|
@ -21,9 +21,9 @@ cbuild() {
|
||||||
(set -x; cc $CFLAGS -o "$targetdest" "$target" src/util.c "$@")
|
(set -x; cc $CFLAGS -o "$targetdest" "$target" src/util.c "$@")
|
||||||
}
|
}
|
||||||
|
|
||||||
fbuild() {
|
shbuild() {
|
||||||
target="$1"
|
target="$1"
|
||||||
targetdest="bin/$(prettyname "$target")"
|
targetdest="bin/$(prettyname "$target" | sed 's/\.sh$//')"
|
||||||
(set -x; cp "$target" "$targetdest")
|
(set -x; cp "$target" "$targetdest")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,8 +35,8 @@ bin() {
|
||||||
cbuild "$f"
|
cbuild "$f"
|
||||||
done
|
done
|
||||||
|
|
||||||
for f in src/pasta src/sign src/timestamp src/confirm; do
|
for f in src/*.sh; do
|
||||||
fbuild "$f"
|
shbuild "$f"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
#!/usr/bin/env tclsh
|
#!/usr/bin/env sh
|
||||||
#
|
#
|
||||||
# timestamp: print current date-timestamp
|
# timestamp: print current date-time(stamp)
|
||||||
# author: djl
|
# author: Dylan Lom <djl@dylanlom.com>
|
||||||
#
|
#
|
||||||
# Copyright (C) 2020 Dylan Lom <djl@dylanlom.com>
|
# Copyright (C) 2021 Dylan Lom <djl@dylanlom.com>
|
||||||
#
|
#
|
||||||
# Permission to use, copy, modify, and/or distribute this software for any purpose
|
# Permission to use, copy, modify, and/or distribute this software for any purpose
|
||||||
# with or without fee is hereby granted.
|
# with or without fee is hereby granted.
|
||||||
|
@ -18,21 +18,26 @@
|
||||||
#
|
#
|
||||||
# flags:
|
# flags:
|
||||||
# -d date only.
|
# -d date only.
|
||||||
# -r rfc3339 except it's missing the colon in offset /shrug.
|
# -r rfc3339 without a colon in offset.
|
||||||
|
# -R rfc3339
|
||||||
# -v verbose human readable.
|
# -v verbose human readable.
|
||||||
# human readable.
|
# -h display help
|
||||||
proc die {{msg "USAGE: $argv0 \[-d|r|v\]"}} {
|
# * human readable.
|
||||||
puts stderr $msg
|
|
||||||
exit 1
|
argv0="$0"
|
||||||
|
|
||||||
|
usage() {
|
||||||
|
echo "USAGE: $argv0 [-d|-r|-R|-v|-h]" > /dev/stderr
|
||||||
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
switch [lindex $argv 0] {
|
case "$1" in
|
||||||
-d { set fmt "%Y-%m-%d" }
|
'-h') usage ;;
|
||||||
-r { set fmt "%Y-%m-%dT%T%z" }
|
'-d') fmt='%Y-%m-%d';;
|
||||||
-v { set fmt "%Y-%m-%d %T %Z" }
|
'-r') fmt='%Y-%m-%dT%T%z' ;;
|
||||||
{} { set fmt "%Y-%m-%d %H:%M" }
|
'-R') fmt='%Y-%m-%dT%T%:z' ;;
|
||||||
default die
|
'-v') fmt='%Y-%m-%d %T %Z';;
|
||||||
}
|
*) fmt='%Y-%m-%d %H:%M';;
|
||||||
|
esac
|
||||||
puts [clock format [clock seconds] -format $fmt];
|
|
||||||
|
|
||||||
|
date "+$fmt"
|
Loading…
Reference in New Issue