dot

packages and services management
Log | Files | Refs | README

commit a8e7e45a9587452539433e5c23d0242f1d706b41
parent d727cf75f97cf7c219679f6b6716e2f4dc4042c0
Author: Josuah Demangeon <mail@josuah.net>
Date:   Wed,  7 Mar 2018 15:48:38 +0100

get the real path

Diffstat:
Mbin/io-find | 2+-
Mbin/xdg-open | 19+++++++++----------
2 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/bin/io-find b/bin/io-find @@ -2,4 +2,4 @@ # find a file from current directory with iomenu -find "${@:-.}" -name .git -prune -o -print | iomenu +find "${@:-.}" \( -name .git -o -name CVS \) -prune -o -print | sort | iomenu diff --git a/bin/xdg-open b/bin/xdg-open @@ -2,8 +2,11 @@ # override the xdg-open utility -[ -e "$1" ] && set -- "$(cd "$(dirname "$1")" && pwd)/$(basename "$1")" -printf '\033]0;%s\a' "${1%/.}" +[ -h "$1" ] && set -- "$(readlink "$1")" +[ -e "$1" ] && set -- "$(cd "$(dirname "$1")"; pwd)/$(basename "$1")" +[ -d "$1" ] && set -- "$(cd "$1"; pwd)" + +printf '\033]0;%s\a' "$1" # [scheme://][user[:pass]@]host[:port][/path] IFS=' ' read scheme user pass host port path << EOF @@ -55,11 +58,12 @@ EOF case "$host" in (*.onion) - [ -z "$TOR" ] && TOR=1 exec torsocks "$0" "$@" + [ "$TOR" ] || TOR="$1" exec torsocks "$0" "$1" ;; esac file="" + case "$path" in (*.torrent) file="$HOME/var/torrent/${path##*/}" @@ -274,12 +278,7 @@ case "$1" in exec ar vx "$1" ;; (*) - if [ -d "$1" ] - then - exec "$0" "$(find "$1" | iomenu)" - elif [ -f "$1" ] - then - exec $EDITOR "$1" - fi + [ -f "$1" ] && exec $EDITOR "$1" + [ -d "$1" ] && exec "$0" "$(io-find "$1")" ;; esac