Diff
1diff --git a/.github/dependencies.yml b/.github/dependencies.yml
2index 46e7727b8a8e7b0ac956e755717065691396c2bf..70f3d03da646fdb74952623f0adc6e871ade85ef 100644
3--- a/.github/dependencies.yml
4+++ b/.github/dependencies.yml
5@@ -30,7 +30,7 @@ dependencies:
6 plugins/wd:
7 repo: mfaerevaag/wd
8 branch: master
9- version: tag:v0.9.3
10+ version: tag:v0.10.0
11 precopy: |
12 set -e
13 rm -r test
14diff --git a/plugins/wd/_wd.sh b/plugins/wd/_wd.sh
15index 46b032f7800d4208968e77c0f3bce57e16538948..7c416086d1518c4af1548c62c533fe0e4a385fe8 100644
16--- a/plugins/wd/_wd.sh
17+++ b/plugins/wd/_wd.sh
18@@ -37,6 +37,7 @@ function _wd() {
19 'rm:Removes the given warp point'
20 'list:Outputs all stored warp points'
21 'ls:Show files from given warp point'
22+ 'open:Open warp point in the default file explorer'
23 'path:Show path to given warp point'
24 'show:Outputs all warp points that point to the current directory or shows a specific target directory for a point'
25 'help:Show this extremely helpful text'
26@@ -73,6 +74,9 @@ function _wd() {
27 ls)
28 _describe -t points "Warp points" warp_points && ret=0
29 ;;
30+ open)
31+ _describe -t points "Warp points" warp_points && ret=0
32+ ;;
33 path)
34 _describe -t points "Warp points" warp_points && ret=0
35 ;;
36diff --git a/plugins/wd/wd.sh b/plugins/wd/wd.sh
37index f8b27828f1162c8015c90f6df018dcfece460172..f7a22ff7dee921a37d4ee7154c0247d4884af65b 100755
38--- a/plugins/wd/wd.sh
39+++ b/plugins/wd/wd.sh
40@@ -8,7 +8,7 @@
41 # @github.com/mfaerevaag/wd
42
43 # version
44-readonly WD_VERSION=0.9.3
45+readonly WD_VERSION=0.10.0
46
47 # colors
48 readonly WD_BLUE="\033[96m"
49@@ -86,6 +86,7 @@ Commands:
50 show Print warp points to current directory
51 list Print all stored warp points
52 ls <point> Show files from given warp point (ls)
53+ open <point> Open the warp point in the default file explorer (open / xdg-open)
54 path <point> Show the path to given warp point (pwd)
55 clean Remove points warping to nonexistent directories (will prompt unless --force is used)
56
57@@ -377,6 +378,21 @@ wd_ls()
58 ls "${dir/#\~/$HOME}"
59 }
60
61+wd_open()
62+{
63+ wd_getdir "$1"
64+ if command -v open >/dev/null 2>&1; then
65+ # MacOS, Ubuntu (alias)
66+ open "${dir/#\~/$HOME}"
67+ elif command -v xdg-open >/dev/null 2>&1; then
68+ # Most Linux desktops
69+ xdg-open "${dir/#\~/$HOME}"
70+ else
71+ echo "No known file opener found (need 'open' or 'xdg-open')." >&2
72+ exit 1
73+ fi
74+}
75+
76 wd_path()
77 {
78 wd_getdir "$1"
79@@ -521,7 +537,7 @@ do
80 done < "$wd_config_file"
81
82 # get opts
83-args=$(getopt -o a:r:c:lhs -l add:,rm:,clean,list,ls:,path:,help,show -- $*)
84+args=$(getopt -o a:r:c:lhs -l add:,rm:,clean,list,ls:,open:,path:,help,show -- $*)
85
86 # check if no arguments were given, and that version is not set
87 if [[ ($? -ne 0 || $#* -eq 0) && -z $wd_print_version ]]
88@@ -571,6 +587,10 @@ else
89 wd_ls "$2"
90 break
91 ;;
92+ "-o"|"--open"|"open")
93+ wd_open "$2"
94+ break
95+ ;;
96 "-p"|"--path"|"path")
97 wd_path "$2"
98 break