Home
       tio-xdg-open - iomenu - interactive terminal-based selection menu
  HTML git clone git://bitreich.org/iomenu git://hg6vgqziawt5s4dj.onion/iomenu
   DIR Log
   DIR Files
   DIR Refs
   DIR Tags
   DIR README
   DIR LICENSE
       ---
       tio-xdg-open (710B)
       ---
            1 #!/bin/sh -e
            2 # pick a file to open with xdg-open with iomenu with caching
            3 #
            4 # The cache is updated when a directory is selected.
            5 
            6 LC_COLLATE=C
            7 
            8 touch "$HOME/.cache/find"
            9 
           10 if        test -f "$HOME/.cache/find" && test $# = 0
           11 then        exec "$0" "$HOME"
           12 elif        test $# = 0
           13 then        exec xdg-open "$(iomenu <$HOME/.cache/find)"
           14 fi
           15 
           16 mkdir -p "$HOME/.cache"
           17 {
           18         find "$1" '(' -name .git -o -name CVS ')' -prune -o \
           19                 -type d -exec printf '%s/\n' '{}' + -o \
           20                 -type f -exec printf '%s\n' '{}' + | tee "$HOME/.cache/$$" 
           21         grep -vF "$1" $HOME/.cache/find
           22 } | sort -o "$HOME/.cache/find"
           23 
           24 s=$(iomenu <$HOME/.cache/$$)
           25 
           26 rm "$HOME/.cache/$$"
           27 
           28 case $s in
           29 ('')        exit 1 ;;
           30 (*/)        exec "$0" "$(cd "$s" && pwd)" ;;
           31 (*)        exec xdg-open "$s" ;;
           32 esac