]> gitweb.fluxo.info Git - scripts.git/commitdiff
Fix: show: restrict filelist to some file extensions
authorSilvio Rhatto <rhatto@riseup.net>
Sun, 6 Dec 2020 12:18:55 +0000 (09:18 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Sun, 6 Dec 2020 12:18:55 +0000 (09:18 -0300)
show

diff --git a/show b/show
index 8f3053b0a7df5973155b28cd79312ae1dfcb3bf5..1485441ffe4d1e7551024f4d40c934d6805142e8 100755 (executable)
--- a/show
+++ b/show
@@ -7,6 +7,8 @@
 BASENAME="`basename $0`"
 DOCS="$HOME/data/doc"
 LIST="$DOCS/.filelist"
+DOC_PATTERN=".*\.(txt|doc|docx|rtf|pdf|sxc|csv|odt|odf|ods|xls|xlsx|ppt|epub|mobi|djvu|lit)"
+FIND_OPTS="-not -path '*.git*' -regextype posix-egrep -iregex"
 ITEM="$1"
 DATE="`date +%s`"
 MAX_AGE="86400"
@@ -14,7 +16,7 @@ MAX_AGE="86400"
 # Update the filelist
 function __update_filelist {
   echo "Generating new filelist..."
-  cd $DOCS && find . -not -path '*.git*' > $LIST
+  cd $DOCS && find . $FIND_OPTS "$DOC_PATTERN" > $LIST
 }
 
 # Check