summaryrefslogtreecommitdiffstats
path: root/clerk
diff options
context:
space:
mode:
authorRasmus Steinke <rasi@xssn.at>2015-10-30 20:22:34 +0100
committerRasmus Steinke <rasi@xssn.at>2015-10-30 20:22:34 +0100
commitb6b45ef91f32024ea0426f6f6e612f69d4d69663 (patch)
tree4e1c6afc9bcaa2796b5818b57db6f9c7aef93ce8 /clerk
parent7d972a0890cc3110460768c973d9ec316af8b301 (diff)
downloadperl-app-clerk-b6b45ef91f32024ea0426f6f6e612f69d4d69663.tar.gz
perl-app-clerk-b6b45ef91f32024ea0426f6f6e612f69d4d69663.tar.xz
dont create cache twice
Diffstat (limited to 'clerk')
-rwxr-xr-xclerk14
1 files changed, 9 insertions, 5 deletions
diff --git a/clerk b/clerk
index 2990a07..98927ee 100755
--- a/clerk
+++ b/clerk
@@ -186,13 +186,17 @@ updateCache () {
# | gawk -F '\t' '{ printf "%.2s\t%.40s\t%.40s\t%.200s\t%.500s\n", $1, $2, $3, $4, $5, $6 }' \
}
-date=$(mpc stats | grep 'DB Updated: ')
-file="$HOME/.config/clerk/.lastupdate"
-if [ "$(< $file)" = "$date" ] && [ -f "$file" ] ; then
+if [[ $1 == "--update" ]]; then
:
else
- updateCache
- echo "${date}" > "${file}"
+ date=$(mpc stats | grep 'DB Updated: ')
+ file="$HOME/.config/clerk/.lastupdate"
+ if [ "$(< $file)" = "$date" ] && [ -f "$file" ] ; then
+ :
+ else
+ updateCache
+ echo "${date}" > "${file}"
+ fi
fi
# Use GNU coreutils on OSX