]> gitweb.fluxo.info Git - scripts.git/commitdiff
Feat: improve show script
authorSilvio Rhatto <rhatto@riseup.net>
Tue, 10 Nov 2020 18:55:24 +0000 (15:55 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Tue, 10 Nov 2020 18:55:24 +0000 (15:55 -0300)
show

diff --git a/show b/show
index 35008dc92c0068eff529b7bc06f29f8292273d1c..8f3053b0a7df5973155b28cd79312ae1dfcb3bf5 100755 (executable)
--- a/show
+++ b/show
@@ -43,7 +43,12 @@ fi
 
 # Dispatch
 #find $DOCS -iname "*$ITEM*" | head -1 | while read entry; do xdg-open "$entry"; done
-grep -- "$ITEM" $LIST | while read entry; do
-  echo "Opening $entry..."
-  cd $DOCS && xdg-open "$entry"
-done
+if [ "$ITEM" == "--search" ]; then
+  shift
+  grep -i -- "$*" $LIST
+else
+  grep -i -- "$ITEM" $LIST | while read entry; do
+    echo "Opening $entry..."
+    cd $DOCS && xdg-open "$entry"
+  done
+fi