commit 1e6100ad80ef0a8431f7e04c9edbd27bb9bb339f parent a328f02853a96c25986b66ad73f9fc35fde7d553 Author: Christoph Lohmann <20h@r-36.net> Date: Sun, 23 Jul 2017 18:34:23 +0200 Add the fileopener and scmopener. Diffstat:
openers/fileopener | | | 2 | -- |
openers/scmopener | | | 20 | ++++++++++++++++++++ |
2 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/openers/fileopener b/openers/fileopener @@ -1,7 +1,5 @@ #!/bin/sh -set -x - if [ $# -lt 1 ]; then printf "usage: %s path\n" "$(basename "$0")" >&2 diff --git a/openers/scmopener b/openers/scmopener @@ -0,0 +1,20 @@ +#!/bin/sh + +if [ $# -lt 1 ]; +then + printf "usage: %s scm:path\n" "$(basename "$0")" >&2 + exit 1 +fi + +[ -z "$SCM" ] && exit 1 + +path="$SCM/$(printf "%s\n" "$1" | cut -d':' -f 2-)" +if [ -d "$path" ]; +then + [ -z "$SHELL" ] && SHELL="/bin/sh" + st -e /bin/sh -c "cd \"${path}\"; $SHELL" >&2 >/dev/null & + exit 0 +fi + +see "$path" +