diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2023-07-12 11:20:34 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2023-07-12 11:20:34 -0300 |
commit | f0fad0ddc3920f9dd7787df7138f1d661d27fa5d (patch) | |
tree | ebfe10727fc9287a95ed49b2b0cdbff7099a5ead | |
parent | a6d0aeca708c5a6f460ec6b2d62aa3522e00ba53 (diff) | |
download | scripts-f0fad0ddc3920f9dd7787df7138f1d661d27fa5d.tar.gz scripts-f0fad0ddc3920f9dd7787df7138f1d661d27fa5d.tar.bz2 |
Improve the 'show' command
-rwxr-xr-x | show | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -34,7 +34,7 @@ function __update_filelist { # Check if [ -z "$ITEM" ]; then - echo "usage: $BASENAME <item-name>" + echo "usage: $BASENAME [option] [<item-name>]" 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 |