From: Silvio Rhatto Date: Wed, 12 Jul 2023 14:20:34 +0000 (-0300) Subject: Improve the 'show' command X-Git-Url: https://gitweb.fluxo.info/?a=commitdiff_plain;h=f0fad0ddc3920f9dd7787df7138f1d661d27fa5d;p=scripts.git Improve the 'show' command --- diff --git a/show b/show index aa8c539..a68264b 100755 --- a/show +++ b/show @@ -34,7 +34,7 @@ function __update_filelist { # Check if [ -z "$ITEM" ]; then - echo "usage: $BASENAME " + echo "usage: $BASENAME [option] []" exit 1 elif [ "$ITEM" == "--refresh" ]; then __update_filelist @@ -74,8 +74,15 @@ elif [ "$ITEM" == "--watch" ]; then $PROGRAM --refresh done else + if [ "${ITEM:0:2}" == "--" ] && [ ! -z "$OPTION" ]; then + OPEN="${ITEM:2}" + ITEM="$OPTION" + else + OPEN="xdg-open" + fi + grep -i -- "$ITEM" $LIST | while read entry; do echo "Opening $entry..." - cd $DOCS && xdg-open "$entry" + cd $DOCS && $OPEN "$entry" done fi